From 5367d26327973688659f4a5791cd41a2896352e6 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 31 Jul 2018 13:33:57 -0400 Subject: [PATCH] Fix compile when adhoc.cpp is missing --- GNUmakefile | 18 ++++++++++++------ GNUmakefile-cross | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 5f5ef5ab..7f5111a9 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -95,6 +95,12 @@ HAS_SOLIB_VERSION := $(IS_LINUX) # Newlib needs _XOPEN_SOURCE=600 for signals HAS_NEWLIB := $(shell $(CXX) $(CXXFLAGS) -DADHOC_MAIN -dM -E adhoc.cpp 2>&1 | $(GREP) -i -c "__NEWLIB__") +# Formely adhoc.cpp was created from adhoc.cpp.proto when needed. +# This is now needed because ISA tests are performed using adhoc.cpp. +ifeq ($(wildcard adhoc.cpp),) +$(shell cp adhoc.cpp.proto adhoc.cpp) +endif + ########################################################### ##### General Variables ##### ########################################################### @@ -751,15 +757,15 @@ DLLTESTOBJS := dlltest.dllonly.o .PHONY: default default: cryptest.exe -.PHONY: all +.PHONY: all static dynamic all: static dynamic cryptest.exe ifneq ($(IS_DARWIN),0) -static: adhoc.cpp libcryptopp.a -shared dynamic dylib: adhoc.cpp libcryptopp.dylib +static: libcryptopp.a +shared dynamic dylib: libcryptopp.dylib else -static: adhoc.cpp libcryptopp.a -shared dynamic: adhoc.cpp libcryptopp.so$(SOLIB_VERSION_SUFFIX) +static: libcryptopp.a +shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX) endif .PHONY: dep deps depend @@ -951,7 +957,7 @@ endif libcryptopp.dylib: $(LIBOBJS) $(CXX) -dynamiclib -o $@ $(strip $(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: adhoc.cpp libcryptopp.a $(TESTOBJS) +cryptest.exe:libcryptopp.a $(TESTOBJS) $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) # Makes it faster to test changes diff --git a/GNUmakefile-cross b/GNUmakefile-cross index c08414be..8dc2026c 100755 --- a/GNUmakefile-cross +++ b/GNUmakefile-cross @@ -52,6 +52,16 @@ endif # Android and embedded users typically don't run this configuration. HAS_SOLIB_VERSION ?= 0 +# Formely adhoc.cpp was created from adhoc.cpp.proto when needed. +# This is now needed because ISA tests are performed using adhoc.cpp. +ifeq ($(wildcard adhoc.cpp),) +$(shell cp adhoc.cpp.proto adhoc.cpp) +endif + +########################################################### +##### General Variables ##### +########################################################### + # Default prefix for make install ifeq ($(PREFIX),) PREFIX = /usr/local @@ -83,6 +93,10 @@ ifneq ($(CLANG_COMPILER),0) CXXFLAGS += -Wall endif +########################################################### +##### iOS ##### +########################################################### + # iOS cross-compile configuration. # See http://www.cryptopp.com/wiki/iOS_(Command_Line). ifeq ($(IS_IOS),1) @@ -96,6 +110,10 @@ ifeq ($(IS_IOS),1) RANLIB = ranlib endif +########################################################### +##### Android ##### +########################################################### + # Android cross-compile configuration. # See http://www.cryptopp.com/wiki/Android_(Command_Line). ifeq ($(IS_ANDROID),1) @@ -117,6 +135,10 @@ ifeq ($(IS_ANDROID),1) AOSP_CPU_OBJ = cpu-features.o endif +########################################################### +##### Embedded ##### +########################################################### + # ARM embedded cross-compile configuration. # See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) # and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal). @@ -125,6 +147,10 @@ ifeq ($(IS_ARM_EMBEDDED),1) CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT) endif +########################################################### +##### Common ##### +########################################################### + # No ASM for Travis testing ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm) ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) @@ -320,6 +346,10 @@ ifneq ($(IS_i686)$(IS_x86_64),00) endif endif +########################################################### +##### Source and object files ##### +########################################################### + # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp))) # For Makefile.am; resource.h is Windows @@ -362,11 +392,15 @@ SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR) SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX) endif # HAS_SOLIB_VERSION +########################################################### +##### Targets and Recipes ##### +########################################################### + # Default builds program with static library only .PHONY: default default: cryptest.exe -.PHONY: all +.PHONY: all static dynamic all: static dynamic cryptest.exe ifneq ($(IS_IOS),0)