From 117f9eddcd8dab5400dcb5454a7b4cd546cfe05a Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 8 Mar 2007 08:19:27 +0100 Subject: [PATCH] src/Makefile: use an explicit .depend file. --- .hgignore | 1 + src/Makefile | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.hgignore b/.hgignore index b1d1a5ca..b1d114a7 100644 --- a/.hgignore +++ b/.hgignore @@ -8,6 +8,7 @@ syntax: regexp syntax: glob +.depend Makevars.local *.a diff --git a/src/Makefile b/src/Makefile index a98d8453..84d214c2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,7 +27,6 @@ ifneq ($(findstring $(firstword $(CXX)),g++),) USE_GNUC ?= 1 endif ifeq ($(USE_GNUC),1) -CXXFLAGS += -MMD ifeq ($(DEBUG),1) CXXFLAGS += -O0 -g else @@ -59,17 +58,25 @@ INCLUDES += -I$(UPX_LZMADIR) endif -all: upx$(exeext) -.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS) +all: .depend upx$(exeext) +.DELETE_ON_ERROR: .depend upx$(exeext) $(upx_OBJECTS) upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES) $($(notdir $@).PRE_LINK_STEP) $(strip $(CXXLD) $(call e,CPPFLAGS) $(call e,CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS)) $($(notdir $@).POST_LINK_STEP) -%.o : %.cpp +%.o : %.cpp .depend $(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<) +.depend: $(wildcard $(srcdir)/*.cpp) $(wildcard $(srcdir)/*.h) $(MAKEFILE_LIST) + @rm -f $@ +ifeq ($(USE_GNUC),1) + $(strip $(CXX) $(call e,CPPFLAGS) -MM) $(filter %.cpp,$^) > $@ +else + touch $@ +endif + ifeq ($(USE_GNUC),1) ##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer @@ -82,7 +89,7 @@ endif mostlyclean clean distclean maintainer-clean: - rm -f *.d *.map *.o *.obj *.res upx.exe upx.out upx.ttp upx$(exeext) + rm -f *.d *.map *.o *.obj *.res .depend upx.exe upx.out upx.ttp upx$(exeext) --include *.d +include $(wildcard .depend) .PHONY: all mostlyclean clean distclean maintainer-clean