diff --git a/Makefile b/Makefile index 806c70c..8844055 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,13 @@ FEATURES?= # Build constants CONSTANTS+=_GNU_SOURCE +# Testing +# Can be {release,debug}.{a,so} +TARGET?=debug.a + +TEST_LDFLAGS+= -lfmt -lstdc++ -Wl,-z,now -Wl,-z -Wl,relro +TEST_CFLAGS+= -Og -g -fwhole-program + override __COMMA=, override __VERSION_SPLIT:= $(subst ., ,$(VERSION)) override __VERSION_REVISION:=$(word 3,$(__VERSION_SPLIT)) 0 @@ -354,7 +361,5 @@ uninstall: rmdir $(DESTDIR)$(PREFIX)/include/$(INCLUDE_PREFIX) || : #TODO: We can make the target between `{debug,release}{.a,.so}` configurable by call. e.g. `TARGET=release.a make test` -$(PROJECT)-test: LDFLAGS+= -lfmt -lstdc++ -$(PROJECT)-test: CFLAGS+= -Og -g -$(PROJECT)-test: lib$(PROJECT)-debug.a - $(CC) $(CFLAGS) -fwhole-program src/test/*.c -o $@ -l:$< $(LDFLAGS) +$(PROJECT)-test: lib$(PROJECT)-$(TARGET) + $(CC) $(CFLAGS) $(TEST_CFLAGS) src/test/*.c -o $@ -l:$< $(LDFLAGS) $(TEST_LDFLAGS)