mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
GNU Make 4.0 does not assign to MAKEFLAGS sequentially
This commit is contained in:
parent
e48a60a4f0
commit
9d7e44feff
53
src/Makefile
53
src/Makefile
|
@ -4,7 +4,13 @@
|
|||
# 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)
|
||||
|
@ -26,30 +32,30 @@ ifneq ($(srcdir),.)
|
|||
VPATH := . $(srcdir)
|
||||
endif
|
||||
|
||||
ifeq ($(CXX),)
|
||||
CXX = g++
|
||||
ifeq ($(upx_CXX),)
|
||||
upx_CXX = g++
|
||||
endif
|
||||
ifneq ($(findstring $(firstword $(CXX)),g++),)
|
||||
ifneq ($(findstring $(firstword $(upx_CXX)),g++),)
|
||||
USE_GNUC ?= 1
|
||||
endif
|
||||
ifeq ($(USE_GNUC),1)
|
||||
ifeq ($(DEBUG),1)
|
||||
CXXFLAGS += -O0 -g
|
||||
upx_CXXFLAGS += -O0 -g
|
||||
else
|
||||
CXXFLAGS += -O2
|
||||
upx_CXXFLAGS += -O2
|
||||
LDFLAGS += -s
|
||||
endif
|
||||
# some gcc versions suffer over-agressive aliasing and wrapv optimization features/bugs
|
||||
CXXFLAGS_OPTIMIZE_STRICT_ALIASING ?= -fno-strict-aliasing
|
||||
CXXFLAGS_OPTIMIZE_WRAPV ?= -fwrapv
|
||||
CXXFLAGS += $(CXXFLAGS_OPTIMIZE_STRICT_ALIASING)
|
||||
CXXFLAGS += $(CXXFLAGS_OPTIMIZE_WRAPV)
|
||||
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wwrite-strings
|
||||
CXXFLAGS_WERROR ?= -Werror
|
||||
CXXFLAGS += $(CXXFLAGS_WERROR)
|
||||
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
|
||||
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
||||
CXXLD ?= $(CXX)
|
||||
upx_CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
||||
upx_CXXLD ?= $(upx_CXX)
|
||||
|
||||
exeext ?= .out
|
||||
libext ?= .a
|
||||
|
@ -66,6 +72,7 @@ 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)
|
||||
|
@ -77,32 +84,32 @@ all: upx$(exeext) | .depend
|
|||
|
||||
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
||||
$($(notdir $@).PRE_LINK_STEP)
|
||||
$(strip $(CXXLD) $(call e,CPPFLAGS) $(call e,CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS))
|
||||
$(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 $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<)
|
||||
$(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 $(CXX) $(call e,CPPFLAGS) -MM) $(filter %.cpp,$^) > $@
|
||||
@$(strip $(upx_CXX) $(call e,upx_CPPFLAGS) -MM) $(filter %.cpp,$^) > $@
|
||||
else
|
||||
touch $@
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(USE_GNUC),1)
|
||||
##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer
|
||||
compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual
|
||||
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
|
||||
##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) : CXXFLAGS += -Wno-non-virtual-dtor
|
||||
compress_lzma$(objext) : CXXFLAGS += -Wno-unused
|
||||
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) : CXXFLAGS += -Wno-error
|
||||
compress_lzma$(objext) : upx_CXXFLAGS += -Wno-error
|
||||
endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user