CFLAGS = -Isrc/ -L. -std=c99 -pedantic CC?=gcc LIBNAME = libctemplates.a BIN_POSTFIX = .exe ifeq ($(DEBUG),true) CFLAGS += -g -O0 -Wall -Werror else CFLAGS += -O3 endif objs = ctemplates fbuf hashmap kmp objfiles = $(objs:%=build/%.o) TEST_1_NAME = t/test_1$(BIN_POSTFIX) $(LIBNAME): $(objfiles) ar rc $@ $^ ranlib $@ $(objfiles) : build/%.o : src/%.c src/%.h $(CC) $(CFLAGS) -c -o $@ $< clean: $(RM) build/*.o *.a $(LIBNAME) $(TEST_1_NAME): t/test_1.c $(LIBNAME) $(CC) $(CFLAGS) -o $(TEST_1_NAME) t/test_1.c -lctemplates test: $(TEST_1_NAME) $(TEST_1_NAME) install: $(LIBNAME) cp $(LIBNAME) /usr/local/lib mkdir -p /usr/local/include/ctemplates cp include/ctemplates.h /usr/local/include/ctemplates/