mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Minor Makefile updates.
This commit is contained in:
parent
c73da864c8
commit
6e5153cd07
|
@ -25,7 +25,7 @@ endif
|
||||||
# //
|
# //
|
||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
top_srcdir = ..
|
top_srcdir ?= ..
|
||||||
|
|
||||||
PACKAGE = upx
|
PACKAGE = upx
|
||||||
VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
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)
|
$(BUILT_SOURCES): $(top_srcdir)/src/version.h $(MAKEFILE_LIST)
|
||||||
|
.DELETE_ON_ERROR: $(BUILT_SOURCES)
|
||||||
|
|
||||||
|
|
|
@ -126,8 +126,10 @@ override T = $(basename $(notdir $@))
|
||||||
|
|
||||||
# trim (strip) trailing whitespace
|
# trim (strip) trailing whitespace
|
||||||
RTRIM := sed -e 's/[ $(tab)]*$$//'
|
RTRIM := sed -e 's/[ $(tab)]*$$//'
|
||||||
# squeeze duplicate blank lines, remove empty first & last line
|
# squeeze duplicate blank lines, delete empty first & last line
|
||||||
SQUEEZE := cat --squeeze-blank | sed -e '1{/^$$/d}' -e '$${/^$$/d}'
|
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
|
# clear some vars, just in case
|
||||||
LABEL_PREFIX =
|
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 .text -R .data -R .bss $1
|
||||||
$(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $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) -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
|
cat $1.dump >> $1
|
||||||
endef
|
endef
|
||||||
define tc.default.f-objstrip
|
define tc.default.f-objstrip
|
||||||
|
@ -714,6 +716,7 @@ $(STUBS): tmp/.tmp-stamp $(MAKEFILE_LIST)
|
||||||
endif
|
endif
|
||||||
-include tmp/*.d
|
-include tmp/*.d
|
||||||
|
|
||||||
|
.DELETE_ON_ERROR: %.h %.o
|
||||||
ifneq ($(strip $(STUBS)),)
|
ifneq ($(strip $(STUBS)),)
|
||||||
.DELETE_ON_ERROR: $(STUBS)
|
.DELETE_ON_ERROR: $(STUBS)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -44,7 +44,8 @@ $c += -I$(top_srcdir)/src
|
||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
$(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,gcc) -c -MF /dev/null $@ -o tmp/$T.o
|
||||||
$(call tc,f-objstrip,tmp/$T.o)
|
$(call tc,f-objstrip,tmp/$T.o)
|
||||||
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
||||||
|
|
|
@ -42,7 +42,8 @@ $c += -I$(top_srcdir)/src
|
||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
$(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,gcc) -c -MF /dev/null $@ -o tmp/$T.o
|
||||||
$(call tc,f-objstrip,tmp/$T.o)
|
$(call tc,f-objstrip,tmp/$T.o)
|
||||||
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary tmp/$T.o tmp/$T.bin
|
||||||
|
|
|
@ -42,7 +42,7 @@ $c += -I$(top_srcdir)/src
|
||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
$(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
|
# the following stuff is for debugging only
|
||||||
$(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o
|
$(call tc,gcc) -c -MF /dev/null $@ -o tmp/$T.o
|
||||||
$(call tc,f-objstrip,tmp/$T.o)
|
$(call tc,f-objstrip,tmp/$T.o)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user