Minor Makefile cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer 2006-08-21 16:40:20 +02:00
parent d76ef8e3cf
commit 8e9ce59ef2
8 changed files with 21 additions and 26 deletions

View File

@ -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 $<

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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