From edce076e6888f39a532836295e3b6f9f5e91d605 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 26 Feb 2007 01:33:08 +0100 Subject: [PATCH] Minor Makefile updates. --- src/stub/Makefile | 4 +++- src/stub/src/arch/i086/Makefile.extra | 18 ++++++++++++------ src/stub/src/arch/i086/wdis2gas.py | 4 ++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/stub/Makefile b/src/stub/Makefile index 623a1225..1668bf23 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -104,14 +104,16 @@ default: $$(default.targets) endif endif + all.targets ?= .upx-stubtools-stamp tmp/.tmp-stamp .all-stamp all: $$(all.targets) .upx-stubtools-stamp: $(MAKEFILE_LIST) upx-stubtools-check-version 20060823 @echo "timestamp" > $@ -tmp/.tmp-stamp: +%/.tmp-stamp: @mkdir -p $(dir $@) @echo "timestamp" > $@ +.PRECIOUS: %/.tmp-stamp .all-stamp: $$(STUBS) @echo "timestamp" > $@ diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 4374f6bf..b53b3a55 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -32,14 +32,21 @@ include $(top_srcdir)/src/stub/Makefile # // # ************************************************************************/ +# enumerate the names of all environment variables +# FIXME: "origin" does not work for things like "export LC_ALL=C" +##__minienv_varlist = $(foreach v,$1,$(if $(findstring environment,$(origin $v)),$v)) +__minienv_varlist = $(foreach v,$1,$(if $($v),$v)) +# enumerate the names of all environment variables +__minienv_expand = $(foreach v,$(call __minienv_varlist,$1),$v='$($v)') + DOSBOX = true DOSBOX = dosbox DOSBOX = /usr/bin/time -p dosbox -exit ifneq ($(wildcard /usr/bin/wine),) WINEENV = @env -WINEENV = @env -i DISPLAY='$(DISPLAY)' HOME='$(HOME)' PATH='$(PATH)' USER='$(USER)' -winedir_s = $(shell winepath -s z:$(realpath $1)) +WINEENV = @env -i $(call __minienv_expand,DISPLAY HOME PATH USER TERM) +winedir_s = z:$(shell winepath -s $(realpath $1)) winedir_w = $(shell winepath -w $(realpath $1)) else WINEENV = false 'WINEENV' @@ -146,8 +153,7 @@ lzma_d_c%.S : lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST) ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) ifneq ($(wildcard $(WATCOM)/binl/wcl),) -lzma_d_c%.i : tmp/lzma_d_c%.i - cp $< $@ +lzma_d_c%.i : tmp/lzma_d_c%.i ; cp $< $@ tmp/lzma_d_c%.i : lzma_d_c.c wdis2gas.py $(MAKEFILE_LIST) $(TMP_DEPS) rm -f tmp/$T*.i tmp/$T*.o tmp/$T*.obj tmp/$T*.S @@ -174,8 +180,8 @@ endif $(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;' > $@ -.PRECIOUS: lzma_d_cf.i lzma_d_cs.i -.PRECIOUS: tmp/lzma_d_cf.i tmp/lzma_d_cs.i +.PRECIOUS: lzma_d_c%.i +.PRECIOUS: tmp/lzma_d_c%.i endif endif diff --git a/src/stub/src/arch/i086/wdis2gas.py b/src/stub/src/arch/i086/wdis2gas.py index 96292583..4b091e39 100644 --- a/src/stub/src/arch/i086/wdis2gas.py +++ b/src/stub/src/arch/i086/wdis2gas.py @@ -76,14 +76,14 @@ def main(argv): if m: continue m = re.search(r"^(BSS|Routine) Size:", l) if m: continue - m = re.search(r"Segment:\s+(.+)\s+([0-9a-fA-F]+)\s+bytes$", l) + m = re.search(r"^Segment:\s+(.+)\s+([0-9a-fA-F]+)\s+bytes$", l) if m: s = re.split(r"\s+", m.group(1)) assert len(s) == 3, (i, l, s, m.groups()) section = s func = None continue - m = re.search(r"Comdat:\s+(.+)\s+SEGMENT NONE '(\w+)'\s+([0-9a-fA-F]+)\s+bytes$", l) + m = re.search(r"^Comdat:\s+(.+)\s+SEGMENT NONE '(\w+)'\s+([0-9a-fA-F]+)\s+bytes$", l) if m: section = [m.group(2)] assert section[0].endswith("_TEXT"), (i, l, section)