Fix compile when adhoc.cpp is missing

pull/696/head
Jeffrey Walton 2018-07-31 13:33:57 -04:00
parent 7ff5f0dcf1
commit 5367d26327
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 47 additions and 7 deletions

View File

@ -95,6 +95,12 @@ HAS_SOLIB_VERSION := $(IS_LINUX)
# Newlib needs _XOPEN_SOURCE=600 for signals # Newlib needs _XOPEN_SOURCE=600 for signals
HAS_NEWLIB := $(shell $(CXX) $(CXXFLAGS) -DADHOC_MAIN -dM -E adhoc.cpp 2>&1 | $(GREP) -i -c "__NEWLIB__") 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 ##### ##### General Variables #####
########################################################### ###########################################################
@ -751,15 +757,15 @@ DLLTESTOBJS := dlltest.dllonly.o
.PHONY: default .PHONY: default
default: cryptest.exe default: cryptest.exe
.PHONY: all .PHONY: all static dynamic
all: static dynamic cryptest.exe all: static dynamic cryptest.exe
ifneq ($(IS_DARWIN),0) ifneq ($(IS_DARWIN),0)
static: adhoc.cpp libcryptopp.a static: libcryptopp.a
shared dynamic dylib: adhoc.cpp libcryptopp.dylib shared dynamic dylib: libcryptopp.dylib
else else
static: adhoc.cpp libcryptopp.a static: libcryptopp.a
shared dynamic: adhoc.cpp libcryptopp.so$(SOLIB_VERSION_SUFFIX) shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
endif endif
.PHONY: dep deps depend .PHONY: dep deps depend
@ -951,7 +957,7 @@ endif
libcryptopp.dylib: $(LIBOBJS) 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) $(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) $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
# Makes it faster to test changes # Makes it faster to test changes

View File

@ -52,6 +52,16 @@ endif
# Android and embedded users typically don't run this configuration. # Android and embedded users typically don't run this configuration.
HAS_SOLIB_VERSION ?= 0 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 # Default prefix for make install
ifeq ($(PREFIX),) ifeq ($(PREFIX),)
PREFIX = /usr/local PREFIX = /usr/local
@ -83,6 +93,10 @@ ifneq ($(CLANG_COMPILER),0)
CXXFLAGS += -Wall CXXFLAGS += -Wall
endif endif
###########################################################
##### iOS #####
###########################################################
# iOS cross-compile configuration. # iOS cross-compile configuration.
# See http://www.cryptopp.com/wiki/iOS_(Command_Line). # See http://www.cryptopp.com/wiki/iOS_(Command_Line).
ifeq ($(IS_IOS),1) ifeq ($(IS_IOS),1)
@ -96,6 +110,10 @@ ifeq ($(IS_IOS),1)
RANLIB = ranlib RANLIB = ranlib
endif endif
###########################################################
##### Android #####
###########################################################
# Android cross-compile configuration. # Android cross-compile configuration.
# See http://www.cryptopp.com/wiki/Android_(Command_Line). # See http://www.cryptopp.com/wiki/Android_(Command_Line).
ifeq ($(IS_ANDROID),1) ifeq ($(IS_ANDROID),1)
@ -117,6 +135,10 @@ ifeq ($(IS_ANDROID),1)
AOSP_CPU_OBJ = cpu-features.o AOSP_CPU_OBJ = cpu-features.o
endif endif
###########################################################
##### Embedded #####
###########################################################
# ARM embedded cross-compile configuration. # ARM embedded cross-compile configuration.
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) # See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal). # 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) CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
endif endif
###########################################################
##### Common #####
###########################################################
# No ASM for Travis testing # No ASM for Travis testing
ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm) ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm)
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
@ -320,6 +346,10 @@ ifneq ($(IS_i686)$(IS_x86_64),00)
endif endif
endif endif
###########################################################
##### Source and object files #####
###########################################################
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. # 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))) 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 # 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) SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
endif # HAS_SOLIB_VERSION endif # HAS_SOLIB_VERSION
###########################################################
##### Targets and Recipes #####
###########################################################
# Default builds program with static library only # Default builds program with static library only
.PHONY: default .PHONY: default
default: cryptest.exe default: cryptest.exe
.PHONY: all .PHONY: all static dynamic
all: static dynamic cryptest.exe all: static dynamic cryptest.exe
ifneq ($(IS_IOS),0) ifneq ($(IS_IOS),0)