diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -1,4 +1,4 @@ -CFLAGS = -I. -L. -std=c99 -pedantic +CFLAGS = -Isrc/ -L. -std=c99 -pedantic CC?=gcc LIBNAME = libctemplates.a BIN_POSTFIX = .exe @@ -9,26 +9,21 @@ else CFLAGS += -O3 endif -TEST_1_NAME = t/test_1$(BIN_POSTFIX) - -$(LIBNAME): ctemplates.o fbuf.o kmp.o hashmap.o - ar rc $(LIBNAME) ctemplates.o fbuf.o kmp.o hashmap.o - ranlib $(LIBNAME) +objs = ctemplates fbuf hashmap kmp +objfiles = $(objs:%=build/%.o) -fbuf.o : fbuf.c fbuf.h - $(CC) $(CFLAGS) -c -o fbuf.o fbuf.c -kmp.o : kmp.c kmp.h - $(CC) $(CFLAGS) -c -o kmp.o kmp.c +TEST_1_NAME = t/test_1$(BIN_POSTFIX) -ctemplates.o: ctemplates.c ctemplates.h - $(CC) $(CFLAGS) -c -o ctemplates.o ctemplates.c +$(LIBNAME): $(objfiles) + ar rc $@ $^ + ranlib $@ -hashmap.o: hashmap.c hashmap.h - $(CC) $(CFLAGS) -c -o hashmap.o hashmap.c +$(objfiles) : build/%.o : src/%.c src/%.h + $(CC) $(CFLAGS) -c -o $@ $< clean: - rm -f *.o *.a template + rm -f build/*.o *.a template $(TEST_1_NAME): t/test_1.c $(LIBNAME) $(CC) $(CFLAGS) -o $(TEST_1_NAME) t/test_1.c -lctemplates @@ -39,4 +34,4 @@ test: $(TEST_1_NAME) install: $(LIBNAME) cp $(LIBNAME) /usr/local/lib mkdir -p /usr/local/include/ctemplates - cp *.h /usr/local/include/ctemplates/ + cp include/ctemplates.h /usr/local/include/ctemplates/ |
