From 77064fb09e11e780bd08a2b05ec7e1fffdf67aa9 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 2 Jan 2008 09:32:32 +0100 Subject: [PATCH] Makefile update. --- README.SRC | 5 +- src/stub/src/arch/i086/Makefile.extra | 79 +++++++++++++-------------- 2 files changed, 39 insertions(+), 45 deletions(-) diff --git a/README.SRC b/README.SRC index cc42e6f5..792c3d7a 100644 --- a/README.SRC +++ b/README.SRC @@ -69,7 +69,7 @@ Tools needed to build/modify the UPX sources - A C++ compiler supporting inner classes, templates, exceptions and RTTI. - - GNU make 3.80 or better (GNU make 3.81 recommened). + - GNU make 3.81 or better To compile the packer sources @@ -94,9 +94,6 @@ To compile the packer sources If you want to modify the stub sources you'll also need ------------------------------------------------------- - - GNU make 3.81 or better - http://savannah.gnu.org/projects/make/ - - Perl & Python - A number of cross-assemblers and cross-compilers - precompiled diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 5bfb2fef..742881c4 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -38,34 +38,31 @@ __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)') +ifndef DOSBOX_EXE +DOSBOX_EXE := $(shell which dosbox 2>/dev/null) +endif +ifdef DOSBOX_EXE ifndef DOSBOX -DOSBOX := $(shell which dosbox 2>/dev/null) -endif -ifdef DOSBOX -ifndef RUN_DOSBOX -RUN_DOSBOX = $(DOSBOX) -RUN_DOSBOX = /usr/bin/time -p $(DOSBOX) -exit +DOSBOX = $(DOSBOX_EXE) +DOSBOX = /usr/bin/time -p $(DOSBOX_EXE) -exit endif endif -ifndef WINE -WINE := $(shell which wine 2>/dev/null) +ifndef WINE_EXE +WINE_EXE := $(shell which wine 2>/dev/null) endif -ifdef WINE -ifndef WINEPATH -WINEPATH := $(shell which winepath 2>/dev/null) +ifndef WINEPATH_EXE +WINEPATH_EXE:= $(shell which winepath 2>/dev/null) endif -endif - -ifdef WINE +ifdef WINE_EXE ##WINEENV = @env -WINEENV = @env -i $(call __minienv_expand,DISPLAY HOME LANG LC_ALL PATH USER TERM WINEPREFIX) +WINEENV = @env -i $(call __minienv_expand,DISPLAY HOME LANG LC_ALL PATH USER TERM WINEDEBUG WINEPATH WINEPREFIX) ifdef WINEPREFIX -winedir_s = z:$(shell WINEPREFIX='$(WINEPREFIX)' $(WINEPATH) -s '$(realpath $1)') -winedir_w = $(shell WINEPREFIX='$(WINEPREFIX)' $(WINEPATH) -w '$(realpath $1)') +winedir_s = z:$(shell WINEPREFIX='$(WINEPREFIX)' $(WINEPATH_EXE) -s '$(realpath $1)') +winedir_w = $(shell WINEPREFIX='$(WINEPREFIX)' $(WINEPATH_EXE) -w '$(realpath $1)') else -winedir_s = z:$(shell $(WINEPATH) -s '$(realpath $1)') -winedir_w = $(shell $(WINEPATH) -w '$(realpath $1)') +winedir_s = z:$(shell $(WINEPATH_EXE) -s '$(realpath $1)') +winedir_w = $(shell $(WINEPATH_EXE) -w '$(realpath $1)') endif else WINEENV = false 'WINEENV' @@ -143,10 +140,10 @@ $c += -I$(UPX_LZMADIR) $c += -I$(top_srcdir)/src # Borland C/C++ 5.02 -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),) c := tc.method-lzma.bcc -$c = $(WINEENV) $(WINE) cmd.exe /c tmp/bcc.bat +$c = $(WINEENV) $(WINE_EXE) cmd.exe /c tmp/bcc.bat $c += -ms $c += -O1 -1 $c += -w @@ -156,10 +153,10 @@ endif # Digital Mars C/C++ 8.49 # http://www.digitalmars.com/download/freecompiler.html -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),) c := tc.method-lzma.dmc -$c = $(WINEENV) $(WINE) cmd.exe /c tmp/dmc.bat +$c = $(WINEENV) $(WINE_EXE) cmd.exe /c tmp/dmc.bat $c += -ms -R $c += -NS $c += -w- -w7 -r @@ -171,7 +168,7 @@ endif # Visual C/C++ 1.52 (8.00c) ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),) c := tc.method-lzma.cl -$c = $(WINEENV) $(WINE) cmd.exe /c tmp/cl.bat +$c = $(WINEENV) $(WINE_EXE) cmd.exe /c tmp/cl.bat $c += -nologo $c += -AS -Gd $c += -Gy @@ -213,19 +210,19 @@ tmp/lzma_d_c%.i : tmp/lzma_d_c%.S $(MAKEFILE_LIST) tmp/lzma_d_c%.S : lzma_d_c.c wdis2gas.py $(MAKEFILE_LIST) $(TMP_DEPS) rm -f tmp/$T*.i tmp/$T*.o tmp/$T*.obj tmp/$T*.S # compile -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),) ## $(call tc,bcc) $(PP_FLAGS) -c -otmp/$T_bc.obj $< ## $(call tc,wdis) tmp/$T_bc.obj | $(RTRIM) > tmp/$T_bc.obj.disasm endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),) $(call tc,dmc) $(PP_FLAGS) -c -otmp/$T_dm.obj $< $(call tc,wdis) tmp/$T_dm.obj | $(RTRIM) > tmp/$T_dm.obj.disasm endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),) $(call tc,cl) $(PP_FLAGS) -c -Fotmp/$T_vc.obj $< $(call tc,wdis) tmp/$T_vc.obj | $(RTRIM) > tmp/$T_vc.obj.disasm @@ -257,7 +254,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wdis),) CC_TEST_DEPS = $(MAKEFILE_LIST) $(TMP_DEPS) -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),) cc_test_bc : tc_list = method-lzma arch-i086 default cc_test_bc: cc_test.c $(CC_TEST_DEPS) @@ -267,7 +264,7 @@ cc_test-all: cc_test_bc endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),) cc_test_dm : tc_list = method-lzma arch-i086 default cc_test_dm: cc_test.c $(CC_TEST_DEPS) @@ -277,7 +274,7 @@ cc_test-all: cc_test_dm endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),) cc_test_vc : tc_list = method-lzma arch-i086 default cc_test_vc: cc_test.c $(CC_TEST_DEPS) @@ -312,43 +309,43 @@ tmp/l_test_gcc_i386.out: l_test.c $(L_TEST_DEPS) ./$@ l_test-all: tmp/l_test_gcc_i386.out -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),) tmp/l_test_bc.% : tc_list = method-lzma arch-i086 default tmp/l_test_bc.exe: l_test.c $(L_TEST_DEPS) @rm -f l_test.o l_test.obj tmp/test.exe $@ $(call tc,bcc) -o$(subst /,\\,$@) $< @rm -f l_test.o l_test.obj -ifdef RUN_DOSBOX - cp -p $@ tmp/test.exe && $(RUN_DOSBOX) tmp/test.exe +ifdef DOSBOX + cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe endif ##l_test-all: tmp/l_test_bc.exe endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),) tmp/l_test_dm.% : tc_list = method-lzma arch-i086 default tmp/l_test_dm.exe: l_test.c $(L_TEST_DEPS) @rm -f l_test.o l_test.obj tmp/test.exe $@ $(call tc,dmc) -ml -o$(subst /,\\,$@) $< @rm -f l_test.o l_test.obj -ifdef RUN_DOSBOX - cp -p $@ tmp/test.exe && $(RUN_DOSBOX) tmp/test.exe +ifdef DOSBOX + cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe endif l_test-all: tmp/l_test_dm.exe endif endif -ifdef WINE +ifdef WINE_EXE ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),) tmp/l_test_vc.% : tc_list = method-lzma arch-i086 default tmp/l_test_vc.exe: l_test.c $(L_TEST_DEPS) @rm -f l_test.o l_test.obj tmp/test.exe $@ $(call tc,cl) -Fe$(subst /,\\,$@) $< @rm -f l_test.o l_test.obj -ifdef RUN_DOSBOX - cp -p $@ tmp/test.exe && $(RUN_DOSBOX) tmp/test.exe +ifdef DOSBOX + cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe endif l_test-all: tmp/l_test_vc.exe endif @@ -360,8 +357,8 @@ tmp/l_test_wc.exe: l_test.c $(L_TEST_DEPS) @rm -f l_test.o l_test.obj tmp/test.exe $@ $(call tc,wcl) -fe=$@ $< @rm -f l_test.o l_test.obj -ifdef RUN_DOSBOX - cp -p $@ tmp/test.exe && $(RUN_DOSBOX) tmp/test.exe +ifdef DOSBOX + cp -p $@ tmp/test.exe && $(DOSBOX) tmp/test.exe endif l_test-all: tmp/l_test_wc.exe endif