@ -100,6 +100,12 @@ STATIC_FLAGS+=
STATIC_RELEASE_FLAGS += -ffat-lto-objects
STATIC_RELEASE_FLAGS += -ffat-lto-objects
STATIC_DEBUG_FLAGS +=
STATIC_DEBUG_FLAGS +=
SHARED_LDFLAGS +=
STATIC_LDFLAGS +=
SHARED_BINFLAGS +=
STATIC_BINFLAGS +=
# Features application
# Features application
## Tell program which features are enabled via `FEATURE_<feature name in UPPER_SNAKE_CASE>`.
## Tell program which features are enabled via `FEATURE_<feature name in UPPER_SNAKE_CASE>`.
@ -298,30 +304,32 @@ prof/cxx/%.o: %.cpp $(PCH_OUTPUT)
lib$(PROJECT)-release.a : CFLAGS += $( RELEASE_CFLAGS ) $( STATIC_FLAGS ) $( STATIC_RELEASE_FLAGS )
lib$(PROJECT)-release.a : CFLAGS += $( RELEASE_CFLAGS ) $( STATIC_FLAGS ) $( STATIC_RELEASE_FLAGS )
lib$(PROJECT)-release.a : CXXFLAGS += $( RELEASE_CXXFLAGS ) $( STATIC_FLAGS ) $( STATIC_RELEASE_FLAGS )
lib$(PROJECT)-release.a : CXXFLAGS += $( RELEASE_CXXFLAGS ) $( STATIC_FLAGS ) $( STATIC_RELEASE_FLAGS )
lib$(PROJECT)-release.a : LDFLAGS += $( RELEASE_LDFLAGS )
lib$(PROJECT)-release.a : LDFLAGS += $( RELEASE_LDFLAGS ) $( STATIC_LDFLAGS )
lib$(PROJECT)-release.a : BINFLAGS += $( RELEASE_BINFLAGS ) $( STATIC_BINFLAGS )
lib$(PROJECT)-release.a : $( OBJ )
lib$(PROJECT)-release.a : $( OBJ )
$( AR) rcs $@ $^
$( AR) rcs $@ $^
$( RANLIB) $@
$( RANLIB) $@
lib$(PROJECT)-debug.a : CFLAGS += $( DEBUG_CFLAGS ) $( STATIC_FLAGS ) $( STATIC_DEBUG_FLAGS )
lib$(PROJECT)-debug.a : CFLAGS += $( DEBUG_CFLAGS ) $( STATIC_FLAGS ) $( STATIC_DEBUG_FLAGS )
lib$(PROJECT)-debug.a : CXXFLAGS += $( DEBUG_CXXFLAGS ) $( STATIC_FLAGS ) $( STATIC_DEBUG_FLAGS )
lib$(PROJECT)-debug.a : CXXFLAGS += $( DEBUG_CXXFLAGS ) $( STATIC_FLAGS ) $( STATIC_DEBUG_FLAGS )
lib$(PROJECT)-debug.a : LDFLAGS += $( DEBUG_LDFLAGS )
lib$(PROJECT)-debug.a : LDFLAGS += $( DEBUG_LDFLAGS ) $( STATIC_LDFLAGS )
lib$(PROJECT)-debug.a : BINFLAGS += $( DEBUG_BINFLAGS ) $( STATIC_BINFLAGS )
lib$(PROJECT)-debug.a : $( OBJ )
lib$(PROJECT)-debug.a : $( OBJ )
$( AR) rcs $@ $^
$( AR) rcs $@ $^
$( RANLIB) $@
$( RANLIB) $@
lib$(PROJECT)-release.so : CFLAGS += $( RELEASE_CFLAGS ) $( SHARED_FLAGS ) $( SHARED_RELEASE_FLAGS )
lib$(PROJECT)-release.so : CFLAGS += $( RELEASE_CFLAGS ) $( SHARED_FLAGS ) $( SHARED_RELEASE_FLAGS )
lib$(PROJECT)-release.so : CXXFLAGS += $( RELEASE_CXXFLAGS ) $( SHARED_FLAGS ) $( SHARED_RELEASE_FLAGS )
lib$(PROJECT)-release.so : CXXFLAGS += $( RELEASE_CXXFLAGS ) $( SHARED_FLAGS ) $( SHARED_RELEASE_FLAGS )
lib$(PROJECT)-release.so : LDFLAGS += $( RELEASE_LDFLAGS )
lib$(PROJECT)-release.so : LDFLAGS += $( RELEASE_LDFLAGS ) $( SHARED_LDFLAGS )
lib$(PROJECT)-release.so : BINFLAGS += $( RELEASE_BINFLAGS )
lib$(PROJECT)-release.so : BINFLAGS += $( RELEASE_BINFLAGS ) $( SHARED_BINFLAGS )
lib$(PROJECT)-release.so : $( OBJ )
lib$(PROJECT)-release.so : $( OBJ )
$( CXX) -shared $^ $( BINFLAGS) $( CXXFLAGS) -o $@ $( LDFLAGS)
$( CXX) -shared $^ $( BINFLAGS) $( CXXFLAGS) -o $@ $( LDFLAGS)
$( STRIP) $@
$( STRIP) $@
lib$(PROJECT)-debug.so : CFLAGS += $( DEBUG_CFLAGS ) $( SHARED_FLAGS ) $( SHARED_DEBUG_FLAGS )
lib$(PROJECT)-debug.so : CFLAGS += $( DEBUG_CFLAGS ) $( SHARED_FLAGS ) $( SHARED_DEBUG_FLAGS )
lib$(PROJECT)-debug.so : CXXFLAGS += $( DEBUG_CXXFLAGS ) $( SHARED_FLAGS ) $( SHARED_DEBUG_FLAGS )
lib$(PROJECT)-debug.so : CXXFLAGS += $( DEBUG_CXXFLAGS ) $( SHARED_FLAGS ) $( SHARED_DEBUG_FLAGS )
lib$(PROJECT)-debug.so : LDFLAGS += $( DEBUG_LDFLAGS )
lib$(PROJECT)-debug.so : LDFLAGS += $( DEBUG_LDFLAGS ) $( SHARED_LDFLAGS )
lib$(PROJECT)-debug.so : BINFLAGS += $( DEBUG_BINFLAGS )
lib$(PROJECT)-debug.so : BINFLAGS += $( DEBUG_BINFLAGS ) $( SHARED_BINFLAGS )
lib$(PROJECT)-debug.so : $( OBJ )
lib$(PROJECT)-debug.so : $( OBJ )
$( CXX) -shared $^ $( BINFLAGS) $( CXXFLAGS) -o $@ $( LDFLAGS)
$( CXX) -shared $^ $( BINFLAGS) $( CXXFLAGS) -o $@ $( LDFLAGS)
@ -363,5 +371,6 @@ 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 : SHARED_LDFLAGS +=-Wl , -soname , ./lib $( PROJECT ) -$( TARGET )
$(PROJECT)-test : lib $( PROJECT ) -$( TARGET )
$(PROJECT)-test : lib $( PROJECT ) -$( TARGET )
$( CC) $( CFLAGS) $( TEST_CFLAGS) src/test/*.c -o $@ -L. -l:$< $( LDFLAGS) $( TEST_LDFLAGS)
$( CC) $( CFLAGS) $( TEST_CFLAGS) src/test/*.c -o $@ -L./ -l:$< $( LDFLAGS) $( TEST_LDFLAGS)