Improved `test` make target: Added phony: `test`, builds and runs the test program against the debug static lib target.

Fortune for memfd_secret-shim's current commit: Half blessing − 半吉
master
Avril 8 months ago
parent 7eaf4df51c
commit 7d182704b9
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -234,6 +234,11 @@ all: | clean
@$(MAKE) clean-rebuild
@$(MAKE) debug
.PHONY: test
test: $(PROJECT)-test
-strace ./$<
-valgrind ./$<
# Targets
.PHONY: pch
@ -345,8 +350,8 @@ uninstall:
cd $(INCLUDE) && find . -type f | xargs -I {} rm "$(DESTDIR)$(PREFIX)/include/$(PROJECT)/{}"
rmdir $(DESTDIR)$(PREFIX)/include/$(PROJECT)
#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) src/test/*.c -o $@ -l:$< $(LDFLAGS)
-valgrind ./$@
$(CC) $(CFLAGS) -fwhole-program src/test/*.c -o $@ -l:$< $(LDFLAGS)

Loading…
Cancel
Save