mirror of
https://github.com/upx/upx.git
synced 2024-12-02 17:56:38 +00:00
Small Makefile updates.
This commit is contained in:
parent
c59c69a85f
commit
12bcb09051
@ -134,15 +134,6 @@ maintainer-clean:
|
|||||||
# util var for use in the rules - basename of the current target
|
# util var for use in the rules - basename of the current target
|
||||||
override T = $(basename $(notdir $@))
|
override T = $(basename $(notdir $@))
|
||||||
|
|
||||||
# trim (strip) trailing whitespace
|
|
||||||
RTRIM := sed -e 's/[ $(tab)]*$$//'
|
|
||||||
# squeeze duplicate blank lines, delete empty first & last line
|
|
||||||
BLSQUEEZE := $(RTRIM) | cat --squeeze-blank | sed -e '1{/^$$/d}' -e '$${/^$$/d}'
|
|
||||||
# delete blank lines
|
|
||||||
BLDEL := $(RTRIM) | sed -e '/^$$/d'
|
|
||||||
#
|
|
||||||
UNIX2DOS := perl -i -pe 's/$$/\r/;'
|
|
||||||
|
|
||||||
# clear some vars, just in case
|
# clear some vars, just in case
|
||||||
LABEL_PREFIX =
|
LABEL_PREFIX =
|
||||||
PP_FLAGS =
|
PP_FLAGS =
|
||||||
@ -151,6 +142,21 @@ tc_bfdname =
|
|||||||
tc_list =
|
tc_list =
|
||||||
tc_objdump_disasm_options =
|
tc_objdump_disasm_options =
|
||||||
|
|
||||||
|
# commands
|
||||||
|
PYTHON = python
|
||||||
|
UNIX2DOS := perl -i -pe 's/$$/\r/;'
|
||||||
|
|
||||||
|
# trim (strip) trailing whitespace
|
||||||
|
RTRIM := sed -e 's/[ $(tab)]*$$//'
|
||||||
|
# squeeze duplicate blank lines, delete empty first & last line
|
||||||
|
BLSQUEEZE := $(RTRIM) | cat --squeeze-blank | sed -e '1{/^$$/d}' -e '$${/^$$/d}'
|
||||||
|
# delete blank lines
|
||||||
|
BLDEL := $(RTRIM) | sed -e '/^$$/d'
|
||||||
|
# delete blank lines at top (beginning) of file
|
||||||
|
BLDELTOP := sed -e '/./,$$!d'
|
||||||
|
# delete blank lines at bottom (end) of file
|
||||||
|
BLDELBOT := sed -e ':a' -e '/^\n*$$/{$$d;N;ba' -e '}'
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# // setup toolchain globals
|
# // setup toolchain globals
|
||||||
@ -170,15 +176,15 @@ define tc
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
# default tools
|
# default tools
|
||||||
tc.default.bin2h = python $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub
|
tc.default.bin2h = $(PYTHON) $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub
|
||||||
##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0
|
##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0
|
||||||
tc.default.bin2h-c = $(call tc,bin2h) --compress=0
|
tc.default.bin2h-c = $(call tc,bin2h) --compress=0
|
||||||
tc.default.brandelf = python $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
|
tc.default.brandelf = $(PYTHON) $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
|
||||||
tc.default.gpp_inc = python $(top_srcdir)/src/stub/scripts/gpp_inc.py
|
tc.default.gpp_inc = $(PYTHON) $(top_srcdir)/src/stub/scripts/gpp_inc.py
|
||||||
tc.default.gpp_mkdep = python $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null
|
tc.default.gpp_mkdep = $(PYTHON) $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null
|
||||||
tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall
|
tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall
|
||||||
tc.default.sstrip = sstrip
|
tc.default.sstrip = sstrip
|
||||||
tc.default.xstrip = python $(top_srcdir)/src/stub/scripts/xstrip.py
|
tc.default.xstrip = $(PYTHON) $(top_srcdir)/src/stub/scripts/xstrip.py
|
||||||
|
|
||||||
# default multiarch-binutils
|
# default multiarch-binutils
|
||||||
tc.default.m-ar = multiarch-ar-2.17
|
tc.default.m-ar = multiarch-ar-2.17
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#
|
#
|
||||||
# highly experimental support for i086 using Digital Mars C/C++
|
# highly experimental support for i086 using Open Watcom C/C++
|
||||||
#
|
#
|
||||||
# $(DM849DIR)
|
##export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6
|
||||||
# $(WATCOM)
|
|
||||||
# /usr/bin/wine
|
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
@ -19,8 +17,6 @@ endif
|
|||||||
-include $(top_srcdir)/Makevars.global ./Makevars.local
|
-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
|
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
|
|
||||||
@ -40,11 +36,16 @@ DOSBOX = true
|
|||||||
DOSBOX = dosbox
|
DOSBOX = dosbox
|
||||||
DOSBOX = /usr/bin/time -p dosbox -exit
|
DOSBOX = /usr/bin/time -p dosbox -exit
|
||||||
|
|
||||||
WINEENV = env
|
ifneq ($(wildcard /usr/bin/wine),)
|
||||||
WINEENV = env -i DISPLAY='$(DISPLAY)' HOME='$(HOME)' PATH='$(PATH)' USER='$(USER)'
|
WINEENV = @env
|
||||||
|
WINEENV = @env -i DISPLAY='$(DISPLAY)' HOME='$(HOME)' PATH='$(PATH)' USER='$(USER)'
|
||||||
winedir_s = $(shell winepath -s z:$(realpath $1))
|
winedir_s = $(shell winepath -s z:$(realpath $1))
|
||||||
winedir_w = $(shell winepath -w $(realpath $1))
|
winedir_w = $(shell winepath -w $(realpath $1))
|
||||||
|
else
|
||||||
|
WINEENV = false 'WINEENV'
|
||||||
|
winedir_s = $1
|
||||||
|
winedir_w = $1
|
||||||
|
endif
|
||||||
|
|
||||||
# work around limitations of wine's cmd.exe
|
# work around limitations of wine's cmd.exe
|
||||||
define mkbat
|
define mkbat
|
||||||
@ -88,7 +89,7 @@ $c += -I$(top_srcdir)/src
|
|||||||
# Borland C/C++ 5.02
|
# Borland C/C++ 5.02
|
||||||
ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),)
|
ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),)
|
||||||
c := tc.method-lzma.bcc
|
c := tc.method-lzma.bcc
|
||||||
$c = @$(WINEENV) wine cmd.exe /c tmp/bcc.bat
|
$c = $(WINEENV) wine cmd.exe /c tmp/bcc.bat
|
||||||
$c += -ms
|
$c += -ms
|
||||||
$c += -O1 -1
|
$c += -O1 -1
|
||||||
$c += -w
|
$c += -w
|
||||||
@ -101,7 +102,7 @@ endif
|
|||||||
# http://www.digitalmars.com/download/freecompiler.html
|
# http://www.digitalmars.com/download/freecompiler.html
|
||||||
ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),)
|
ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),)
|
||||||
c := tc.method-lzma.dmc
|
c := tc.method-lzma.dmc
|
||||||
$c = @$(WINEENV) CFLAGS='$(DMC)' wine cmd.exe /c tmp/dmc.bat
|
$c = $(WINEENV) CFLAGS='$(DMC)' wine cmd.exe /c tmp/dmc.bat
|
||||||
$c += -ms -R
|
$c += -ms -R
|
||||||
$c += -NS
|
$c += -NS
|
||||||
$c += -w- -w7 -r
|
$c += -w- -w7 -r
|
||||||
@ -114,7 +115,7 @@ endif
|
|||||||
# Visual C/C++ 1.52 (8.00c)
|
# Visual C/C++ 1.52 (8.00c)
|
||||||
ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),)
|
ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),)
|
||||||
c := tc.method-lzma.cl
|
c := tc.method-lzma.cl
|
||||||
$c = @$(WINEENV) CL='$(CL)' wine cmd.exe /c tmp/cl.bat
|
$c = $(WINEENV) CL='$(CL)' wine cmd.exe /c tmp/cl.bat
|
||||||
$c += -AS -Gd
|
$c += -AS -Gd
|
||||||
$c += -Gy
|
$c += -Gy
|
||||||
$c += -O2 -Gf -Gs -G0
|
$c += -O2 -Gf -Gs -G0
|
||||||
@ -140,12 +141,10 @@ $c += -I$(top_srcdir)/src
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST)
|
lzma_d_c%.S : lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST)
|
||||||
python cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@
|
$(PYTHON) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@
|
||||||
|
|
||||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
||||||
##ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),)
|
|
||||||
ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
||||||
ifneq ($(wildcard /usr/bin/wine),)
|
|
||||||
|
|
||||||
lzma_d_c%.i : tmp/lzma_d_c%.i
|
lzma_d_c%.i : tmp/lzma_d_c%.i
|
||||||
cp $< $@
|
cp $< $@
|
||||||
@ -170,7 +169,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
|||||||
$(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm
|
$(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm
|
||||||
endif
|
endif
|
||||||
# convert
|
# convert
|
||||||
python wdis2gas.py tmp/$T_wc.obj.disasm tmp/$T.S
|
$(PYTHON) wdis2gas.py tmp/$T_wc.obj.disasm tmp/$T.S
|
||||||
$(call tc,gcc) -c -o tmp/$T.o tmp/$T.S
|
$(call tc,gcc) -c -o tmp/$T.o tmp/$T.S
|
||||||
$(call tc,f-objstrip,tmp/$T.o)
|
$(call tc,f-objstrip,tmp/$T.o)
|
||||||
$(call tc,objdump) -b elf32-i386 -m i8086 -M intel -dr -j .text.LzmaDecode --no-show -w tmp/$T.o | $(RTRIM) | perl -pe 's/DWORD/dword/g; s/WORD/word/g; s/BYTE/byte/g; s/PTR/ptr/g;' > $@
|
$(call tc,objdump) -b elf32-i386 -m i8086 -M intel -dr -j .text.LzmaDecode --no-show -w tmp/$T.o | $(RTRIM) | perl -pe 's/DWORD/dword/g; s/WORD/word/g; s/BYTE/byte/g; s/PTR/ptr/g;' > $@
|
||||||
@ -180,8 +179,6 @@ endif
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
##endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||||
|
Loading…
Reference in New Issue
Block a user