Refactored tests; make just builds library, make test builds/runs tests

This commit is contained in:
Meredith L. Patterson 2012-11-13 22:29:25 -05:00
parent 236ec733a1
commit de8db18db4
12 changed files with 613 additions and 615 deletions

View file

@ -41,7 +41,11 @@ HAMMER_PARTS := \
$(PARSERS:%=parsers/%.o) \
$(BACKENDS:%=backends/%.o)
TESTS := t_benchmark.o
TESTS := t_benchmark.o \
t_bitreader.o \
t_bitwriter.o \
t_parser.o \
test_suite.o
OUTPUTS := libhammer.a \
test_suite.o \
@ -53,6 +57,8 @@ TOPLEVEL := ../
include ../common.mk
$(TESTS): CFLAGS += $(TEST_CFLAGS)
$(TESTS): LDFLAGS += $(TEST_LDFLAGS)
all: libhammer.a
@ -61,15 +67,10 @@ libhammer.a: $(HAMMER_PARTS)
bitreader.o: test_suite.h
hammer.o: hammer.h
ifneq ($(INCLUDE_TESTS),0)
all: test_suite
benchmark: t_benchmark.o libhammer.a
$(call hush, "Linking $@") $(CC) -o $@ $^ $(LDFLAGS)
all: libhammer.a
test: test_suite
./test_suite -v
test_suite: test_suite.o libhammer.a
$(call hush, "Linking $@") $(CC) -o $@ $^ $(LDFLAGS)
endif
test_suite: $(TESTS) libhammer.a
$(call hush, "Linking $@") $(CC) -o $@ $^ $(LDFLAGS) $(TEST_LDFLAGS)