Minor Makefile updates.

This commit is contained in:
Markus F.X.J. Oberhumer 2007-01-31 05:53:38 +01:00
parent 08ef9f69fb
commit 87844254d1
13 changed files with 43 additions and 20 deletions

View File

@ -2,11 +2,14 @@ syntax: regexp
^\.bzr ^\.bzr
^ChangeLog ^ChangeLog
^Makevars.global
^build ^build
^maint ^maint
syntax: glob syntax: glob
Makevars.local
*.a *.a
*.dll *.dll
*.lib *.lib

View File

@ -8,6 +8,7 @@ export SHELL = /bin/sh
srcdir = . srcdir = .
top_srcdir = . top_srcdir = .
-include $(top_srcdir)/Makevars.global ./Makevars.local
# info: src/stub needs GNU make 3.81 and special build tools # info: src/stub needs GNU make 3.81 and special build tools
@ -33,15 +34,14 @@ endif
$(MAKE) -C src $@ $(MAKE) -C src $@
$(MAKE) -C doc $@ $(MAKE) -C doc $@
# automatically generate ChangeLog from Mercurial repo
ChangeLog:
ifneq ($(wildcard .hg/data/.),) ifneq ($(wildcard .hg/data/.),)
# automatically generate ChangeLog from local Mercurial repo
ChangeLog:
hg log --style=changelog > $@ hg log --style=changelog > $@
else .PHONY: ChangeLog
@echo "UPX info: no hg repo found"
endif endif
.PHONY: default all mostlyclean clean distclean maintainer-clean .PHONY: default all mostlyclean clean distclean maintainer-clean
.PHONY: ChangeLog

View File

@ -7,9 +7,15 @@ MAKEFLAGS += -rR
export SHELL = /bin/sh export SHELL = /bin/sh
override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1) override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1)
srcdir ?= $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) ifndef srcdir
ifneq ($(srcdir),./) srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,') 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)) ##$(info Info: using VPATH . $(srcdir))
VPATH := . $(srcdir) VPATH := . $(srcdir)
endif endif
@ -17,7 +23,7 @@ endif
ifeq ($(CXX),) ifeq ($(CXX),)
CXX = g++ CXX = g++
endif endif
ifeq ($(firstword $(CXX)),g++) ifneq ($(findstring $(firstword $(CXX)),g++),)
USE_GNUC ?= 1 USE_GNUC ?= 1
endif endif
ifeq ($(USE_GNUC),1) ifeq ($(USE_GNUC),1)
@ -48,7 +54,7 @@ endif
LIBS += -lucl -lz LIBS += -lucl -lz
# you should set envvar UPX_LZMADIR to point to your unpacked lzma443.tar.bz2 # you should set envvar UPX_LZMADIR to point to your unpacked lzma443.tar.bz2
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
DEFS += -DWITH_LZMA DEFS += -DWITH_LZMA=1
INCLUDES += -I$(UPX_LZMADIR) INCLUDES += -I$(UPX_LZMADIR)
endif endif

View File

@ -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) $(error GNU make 3.81 or better is required)
endif 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 # update $PATH for our special stub build tools
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),) ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),)
export PATH := $(HOME)/local/bin/bin-upx:$(PATH) 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 ifndef STUBS
STUBS += amd64-linux.elf-entry.h STUBS += amd64-linux.elf-entry.h
STUBS += amd64-linux.elf-fold.h STUBS += amd64-linux.elf-fold.h

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -20,6 +20,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6 export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =
@ -55,7 +56,7 @@ $c += -fmodulo-sched
$c += -floop-optimize2 $c += -floop-optimize2
$c += -ffixed-30 $c += -ffixed-30
else ifneq ($(findstring -gcc-4.2.0,$(firstword $($c))),) 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 += -fno-wrapv
$c += -mtune=r4000 $c += -mtune=r4000
$c += -fno-regmove $c += -fno-regmove
@ -68,7 +69,9 @@ $c += -ffixed-30
else else
$(error unknown gcc version: $(firstword $($c))) $(error unknown gcc version: $(firstword $($c)))
endif endif
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
$c += -I$(UPX_LZMADIR) $c += -I$(UPX_LZMADIR)
endif
$c += -I$(top_srcdir)/src $c += -I$(top_srcdir)/src
lzma_d_c%.S : lzma_d_c.c 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 define __test_stub_compression
@ -93,11 +96,13 @@ define __test_stub_compression
@rm -f $1.tmp.* @rm -f $1.tmp.*
@bzip2 -9 < $1 > $1.tmp.bz2 @bzip2 -9 < $1 > $1.tmp.bz2
@gzip -9mn < $1 > $1.tmp.gz @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.* @ls -l $1.tmp.*
endef endef
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
test-stub-compression: tc_list = mipsel.r3000-ps1 default test-stub-compression: tc_list = mipsel.r3000-ps1 default
test-stub-compression: lzma_d_cf.S lzma_d_cs.S 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) $(call __test_stub_compression,tmp/lzma_d_cs.out,tmp/lzma_d_cs.o)
.PHONY: test-stub-compression .PHONY: test-stub-compression
endif

View File

@ -8,6 +8,7 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3) __dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND) top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
vpath %.c $(top_srcdir)/src/stub/src/c vpath %.c $(top_srcdir)/src/stub/src/c
STUBS = STUBS =