@ -49,6 +49,13 @@ FEATURES?=
# Build constants
# Build constants
CONSTANTS += _GNU_SOURCE
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
o v e r r i d e __COMMA = ,
o v e r r i d e __COMMA = ,
override __VERSION_SPLIT : = $( subst ., ,$ ( VERSION ) )
override __VERSION_SPLIT : = $( subst ., ,$ ( VERSION ) )
override __VERSION_REVISION : =$( word 3,$ ( __VERSION_SPLIT ) ) 0
override __VERSION_REVISION : =$( word 3,$ ( __VERSION_SPLIT ) ) 0
@ -354,7 +361,5 @@ uninstall:
rmdir $( DESTDIR) $( PREFIX) /include/$( INCLUDE_PREFIX) || :
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`
#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 : lib $( PROJECT ) -$( TARGET )
$(PROJECT)-test : CFLAGS += -Og -g
$( CC) $( CFLAGS) $( TEST_CFLAGS) src/test/*.c -o $@ -l:$< $( LDFLAGS) $( TEST_LDFLAGS)
$(PROJECT)-test : lib $( PROJECT ) -debug .a
$( CC) $( CFLAGS) -fwhole-program src/test/*.c -o $@ -l:$< $( LDFLAGS)