We need a "UPX standard" compiler in order to re-compile the stubs for ppc64le; meanwhile use Thierry's "pre-compiled" stubs. Revert powerpc stubs to those produced by UPX standard powerpc.405-linux-gcc-3.4.5. Cleanup the workarounds that Thierry used because he lacked upx-stubtools 20130920. ARMv8 (64-bit) compiles but is incomplete and does not run yet. changed src/Makefile changed src/linker.cpp changed src/stub/Makefile changed src/stub/amd64-linux.elf-entry.h changed src/stub/arm64-darwin.macho-entry.h changed src/stub/arm64-darwin.macho-fold.h changed src/stub/powerpc-darwin.dylib-entry.h changed src/stub/powerpc-darwin.macho-entry.h changed src/stub/powerpc-darwin.macho-fold.h changed src/stub/powerpc-linux.elf-entry.h changed src/stub/powerpc-linux.elf-fold.h changed src/stub/powerpc-linux.kernel.vmlinux.h changed src/stub/scripts/xstrip.py changed src/stub/src/arch/arm/v8a/lzma_d.S changed src/stub/src/arch/arm/v8a/macros.S changed src/stub/src/arm64-darwin.macho-entry.S changed src/stub/tmp/arm64-darwin.macho-entry.bin.dump
128 lines
3.9 KiB
Makefile
128 lines
3.9 KiB
Makefile
#
|
|
# UPX Makefile - needs GNU make 3.81 or better
|
|
#
|
|
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
#
|
|
|
|
# In GNU Make 4.0 this "MAKEFLAGS += -rR" is not executed immediately.
|
|
# Instead, it is executed later, and we cannot rely on sequentiality
|
|
# with respect to builtin variables. So if we want to have no
|
|
# dependencies on the default values of builtin variables,
|
|
# then we cannot use builtin variables at all.
|
|
MAKEFLAGS += -rR
|
|
|
|
.SUFFIXES:
|
|
export SHELL = /bin/sh
|
|
override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1)
|
|
|
|
ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.77 3.78 3.78.1 3.79 3.79.1 3.80),)
|
|
$(error GNU make 3.81 or better is required)
|
|
endif
|
|
|
|
ifndef srcdir
|
|
srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
|
|
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,')
|
|
endif
|
|
ifndef top_srcdir
|
|
top_srcdir := $(srcdir)/..
|
|
endif
|
|
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
|
ifneq ($(srcdir),.)
|
|
##$(info Info: using VPATH . $(srcdir))
|
|
VPATH := . $(srcdir)
|
|
endif
|
|
|
|
ifeq ($(upx_CXX),)
|
|
upx_CXX = g++
|
|
endif
|
|
ifneq ($(findstring $(firstword $(upx_CXX)),g++),)
|
|
USE_GNUC ?= 1
|
|
endif
|
|
ifeq ($(USE_GNUC),1)
|
|
ifeq ($(DEBUG),1)
|
|
upx_CXXFLAGS += -O0 -g
|
|
else
|
|
upx_CXXFLAGS += -O2
|
|
LDFLAGS += -s
|
|
endif
|
|
# some gcc versions suffer over-agressive aliasing and wrapv optimization features/bugs
|
|
upx_CXXFLAGS_OPTIMIZE_STRICT_ALIASING ?= -fno-strict-aliasing
|
|
upx_CXXFLAGS_OPTIMIZE_WRAPV ?= -fwrapv
|
|
upx_CXXFLAGS += $(upx_CXXFLAGS_OPTIMIZE_STRICT_ALIASING)
|
|
upx_CXXFLAGS += $(upx_CXXFLAGS_OPTIMIZE_WRAPV)
|
|
upx_CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wwrite-strings
|
|
upx_CXXFLAGS_WERROR ?= -Werror
|
|
upx_CXXFLAGS += $(upx_CXXFLAGS_WERROR)
|
|
endif
|
|
upx_CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
|
upx_CXXLD ?= $(upx_CXX)
|
|
|
|
exeext ?= .out
|
|
libext ?= .a
|
|
objext ?= .o
|
|
|
|
upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
|
|
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
|
|
|
|
# we need UCL and zlib - you can set envvar UPX_UCLDIR
|
|
ifneq ($(wildcard $(UPX_UCLDIR)/include/ucl/ucl.h),)
|
|
INCLUDES += -I$(UPX_UCLDIR)/include
|
|
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
|
|
endif
|
|
LIBS += -lucl -lz
|
|
# you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK
|
|
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
|
$(info UPX_LZMA_VERSION=$(UPX_LZMA_VERSION))
|
|
ifneq ($(UPX_LZMA_VERSION),)
|
|
DEFS += -DWITH_LZMA=$(UPX_LZMA_VERSION)
|
|
INCLUDES += -I$(UPX_LZMADIR)
|
|
endif
|
|
|
|
|
|
all: upx$(exeext) | .depend
|
|
.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS) .depend
|
|
|
|
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
|
$($(notdir $@).PRE_LINK_STEP)
|
|
$(strip $(upx_CXXLD) $(call e,upx_CPPFLAGS) $(call e,upx_CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS))
|
|
$($(notdir $@).POST_LINK_STEP)
|
|
|
|
%.o : %.cpp | .depend
|
|
$(strip $(upx_CXX) $(call e,upx_CPPFLAGS) $(call e,upx_CXXFLAGS) -o $@ -c $<)
|
|
|
|
.depend: $(sort $(wildcard $(srcdir)/*.cpp $(srcdir)/*.h)) $(MAKEFILE_LIST)
|
|
@rm -f $@
|
|
ifeq ($(USE_GNUC),1)
|
|
@echo "Updating $@"
|
|
@$(strip $(upx_CXX) $(call e,upx_CPPFLAGS) -MM) $(filter %.cpp,$^) > $@
|
|
else
|
|
touch $@
|
|
endif
|
|
|
|
|
|
ifeq ($(USE_GNUC),1)
|
|
##compress_lzma$(objext) : upx_CXXFLAGS += -O3 -fomit-frame-pointer
|
|
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-cast-qual
|
|
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-shadow
|
|
ifeq ($(UPX_LZMA_VERSION),0x443)
|
|
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-non-virtual-dtor
|
|
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-unused
|
|
endif
|
|
# needed for gcc-4.3:
|
|
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-error
|
|
endif
|
|
|
|
|
|
mostlyclean clean distclean maintainer-clean:
|
|
rm -f *.d *.map *.o *.obj *.res .depend upx.exe upx.out upx.ttp upx$(exeext)
|
|
|
|
.PHONY: all mostlyclean clean distclean maintainer-clean
|
|
|
|
ifeq ($(MAKECMDGOALS),mostlyclean)
|
|
else ifeq ($(MAKECMDGOALS),clean)
|
|
else ifeq ($(MAKECMDGOALS),distclean)
|
|
else ifeq ($(MAKECMDGOALS),maintainer-clean)
|
|
else
|
|
-include .depend
|
|
endif
|