From 8e9ce59ef2ad9f54bf002ce7bc46dd63413b401f Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 21 Aug 2006 16:40:20 +0200 Subject: [PATCH] Minor Makefile cleanups. --- doc/Makefile | 14 ++++++------- src/stub/Makefile | 21 +++++++------------ src/stub/src/arch/amd64/Makefile.extra | 2 +- src/stub/src/arch/arm/v4a/Makefile.extra | 2 +- src/stub/src/arch/arm/v4t/Makefile.extra | 2 +- src/stub/src/arch/i386/Makefile.extra | 2 +- .../src/arch/mips/mipsel.r3000/Makefile.extra | 2 +- src/stub/src/arch/powerpc/32/Makefile.extra | 2 +- 8 files changed, 21 insertions(+), 26 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 05ead0a2..094c7452 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -8,8 +8,8 @@ PACKAGE = upx VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h) VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h) -TRIMSPACE = sed -e 's/[ ]*$$//' -DETAB2 = sed -e 's/ / /g' +RTRIM := sed -e 's/[ ]*$$//' +DETAB2 := sed -e 's/ / /g' BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex BUILT_SOURCES = upx.1 upx.doc upx.html @@ -34,20 +34,20 @@ mostlyclean clean distclean maintainer-clean: .SUFFIXES: .1 .doc .html .man .pod .ps .tex %.1 : %.pod - pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(TRIMSPACE) > $@ + pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@ %.doc : %.pod - pod2text < $< | $(TRIMSPACE) > $@ + pod2text < $< | $(RTRIM) > $@ %.html : %.pod - pod2html --noindex $< | $(TRIMSPACE) | $(DETAB2) > $@ + pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@ @rm -f pod2htm* %.man : %.1 - nroff -man $< | $(TRIMSPACE) > $@ + nroff -man $< | $(RTRIM) > $@ %.ps : %.1 - groff -man $< | $(TRIMSPACE) > $@ + groff -man $< | $(RTRIM) > $@ %.tex : %.pod pod2latex $< diff --git a/src/stub/Makefile b/src/stub/Makefile index c2050eb3..b6c2180d 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -126,6 +126,8 @@ override T = $(basename $(notdir $@)) # // setup toolchain globals # ************************************************************************/ +RTRIM := sed -e 's/[ ]*$$//' + # default settings for $(tc_list) tc.default.bin2h = python $(top_srcdir)/src/stub/scripts/bin2h.py tc.default.brandelf = python $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname)) @@ -153,7 +155,7 @@ define tc.default.embed_objinfo $(call tc,m-objcopy) --strip-unneeded $2 $(call tc,m-objcopy) -R .text -R .data -R .bss $2 $(call tc,m-objcopy) -R .comment -R .note -R .reginfo $2 - $(call tc,m-objdump) -trwh $2 | sed -e 's/[ ]*$$//' > $2.dump + $(call tc,m-objdump) -trwh $2 | $(RTRIM) > $2.dump cat $2.dump >> $2 endef @@ -222,7 +224,7 @@ tmp/amd64-linux.elf-main.o : $(srcdir)/src/$$T.c arm-linux.elf% : tc_list = arm-linux.elf default arm-linux.elf% : tc_bfdname = elf32-littlearm -tc.arm-linux.elf.gcc = arm-linux-gcc-4.1.0 -march=armv4 -nostdinc -MMD -MT $@ +tc.arm-linux.elf.gcc = arm-linux-gcc-4.1.0 -mlittle-endian -march=armv4 -nostdinc -MMD -MT $@ tc.arm-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables tc.arm-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror @@ -592,19 +594,12 @@ i386-win32.pe.h : $(srcdir)/src/$$T.S m68k-atari.tos-%.h : tc_list = m68k-atari.tos default m68k-atari.tos-%.h : tc_bfdname = elf32-m68k -tc.m68k-atari.tos.as = m68k-linux-as-20060406 --register-prefix-optional -tc.m68k-atari.tos.gcc = m68k-linux-gcc-4.1.1 -nostdinc -MMD -MT $@ +tc.m68k-atari.tos.gcc = m68k-linux-gcc-4.1.1 -m68000 -malign-int -nostdinc -MMD -MT $@ tc.m68k-atari.tos.gcc += -fno-exceptions -fno-asynchronous-unwind-tables tc.m68k-atari.tos.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror m68k-atari.tos-nrv%.h : $(srcdir)/src/m68k-atari.tos.S -ifeq (1,2) - $(call tc,pp-as) -D__GAS__ $(PP_FLAGS) $< -o tmp/$T.i - $(call tc,as) tmp/$T.i -o tmp/$T.bin - $(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d -else $(call tc,gcc) -c -D__GAS__ $(PP_FLAGS) -x assembler-with-cpp -Wa,--register-prefix-optional $< -o tmp/$T.bin -endif $(call tc,embed_objinfo,tmp/$T.bin) $(call tc,bin2h) --ident=$(IDENT_PREFIX)loader$(IDENT_SUFFIX) tmp/$T.bin $@ @@ -633,8 +628,8 @@ tc.mipsel.r3000-ps1.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -We mipsel.r3000-ps1.h : $(srcdir)/src/$$T.S ifeq (1,1) - $(call tc,pp-as) $(PP_FLAGS) $< -o tmp/$T.tmp1 - $(call tc,as) tmp/$T.tmp1 -o tmp/$T.bin + $(call tc,pp-as) $(PP_FLAGS) $< -o tmp/$T.i + $(call tc,as) tmp/$T.i -o tmp/$T.bin $(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d else ## FIXME - as-2.16.1 does not work ??? @@ -680,7 +675,7 @@ tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c powerpc-linux.elf% : tc_list = powerpc-linux.elf default powerpc-linux.elf% : tc_bfdname = elf32-powerpc -tc.powerpc-linux.elf.gcc = powerpc.405-linux-gcc-3.4.5 -mcpu=405 -nostdinc -MMD -MT $@ +tc.powerpc-linux.elf.gcc = powerpc.405-linux-gcc-3.4.5 -m32 -mbig-endian -mcpu=405 -nostdinc -MMD -MT $@ tc.powerpc-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables tc.powerpc-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror diff --git a/src/stub/src/arch/amd64/Makefile.extra b/src/stub/src/arch/amd64/Makefile.extra index fbfb8fdd..78fbf8bb 100644 --- a/src/stub/src/arch/amd64/Makefile.extra +++ b/src/stub/src/arch/amd64/Makefile.extra @@ -37,7 +37,7 @@ lzma_d_c%.S : lzma_d_c.c $(call tc,objstrip) tmp/$T.o $(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin head -c-1 tmp/$T.bin > tmp/$T.out - $(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out > tmp/$T.out.lst + $(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.lst $(call tc,bin2h) --mode=gas tmp/$T.out $@ lzma_d_cf.% : PP_FLAGS = -DFAST diff --git a/src/stub/src/arch/arm/v4a/Makefile.extra b/src/stub/src/arch/arm/v4a/Makefile.extra index e225451e..f2a9f572 100644 --- a/src/stub/src/arch/arm/v4a/Makefile.extra +++ b/src/stub/src/arch/arm/v4a/Makefile.extra @@ -37,7 +37,7 @@ tc.arm-lzma.gcc += -I$(top_srcdir)/src lzma_d_c%.S : lzma_d_c.c $(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s - sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' < tmp/$T.s > $@ + sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@ lzma_d_cf.% : PP_FLAGS = -DFAST lzma_d_cs.% : PP_FLAGS = -DSMALL diff --git a/src/stub/src/arch/arm/v4t/Makefile.extra b/src/stub/src/arch/arm/v4t/Makefile.extra index 0fbcb700..531f3d4e 100644 --- a/src/stub/src/arch/arm/v4t/Makefile.extra +++ b/src/stub/src/arch/arm/v4t/Makefile.extra @@ -35,7 +35,7 @@ tc.arm-lzma.gcc += -I$(top_srcdir)/src lzma_d_c%.S : lzma_d_c.c $(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s - sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' < tmp/$T.s > $@ + sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@ lzma_d_cf.% : PP_FLAGS = -DFAST lzma_d_cs.% : PP_FLAGS = -DSMALL diff --git a/src/stub/src/arch/i386/Makefile.extra b/src/stub/src/arch/i386/Makefile.extra index 3b992060..d63cb232 100644 --- a/src/stub/src/arch/i386/Makefile.extra +++ b/src/stub/src/arch/i386/Makefile.extra @@ -36,7 +36,7 @@ lzma_d_c%.S : lzma_d_c.c $(call tc,objstrip) tmp/$T.o $(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin head -c-1 tmp/$T.bin > tmp/$T.out - $(call tc,objdump) -b binary -m i386 -D tmp/$T.out > tmp/$T.out.lst + $(call tc,objdump) -b binary -m i386 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.lst $(call tc,bin2h) --mode=gas tmp/$T.out $@ lzma_d_cf.% : PP_FLAGS = -DFAST diff --git a/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra b/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra index 214165b5..20e90f7f 100644 --- a/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra +++ b/src/stub/src/arch/mips/mipsel.r3000/Makefile.extra @@ -38,7 +38,7 @@ lzma_d_c%.S : lzma_d_c.c $(call tc,objstrip) tmp/$T.o $(call tc,m-objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin head -c-0 tmp/$T.bin > tmp/$T.out - $(call tc,m-objdump) -b binary -m mips:3000 -D tmp/$T.out > tmp/$T.out.lst + $(call tc,m-objdump) -b binary -m mips:3000 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.lst $(call tc,bin2h) --mode=gas tmp/$T.out $@ lzma_d_cf.% : PP_FLAGS = -DFAST diff --git a/src/stub/src/arch/powerpc/32/Makefile.extra b/src/stub/src/arch/powerpc/32/Makefile.extra index f6a7c44f..947505a1 100644 --- a/src/stub/src/arch/powerpc/32/Makefile.extra +++ b/src/stub/src/arch/powerpc/32/Makefile.extra @@ -38,7 +38,7 @@ lzma_d_c%.S : lzma_d_c.c $(call tc,objstrip) tmp/$T.o $(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin head -c-4 tmp/$T.bin > tmp/$T.out - $(call tc,objdump) -b binary -m powerpc -D tmp/$T.out > tmp/$T.out.lst + $(call tc,objdump) -b binary -m powerpc -D tmp/$T.out | $(RTRIM) > tmp/$T.out.lst $(call tc,bin2h) --mode=gas tmp/$T.out $@ lzma_d_cf.% : PP_FLAGS = -DFAST