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 7 months ago
parent 7eaf4df51c
commit 7d182704b9
Signed by: flanchan
GPG Key ID: 284488987C31F630

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

Loading…
Cancel
Save