Disable EXE disassembly and compression by default

NOOBJDUMP=1 and NOUPX=1 have been removed. Make 'dump'
target to disassemble. UPX=upx to compress executable.

Setting UPX used to cause it to fail. That has been fixed.
This commit is contained in:
James R 2021-06-16 15:34:58 -07:00
parent 4e71ee7acb
commit 3a044e71cc

View file

@ -15,6 +15,7 @@
# cleandep - remove dependency files for this build # cleandep - remove dependency files for this build
# distclean - remove entire executable, object and # distclean - remove entire executable, object and
# dependency file directory structure. # dependency file directory structure.
# dump - disassemble executable
# info - print settings # info - print settings
# #
# This Makefile can automatically detect the host system # This Makefile can automatically detect the host system
@ -83,8 +84,8 @@
# STATIC=1 - Use static linking. # STATIC=1 - Use static linking.
# DISTCC=1 # DISTCC=1
# CCACHE=1 # CCACHE=1
# NOOBJDUMP=1 - Don't disassemble executable. # UPX= - UPX command to use for compressing final
# NOUPX=1 - Don't compress executable. # executable.
# WINDOWSHELL=1 - Use Windows commands. # WINDOWSHELL=1 - Use Windows commands.
# PREFIX= - Prefix to many commands, for cross compiling. # PREFIX= - Prefix to many commands, for cross compiling.
# YASM=1 - Use Yasm instead of NASM assembler. # YASM=1 - Use Yasm instead of NASM assembler.
@ -165,7 +166,6 @@ ifdef WINDOWSHELL
GZIP_OPTS+=--rsyncable GZIP_OPTS+=--rsyncable
endif endif
UPX?=upx
UPX_OPTS?=--best --preserve-build-id UPX_OPTS?=--best --preserve-build-id
ifndef ECHO ifndef ECHO
UPX_OPTS+=-qq UPX_OPTS+=-qq
@ -242,9 +242,7 @@ all : $(exe)
$(call Echo,$(build_done)) $(call Echo,$(build_done))
ifndef VALGRIND ifndef VALGRIND
ifndef NOOBJDUMP dump : $(dbg).txt
all : $(dbg).txt
endif
endif endif
ifdef STATIC ifdef STATIC
@ -310,7 +308,9 @@ LD:=$(CC)
CC:=$(CC) $(CFLAGS) CC:=$(CC) $(CFLAGS)
NASM:=$(NASM) $(NASMOPTS) -f $(nasm_format) NASM:=$(NASM) $(NASMOPTS) -f $(nasm_format)
GZIP:=$(GZIP) $(GZIP_OPTS) GZIP:=$(GZIP) $(GZIP_OPTS)
ifdef UPX
UPX:=$(UPX) $(UPX_OPTS) UPX:=$(UPX) $(UPX_OPTS)
endif
WINDRES:=$(WINDRES) $(WINDRESFLAGS)\ WINDRES:=$(WINDRES) $(WINDRESFLAGS)\
$(debug_opts) --include-dir=win32 -O coff $(debug_opts) --include-dir=win32 -O coff
@ -321,11 +321,14 @@ WINDRES:=$(WINDRES) $(WINDRESFLAGS)\
# prerequisites # prerequisites
.SECONDEXPANSION : .SECONDEXPANSION :
# 'UPX' is also recognized in the enviornment by upx
unexport UPX
# executable stripped of debugging symbols # executable stripped of debugging symbols
$(exe) : $(dbg) | $$(@D)/ $(exe) : $(dbg) | $$(@D)/
$(.)$(OBJCOPY) --strip-debug $< $@ $(.)$(OBJCOPY) --strip-debug $< $@
$(.)-$(OBJCOPY) --add-gnu-debuglink=$< $@ $(.)-$(OBJCOPY) --add-gnu-debuglink=$< $@
ifndef NOUPX ifdef UPX
$(call Echo,Compressing final executable...) $(call Echo,Compressing final executable...)
$(.)-$(UPX) $@ $(.)-$(UPX) $@
endif endif