Added recipe to create dependencies. The dependencies are only generated if multiarch is not in effect. MULTIARCH_SUPPORT was also changed to an overrideable makefile variable

pull/35/head
Jeffrey Walton 2015-07-18 23:41:41 -04:00
parent bf9df8f970
commit 8c259ee6b4
1 changed files with 16 additions and 6 deletions

View File

@ -74,7 +74,7 @@ endif # Cygwin work arounds
# We can do integer math using the Posix shell in a GNUmakefile # We can do integer math using the Posix shell in a GNUmakefile
# Below, we are building a boolean circuit that says "Darwin && (GCC 4.2 || Clang)" # Below, we are building a boolean circuit that says "Darwin && (GCC 4.2 || Clang)"
MULTIARCH_SUPPORT = $(shell echo $$(($(IS_DARWIN) * ($(GCC42_OR_LATER) + $(CLANG_COMPILER))))) MULTIARCH_SUPPORT ?= $(shell echo $$(($(IS_DARWIN) * ($(GCC42_OR_LATER) + $(CLANG_COMPILER)))))
ifneq ($(MULTIARCH_SUPPORT),0) ifneq ($(MULTIARCH_SUPPORT),0)
CXXFLAGS += -arch x86_64 -arch i386 CXXFLAGS += -arch x86_64 -arch i386
else else
@ -160,11 +160,8 @@ endif
endif endif
SRCS = $(wildcard *.cpp) SRCS = $(wildcard *.cpp)
ifeq ($(SRCS),) # workaround wildcard function bug in GNU Make 3.77
SRCS = $(shell echo *.cpp)
endif
OBJS = $(SRCS:.cpp=.o) OBJS = $(SRCS:.cpp=.o)
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?) # test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS)) LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
@ -186,7 +183,7 @@ test: cryptest.exe
.PHONY: clean .PHONY: clean
clean: clean:
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS) -$(RM) cryptest.exe libcryptopp.a libcryptopp.so GNUmakefile.deps $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS)
-$(RM) -r cryptest.exe.dSYM -$(RM) -r cryptest.exe.dSYM
.PHONY: install .PHONY: install
@ -250,3 +247,16 @@ endif
%.o : %.cpp %.o : %.cpp
$(CXX) $(CXXFLAGS) -c $< $(CXX) $(CXXFLAGS) -c $<
# Do not build dependencies when multiarch is in effect
ifeq ($(MULTIARCH_SUPPORT),0)
# Do not build dependencies when cleaning
ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
-include GNUmakefile.deps
endif
GNUmakefile.deps:
$(CXX) $(CXXFLAGS) -MM *.cpp > GNUmakefile.deps
endif