From 12bcb09051b4d7ab1ac11e0f220bd663338d1fcf Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 21 Feb 2007 17:11:42 +0100 Subject: [PATCH] Small Makefile updates. --- src/stub/Makefile | 34 ++++++++++++++++----------- src/stub/src/arch/i086/Makefile.extra | 33 ++++++++++++-------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/stub/Makefile b/src/stub/Makefile index 23350797..623a1225 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -134,15 +134,6 @@ maintainer-clean: # util var for use in the rules - basename of the current target 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 LABEL_PREFIX = PP_FLAGS = @@ -151,6 +142,21 @@ tc_bfdname = tc_list = 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 @@ -170,15 +176,15 @@ define tc endef # 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=0 -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_mkdep = python $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null +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_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.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 tc.default.m-ar = multiarch-ar-2.17 diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 544f05d8..4374f6bf 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -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) -# $(WATCOM) -# /usr/bin/wine +##export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6 # MAKEFLAGS += -rR @@ -19,8 +17,6 @@ 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 - STUBS = STUBS += lzma_d_cf.S lzma_d_cs.S @@ -40,11 +36,16 @@ DOSBOX = true DOSBOX = dosbox DOSBOX = /usr/bin/time -p dosbox -exit -WINEENV = env -WINEENV = env -i DISPLAY='$(DISPLAY)' HOME='$(HOME)' PATH='$(PATH)' USER='$(USER)' - +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)) 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 define mkbat @@ -88,7 +89,7 @@ $c += -I$(top_srcdir)/src # Borland C/C++ 5.02 ifneq ($(wildcard $(BC502DIR)/bin/bcc.exe),) 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 += -O1 -1 $c += -w @@ -101,7 +102,7 @@ endif # http://www.digitalmars.com/download/freecompiler.html ifneq ($(wildcard $(DM849DIR)/bin/dmc.exe),) 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 += -NS $c += -w- -w7 -r @@ -114,7 +115,7 @@ endif # Visual C/C++ 1.52 (8.00c) ifneq ($(wildcard $(VC152DIR)/bin/cl.exe),) 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 += -Gy $c += -O2 -Gf -Gs -G0 @@ -140,12 +141,10 @@ $c += -I$(top_srcdir)/src endif 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 $(DM849DIR)/bin/dmc.exe),) ifneq ($(wildcard $(WATCOM)/binl/wcl),) -ifneq ($(wildcard /usr/bin/wine),) lzma_d_c%.i : tmp/lzma_d_c%.i cp $< $@ @@ -170,7 +169,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),) $(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm endif # 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,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;' > $@ @@ -180,8 +179,6 @@ endif endif endif -##endif -endif lzma_d_cf.% : PP_FLAGS = -DFAST lzma_d_cs.% : PP_FLAGS = -DSMALL