Added `TARGET` var for `test` - {debug,release}.{a,so} (which build of lib to link to,) and configurable `TEST_{C,LD}FLAGS`. Fixed bug of adding test flags to dep build when it doesn"t already exist.

Fortune for memfd_secret-shim's current commit: Blessing − 吉
master
Avril 1 month ago
parent 8c94ce5f70
commit 94562877e0
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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)

Loading…
Cancel
Save