diff --git a/doc/Makefile b/doc/Makefile index 0a390147..c1bfd499 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -25,7 +25,7 @@ endif # // # ************************************************************************/ -top_srcdir = .. +top_srcdir ?= .. PACKAGE = upx VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h) @@ -81,4 +81,5 @@ mostlyclean clean distclean maintainer-clean: ### $(BUILT_SOURCES): $(top_srcdir)/src/version.h $(MAKEFILE_LIST) +.DELETE_ON_ERROR: $(BUILT_SOURCES) diff --git a/src/stub/Makefile b/src/stub/Makefile index 2a223525..818275f9 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -125,9 +125,11 @@ maintainer-clean: override T = $(basename $(notdir $@)) # trim (strip) trailing whitespace -RTRIM := sed -e 's/[ $(tab)]*$$//' -# squeeze duplicate blank lines, remove empty first & last line -SQUEEZE := cat --squeeze-blank | sed -e '1{/^$$/d}' -e '$${/^$$/d}' +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' # clear some vars, just in case LABEL_PREFIX = @@ -184,7 +186,7 @@ define tc.default.f-embed_objinfo $(call tc,objcopy) -R .text -R .data -R .bss $1 $(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1 $(call tc,objdump) -Dr $(tc_objdump_disasm_options) $1 | $(RTRIM) > $1.disasm - $(call tc,objdump) -htr -w $1 | $(RTRIM) | $(SQUEEZE) > $1.dump + $(call tc,objdump) -htr -w $1 | $(BLSQUEEZE) > $1.dump cat $1.dump >> $1 endef define tc.default.f-objstrip @@ -714,6 +716,7 @@ $(STUBS): tmp/.tmp-stamp $(MAKEFILE_LIST) endif -include tmp/*.d +.DELETE_ON_ERROR: %.h %.o ifneq ($(strip $(STUBS)),) .DELETE_ON_ERROR: $(STUBS) endif diff --git a/src/stub/src/arch/arm/v4a/Makefile.extra b/src/stub/src/arch/arm/v4a/Makefile.extra index b8636d90..bceab6ff 100644 --- a/src/stub/src/arch/arm/v4a/Makefile.extra +++ b/src/stub/src/arch/arm/v4a/Makefile.extra @@ -44,7 +44,8 @@ $c += -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:/c.arm' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@ + cat tmp/$T.s | $(BLDEL) | sed -e '1,/LzmaDecode:/c.arm' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' | $(BLDEL) > $@ + # the following stuff is for debugging only $(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o $(call tc,f-objstrip,tmp/$T.o) $(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin diff --git a/src/stub/src/arch/arm/v4t/Makefile.extra b/src/stub/src/arch/arm/v4t/Makefile.extra index 1ac036b7..9c09dbaa 100644 --- a/src/stub/src/arch/arm/v4t/Makefile.extra +++ b/src/stub/src/arch/arm/v4t/Makefile.extra @@ -42,7 +42,8 @@ $c += -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:/c.thumb' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@ + cat tmp/$T.s | $(BLDEL) | sed -e '1,/LzmaDecode:/c.thumb' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' | $(BLDEL) > $@ + # the following stuff is for debugging only $(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o $(call tc,f-objstrip,tmp/$T.o) $(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin diff --git a/src/stub/src/arch/m68k/m68000/Makefile.extra b/src/stub/src/arch/m68k/m68000/Makefile.extra index f8da7f97..919645d8 100644 --- a/src/stub/src/arch/m68k/m68000/Makefile.extra +++ b/src/stub/src/arch/m68k/m68000/Makefile.extra @@ -42,7 +42,7 @@ $c += -I$(top_srcdir)/src lzma_d_c%.S : lzma_d_c.c $(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s - cat tmp/$T.s | $(RTRIM) | $(SQUEEZE) | sed -e '/^$$/d' -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e '/\.section/d' -e 's/\.L/$(LABEL_PREFIX)/g' -e '/^[ \t]rts.*/d' -e 's/bsr\.l/bsr.w/' tmp/$T.s | $(RTRIM) > $@ + cat tmp/$T.s | $(BLDEL) | sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e '/\.section/d' -e 's/\.L/$(LABEL_PREFIX)/g' -e '/^[ $(tab)]rts.*/d' -e 's/bsr\.l/bsr.w/' | $(BLDEL) > $@ # the following stuff is for debugging only $(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o $(call tc,f-objstrip,tmp/$T.o)