Added "lean" target to cross compiles
parent
9696b9e5e7
commit
8f5ff96b0b
|
|
@ -90,6 +90,25 @@ ifeq ($(IS_ARM_EMBEDDED),1)
|
||||||
HAS_SOLIB_VERSION := 1
|
HAS_SOLIB_VERSION := 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Dead code stripping. Issue 'make lean'.
|
||||||
|
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
||||||
|
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
||||||
|
CXXFLAGS += -ffunction-sections
|
||||||
|
endif # CXXFLAGS
|
||||||
|
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
||||||
|
CXXFLAGS += -fdata-sections
|
||||||
|
endif # CXXFLAGS
|
||||||
|
ifeq ($(IS_IOS),1)
|
||||||
|
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
||||||
|
LDFLAGS += -Wl,-dead_strip
|
||||||
|
endif # CXXFLAGS
|
||||||
|
else # BSD, Linux and Unix
|
||||||
|
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
endif # LDFLAGS
|
||||||
|
endif # MAKECMDGOALS
|
||||||
|
endif # Dead code stripping
|
||||||
|
|
||||||
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
|
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
|
||||||
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
|
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
|
||||||
# is the second candidate for explicit initialization order.
|
# is the second candidate for explicit initialization order.
|
||||||
|
|
@ -133,6 +152,11 @@ endif
|
||||||
test: cryptest.exe
|
test: cryptest.exe
|
||||||
./cryptest.exe v
|
./cryptest.exe v
|
||||||
|
|
||||||
|
# CXXFLAGS are tuned earlier. Applications must use linker flags
|
||||||
|
# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
|
||||||
|
.PHONY: lean
|
||||||
|
lean: static dynamic cryptest.exe
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.dylib
|
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.dylib
|
||||||
|
|
@ -204,14 +228,14 @@ libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
|
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
|
||||||
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) -Wl,--exclude-libs,ALL $(LIBOBJS) $(LDLIBS)
|
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) -Wl,--exclude-libs,ALL $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
|
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
|
||||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libcryptopp.dylib: $(LIBOBJS)
|
libcryptopp.dylib: $(LIBOBJS)
|
||||||
$(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LIBOBJS)
|
$(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
|
||||||
|
|
||||||
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
||||||
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
|
||||||
|
|
@ -714,7 +714,7 @@ unset CXXFLAGS
|
||||||
"$MAKE" clean > /dev/null 2>&1
|
"$MAKE" clean > /dev/null 2>&1
|
||||||
export CXXFLAGS="-DDEBUG -g2 -O2 $ADD_CXXFLAGS"
|
export CXXFLAGS="-DDEBUG -g2 -O2 $ADD_CXXFLAGS"
|
||||||
|
|
||||||
"$MAKE" lean static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
|
"$MAKE" lean 2>&1 | tee -a "$TEST_RESULTS"
|
||||||
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
|
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
|
||||||
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
|
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
|
||||||
else
|
else
|
||||||
|
|
@ -739,7 +739,7 @@ unset CXXFLAGS
|
||||||
"$MAKE" clean > /dev/null 2>&1
|
"$MAKE" clean > /dev/null 2>&1
|
||||||
export CXXFLAGS="-DNDEBUG -g2 -O2 $ADD_CXXFLAGS"
|
export CXXFLAGS="-DNDEBUG -g2 -O2 $ADD_CXXFLAGS"
|
||||||
|
|
||||||
"$MAKE" lean static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
|
"$MAKE" lean 2>&1 | tee -a "$TEST_RESULTS"
|
||||||
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
|
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
|
||||||
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
|
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue