From 87844254d12360c0cf28fbfeb578b220aa64fd5c Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 31 Jan 2007 05:53:38 +0100 Subject: [PATCH] Minor Makefile updates. --- .hgignore | 3 +++ Makefile | 10 +++++----- src/Makefile | 14 ++++++++++---- src/stub/Makefile | 17 +++++++++-------- src/stub/src/arch/amd64/Makefile.extra | 1 + src/stub/src/arch/arm/v4a/Makefile.extra | 1 + src/stub/src/arch/arm/v4t/Makefile.extra | 1 + src/stub/src/arch/i086/Makefile.extra | 1 + src/stub/src/arch/i386/Makefile.extra | 1 + src/stub/src/arch/m68k/m68000/Makefile.extra | 1 + src/stub/src/arch/m68k/m68020/Makefile.extra | 1 + .../src/arch/mips/mipsel.r3000/Makefile.extra | 11 ++++++++--- src/stub/src/arch/powerpc/32/Makefile.extra | 1 + 13 files changed, 43 insertions(+), 20 deletions(-) diff --git a/.hgignore b/.hgignore index ccc62639..b1d1a5ca 100644 --- a/.hgignore +++ b/.hgignore @@ -2,11 +2,14 @@ syntax: regexp ^\.bzr ^ChangeLog +^Makevars.global ^build ^maint syntax: glob +Makevars.local + *.a *.dll *.lib diff --git a/Makefile b/Makefile index 76fa0f47..9ad68ed0 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ export SHELL = /bin/sh srcdir = . top_srcdir = . +-include $(top_srcdir)/Makevars.global ./Makevars.local # info: src/stub needs GNU make 3.81 and special build tools @@ -33,15 +34,14 @@ endif $(MAKE) -C src $@ $(MAKE) -C doc $@ -# automatically generate ChangeLog from Mercurial repo -ChangeLog: + ifneq ($(wildcard .hg/data/.),) +# automatically generate ChangeLog from local Mercurial repo +ChangeLog: hg log --style=changelog > $@ -else - @echo "UPX info: no hg repo found" +.PHONY: ChangeLog endif .PHONY: default all mostlyclean clean distclean maintainer-clean -.PHONY: ChangeLog diff --git a/src/Makefile b/src/Makefile index 7a48ad1f..a98d8453 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,9 +7,15 @@ MAKEFLAGS += -rR export SHELL = /bin/sh override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1) -srcdir ?= $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) -ifneq ($(srcdir),./) +ifndef srcdir +srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,') +endif +ifndef top_srcdir +top_srcdir := $(srcdir)/.. +endif +-include $(top_srcdir)/Makevars.global ./Makevars.local +ifneq ($(srcdir),.) ##$(info Info: using VPATH . $(srcdir)) VPATH := . $(srcdir) endif @@ -17,7 +23,7 @@ endif ifeq ($(CXX),) CXX = g++ endif -ifeq ($(firstword $(CXX)),g++) +ifneq ($(findstring $(firstword $(CXX)),g++),) USE_GNUC ?= 1 endif ifeq ($(USE_GNUC),1) @@ -48,7 +54,7 @@ endif LIBS += -lucl -lz # you should set envvar UPX_LZMADIR to point to your unpacked lzma443.tar.bz2 ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) -DEFS += -DWITH_LZMA +DEFS += -DWITH_LZMA=1 INCLUDES += -I$(UPX_LZMADIR) endif diff --git a/src/stub/Makefile b/src/stub/Makefile index eda29db4..52788c60 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -22,6 +22,15 @@ ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.79 3.79.1 3.80),) $(error GNU make 3.81 or better is required) endif +ifndef srcdir +srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,') +endif +ifndef top_srcdir +top_srcdir := $(srcdir)/../.. +endif +-include $(top_srcdir)/Makevars.global ./Makevars.local + # update $PATH for our special stub build tools ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),) export PATH := $(HOME)/local/bin/bin-upx:$(PATH) @@ -35,14 +44,6 @@ endif # // # ************************************************************************/ -ifndef srcdir -srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) -srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,') -endif -ifndef top_srcdir -top_srcdir := $(srcdir)/../.. -endif - ifndef STUBS STUBS += amd64-linux.elf-entry.h STUBS += amd64-linux.elf-fold.h diff --git a/src/stub/src/arch/amd64/Makefile.extra b/src/stub/src/arch/amd64/Makefile.extra index b03f4258..c3f0a321 100644 --- a/src/stub/src/arch/amd64/Makefile.extra +++ b/src/stub/src/arch/amd64/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/arm/v4a/Makefile.extra b/src/stub/src/arch/arm/v4a/Makefile.extra index bceab6ff..b28507b5 100644 --- a/src/stub/src/arch/arm/v4a/Makefile.extra +++ b/src/stub/src/arch/arm/v4a/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/arm/v4t/Makefile.extra b/src/stub/src/arch/arm/v4t/Makefile.extra index 9c09dbaa..a8ea9e74 100644 --- a/src/stub/src/arch/arm/v4t/Makefile.extra +++ b/src/stub/src/arch/arm/v4t/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 658b37f9..125df2e5 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -20,6 +20,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6 diff --git a/src/stub/src/arch/i386/Makefile.extra b/src/stub/src/arch/i386/Makefile.extra index 5784e9f4..15fbb7f4 100644 --- a/src/stub/src/arch/i386/Makefile.extra +++ b/src/stub/src/arch/i386/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/m68k/m68000/Makefile.extra b/src/stub/src/arch/m68k/m68000/Makefile.extra index 919645d8..b05de8cb 100644 --- a/src/stub/src/arch/m68k/m68000/Makefile.extra +++ b/src/stub/src/arch/m68k/m68000/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/m68k/m68020/Makefile.extra b/src/stub/src/arch/m68k/m68020/Makefile.extra index eef0fb3c..25586802 100644 --- a/src/stub/src/arch/m68k/m68020/Makefile.extra +++ b/src/stub/src/arch/m68k/m68020/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = diff --git a/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra b/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra index bd438c49..e5498599 100644 --- a/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra +++ b/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS = @@ -55,7 +56,7 @@ $c += -fmodulo-sched $c += -floop-optimize2 $c += -ffixed-30 else ifneq ($(findstring -gcc-4.2.0,$(firstword $($c))),) -# gcc-4.2.0-20060826 snapshot +# gcc-4.2.0-20060826.tar.bz2 snapshot $c += -fno-wrapv $c += -mtune=r4000 $c += -fno-regmove @@ -68,7 +69,9 @@ $c += -ffixed-30 else $(error unknown gcc version: $(firstword $($c))) endif +ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) $c += -I$(UPX_LZMADIR) +endif $c += -I$(top_srcdir)/src lzma_d_c%.S : lzma_d_c.c @@ -84,7 +87,7 @@ lzma_d_cs.% : PP_FLAGS = -DSMALL # /*********************************************************************** -# // test-stub-compression (needs UPX_UCLPACK) +# // test-stub-compression (needs UPX_UCL_UCLPACK) # ************************************************************************/ define __test_stub_compression @@ -93,11 +96,13 @@ define __test_stub_compression @rm -f $1.tmp.* @bzip2 -9 < $1 > $1.tmp.bz2 @gzip -9mn < $1 > $1.tmp.gz - $(if $(UPX_UCLPACK),@$(UPX_UCLPACK) --nrv2b --10 $1 $1.tmp.uclpack-nrv2b | egrep ' into ') + $(if $(UPX_UCL_UCLPACK),@$(UPX_UCL_UCLPACK) --nrv2b --10 $1 $1.tmp.uclpack-nrv2b | egrep ' into ') @ls -l $1.tmp.* endef +ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) test-stub-compression: tc_list = mipsel.r3000-ps1 default test-stub-compression: lzma_d_cf.S lzma_d_cs.S $(call __test_stub_compression,tmp/lzma_d_cs.out,tmp/lzma_d_cs.o) .PHONY: test-stub-compression +endif diff --git a/src/stub/src/arch/powerpc/32/Makefile.extra b/src/stub/src/arch/powerpc/32/Makefile.extra index cc0efda8..09f2d9c3 100644 --- a/src/stub/src/arch/powerpc/32/Makefile.extra +++ b/src/stub/src/arch/powerpc/32/Makefile.extra @@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../.. __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) endif +-include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c STUBS =