diff options
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 43 |
1 files changed, 40 insertions, 3 deletions
@@ -1,3 +1,40 @@ -main: - gcc main.c ./util/hash.c ./util/prime_search.c -lhts -lm ./util/sds/sds.c ./util/err.c -g -o qidx -fsanitize=address -.PHONY: main +ifeq ($(PREFIX),) + PREFIX := /usr/local +endif + +ifeq ($(BINDIR),) + BINDIR := /bin +endif + +CMD=qidx + +CC=gcc + +DEBUG := -fsanitize=address -O2 + +CFLAGS := -Wall -pedantic -g +LDFLAGS := -lhts -lm + +SRC_EXT:=%.c + +_STD_BUILD=$(CC) $(CFLAGS) $(filter $(SRC_EXT) %.o, $^) -o $@ +STD_BUILD=$(_STD_BUILD) $(LDFLAGS) +STD_COMPILE=$(_STD_BUILD) -c + +OBJS = ./util/hash.o +OBJS += ./util/prime_search.o +OBJS += ./util/prime_search.o +OBJS += ./util/sds/sds.o +OBJS += ./util/err.o +OBJS += ./qidx.o + +make: $(CMD) + +$(CMD): ./main.c $(OBJS) + $(STD_BUILD) + +clean: + $(RM) $(CMD) $(OBJS) + +%.o: %.c + $(STD_COMPILE) |