fix up Makefile
authorGeoffrey Allott <geoffrey@allott.email>
Mon, 15 Aug 2022 20:18:51 +0000 (21:18 +0100)
committerGeoffrey Allott <geoffrey@allott.email>
Mon, 15 Aug 2022 20:18:51 +0000 (21:18 +0100)
Makefile

index bedc284ad041c0ff80397acc1d9f5002c4300aa4..e5d3cc7d4d94ee08f8969b3235d679c749ffbf5b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,29 @@
 CFLAGS = -Isrc -g -O2 -Wall -Wextra -Wconversion -fsanitize=undefined -fsanitize=address -ftrivial-auto-var-init=pattern
 LDFLAGS = -lasan -lubsan
 
-OBJS = $(patsubst %.c, %.o, $(wildcard src/*.o))
-TEST_OBJS = $(patsubst %.c, %.o, $(wildcard test/*.o))
+BIN = src/tANS
+OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
+TEST_OBJS = $(patsubst %.c, %.o, $(wildcard test/*.c))
 TESTS = $(patsubst %.c, %, $(wildcard test/*.c))
 RUN_TESTS = $(addprefix run_, $(TESTS))
 
-default: $(RUN_TESTS)
+default: $(BIN) $(RUN_TESTS)
 
 $(RUN_TESTS): run_%: %
        $^
 
-all: $(OBJS)
+$(BIN): $(OBJS)
 
-$(OBJS): %.o: %.h src/tANS_constants.h
+$(OBJS): %.o: src/tANS_constants.h
 $(TEST_OBJS): test/test.h $(OBJS)
 
 test/test_tANS.o: src/tANS_decode_st.h src/tANS_decode_tbl.h src/tANS_encode_st.h src/tANS_encode_tbl.h src/tANS_symbol_tbl.h src/tANS_freq_tbl.h
 test/test_tANS: src/tANS_decode_st.o src/tANS_decode_tbl.o src/tANS_encode_st.o src/tANS_encode_tbl.o src/tANS_symbol_tbl.o src/tANS_freq_tbl.o
-src/tANS: $(OBJS)
 
 clean:
        rm -f $(OBJS)
        rm -f $(TEST_OBJS)
        rm -f $(TESTS)
+       rm -f $(BIN)
 
-.PHONY: default all clean $(RUN_TESTS)
+.PHONY: default clean $(RUN_TESTS)