mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
719 lines
13 KiB
Makefile
719 lines
13 KiB
Makefile
# /***********************************************************************
|
|
# // setup
|
|
# ************************************************************************/
|
|
|
|
SHELL = /bin/sh
|
|
|
|
|
|
.SUFFIXES:
|
|
.SUFFIXES: .a .c .cpp .exe .lib .o .obj .rc .res .ttp
|
|
|
|
|
|
ifeq ($(srcdir),)
|
|
srcdir = .
|
|
endif
|
|
|
|
VPATH = $(srcdir)
|
|
|
|
|
|
# auto-detect the target unless given on the commandline
|
|
ifeq ($(strip $(target)),)
|
|
# try environment variable UPX_MAKE_TARGET
|
|
target := $(UPX_MAKE_TARGET)
|
|
endif
|
|
ifeq ($(strip $(target)),)
|
|
ifneq ($(strip $(wildcard /usr/include/linux)),)
|
|
target = linux
|
|
endif
|
|
##ifneq ($(strip $(wildcard /platform/sun4?/kernel/unix)),)
|
|
##target = sparc-sun-solaris
|
|
##endif
|
|
endif
|
|
|
|
ifeq ($(strip $(target)),)
|
|
include please_specify_a_target
|
|
endif
|
|
|
|
|
|
# util var for use in the rules - basename of the current target
|
|
override T = $(basename $@)
|
|
|
|
|
|
# /***********************************************************************
|
|
# // compiler defaults
|
|
# ************************************************************************/
|
|
|
|
CC_SRC = $<
|
|
CXX_SRC = $<
|
|
CC_COMPILE = $(CC) $(CCARCH) $(DEFS) $(EXTRA_DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_OUTPUT) -c $(CC_SRC)
|
|
CXX_COMPILE = $(CXX) $(CXXARCH) $(DEFS) $(EXTRA_DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXXFLAGS_OUTPUT) -c $(CXX_SRC)
|
|
CXX_LINK_EXE = $(CXXLD) $(CXXLDARCH) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LINK_EXE_OUTPUT) $^ $(LDLIBS) $(EXTRA_LDLIBS) $(LINK_EXE_LDFLAGS)
|
|
STUBEDIT_EXE =
|
|
STUBIFY_EXE =
|
|
CHMOD_EXE =
|
|
|
|
o = .o
|
|
a = .a
|
|
e =
|
|
DEFS =
|
|
INCLUDES =
|
|
LIBDIRS =
|
|
DOS_LDLIBS =
|
|
DOS_LIBDIRS =
|
|
|
|
# CC defaults
|
|
CC = INVALID_TARGET_CC
|
|
CCARCH =
|
|
CFLAGS =
|
|
CFLAGS_OUTPUT =
|
|
|
|
# CXX defaults
|
|
CXX = $(CC)
|
|
CXXARCH = $(CCARCH)
|
|
CXXFLAGS = $(CFLAGS)
|
|
CXXFLAGS_OUTPUT = $(CFLAGS_OUTPUT)
|
|
|
|
# CXXLD defaults
|
|
CXXLD = $(CXX)
|
|
CXXLDARCH = $(CXXARCH)
|
|
LDFLAGS =
|
|
LINK_EXE_OUTPUT =
|
|
LDLIBS =
|
|
LINK_EXE_LDFLAGS =
|
|
|
|
ifeq ($(DEBUG),1)
|
|
DEFS += -DDEBUG
|
|
## DEFS += -DTESTING
|
|
endif
|
|
|
|
|
|
# /***********************************************************************
|
|
# // compression library
|
|
# ************************************************************************/
|
|
|
|
ifeq ($(WITH_ZLIB),1)
|
|
DOS_LDLIBS += zlib.lib
|
|
endif
|
|
|
|
UCLDIR:=$(strip $(subst \,/,$(UCLDIR)))
|
|
NRVDIR:=$(strip $(subst \,/,$(NRVDIR)))
|
|
u = ucl
|
|
U = UCL
|
|
upx_exe_tail =
|
|
include $(srcdir)/Makedefs.inc
|
|
ifneq ($(strip $(wildcard $(NRVDIR)/include/nrv)),)
|
|
u = nrv
|
|
U = NRV
|
|
upx_exe_tail := _$(u)
|
|
include $(srcdir)/Makedefs.inc
|
|
endif
|
|
upx_exe = upx$(upx_exe_tail)$(e)
|
|
|
|
override tmp := -Wl,--rpath,
|
|
LDRPATH := $(addprefix $(tmp),$(LIBDIRS))
|
|
LIBDIRS += .
|
|
LDLIBDIRS := $(addprefix -L,$(LIBDIRS))
|
|
|
|
##LDFLAGS += $(LDRPATH)
|
|
LDFLAGS += $(LDLIBDIRS)
|
|
|
|
|
|
# /***********************************************************************
|
|
# // compiler settings
|
|
# ************************************************************************/
|
|
|
|
###
|
|
### generic gcc
|
|
###
|
|
|
|
ifeq ($(target),gcc)
|
|
include $(srcdir)/Makedefs.gcc
|
|
endif
|
|
|
|
|
|
###
|
|
### linux
|
|
###
|
|
|
|
ifeq ($(target),linux)
|
|
include $(srcdir)/Makedefs.gcc
|
|
override arch := $(shell uname -m | sed -e 's/^i[3456789]86$$/i386/')
|
|
ifeq ($(arch),i386)
|
|
CCARCH += -march=i386 -mcpu=i686
|
|
endif
|
|
DEFS += -D_FILE_OFFSET_BITS=64
|
|
LDLIBS += -lmcheck
|
|
##CFLAGS_WERROR = -Werror
|
|
|
|
ifeq ($(DEBUG),1)
|
|
else
|
|
##LDFLAGS += -static
|
|
STUBEDIT_EXE = objcopy -S -R .comment -R .note $@
|
|
ifeq ($(arch),i386)
|
|
## STUBIFY_EXE = perl $(srcdir)/stub/scripts/brandelf.pl $@
|
|
endif
|
|
endif
|
|
CHMOD_EXE = chmod 755 $@
|
|
|
|
endif # linux
|
|
|
|
|
|
###
|
|
### linux/i386 - Intel C++ 7.x
|
|
###
|
|
|
|
ifeq ($(target),linux-intelc)
|
|
DEPMODE := intelc_linux
|
|
CC = icc
|
|
CXX = icpc
|
|
CCARCH += -march=i386 -mcpu=i686
|
|
CFLAGS_OUTPUT = -o $@
|
|
LINK_EXE_OUTPUT = -o $@
|
|
ifeq ($(WITH_ZLIB),1)
|
|
LDLIBS += -lz
|
|
endif
|
|
|
|
CFLAGS = $(CFLAGS_WERROR)
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -g -O0
|
|
else
|
|
CFLAGS += -O2
|
|
endif
|
|
LDFLAGS += -Wl,-Map,$T.map
|
|
|
|
endif
|
|
|
|
|
|
###
|
|
### linux/i386 - Borland C++ 5.7 (Kylix 3)
|
|
###
|
|
|
|
ifeq ($(target),linux-bc57)
|
|
##DEPMODE := XXX_linux ## FIXME
|
|
CC = bc++ -q -3
|
|
CFLAGS = -w '-w!'
|
|
CFLAGS_OUTPUT = -o$@
|
|
LDFLAGS += -ls
|
|
LINK_EXE_OUTPUT = -e$@
|
|
ifeq ($(WITH_ZLIB),1)
|
|
LDLIBS += -lz
|
|
endif
|
|
# warning: do not use option `-d' --> incorrect string merging will happen
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -dc
|
|
else
|
|
CFLAGS += -O2 -dc
|
|
endif
|
|
# transform `-lxx -lyy' into `libxx.a libyy.a'
|
|
LDLIBS := $(shell echo "$(LDLIBS)" | perl -pe 's/-l(.+?)\b/lib\1.a/g')
|
|
endif
|
|
|
|
|
|
###
|
|
### Linux cross compilers
|
|
###
|
|
|
|
ifeq ($(target),cross-amd64-linux)
|
|
include $(srcdir)/Makedefs.gcc
|
|
CC = x86_64-linux-gcc
|
|
CXX = x86_64-linux-g++
|
|
##LDLIBS += -lmcheck
|
|
endif # cross-amd64-linux
|
|
|
|
ifeq ($(target),cross-m68k-linux)
|
|
include $(srcdir)/Makedefs.gcc
|
|
CC = m68k-linux-gcc
|
|
CXX = m68k-linux-g++
|
|
##LDLIBS += -lmcheck
|
|
endif # cross-m68k-linux
|
|
|
|
|
|
###
|
|
### sparc-sun-solaris2.8
|
|
###
|
|
|
|
ifeq ($(target),sparc-sun-solaris)
|
|
include $(srcdir)/Makedefs.gcc
|
|
endif
|
|
|
|
|
|
###
|
|
### Atari cross compilers
|
|
###
|
|
|
|
ifeq ($(target),cross-mint)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .ttp
|
|
CC = m68k-atari-mint-gcc
|
|
CXX = m68k-atari-mint-g++
|
|
CCARCH += -m68000
|
|
endif
|
|
|
|
ifeq ($(target),cross-mint-m68040)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .ttp
|
|
CC = m68k-atari-mint-gcc
|
|
CXX = m68k-atari-mint-g++
|
|
CCARCH += -m68040
|
|
endif
|
|
|
|
ifeq ($(target),cross-mint-m68020-60)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .ttp
|
|
CC = m68k-atari-mint-gcc
|
|
CXX = m68k-atari-mint-g++
|
|
CCARCH += -m68020-60 -m68881
|
|
endif
|
|
|
|
|
|
###
|
|
### dos32 - djgpp2 / emx
|
|
###
|
|
|
|
ifeq ($(target),djgpp2)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CXX = gxx
|
|
CCARCH += -march=i386 -mcpu=i686
|
|
CFLAGS_WERROR = -Werror
|
|
STUBEDIT_EXE = stubedit $@ bufsize=0xfc00
|
|
ifneq ($(strip $(wildcard $(DJDIR)/bin/mfxdjstubify.ex[eE])),)
|
|
ifneq ($(strip $(wildcard $(DJDIR)/bin/cwsdstub.ex[eE])),)
|
|
STUBIFY_EXE = mfxdjstubify -v -s $(DJDIR)/bin/cwsdstub.exe $@
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(target),emx)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CXX = gcc
|
|
CFLAGS_O = -O2
|
|
CCARCH += -mno-probe
|
|
LDFLAGS = -L. -s
|
|
endif
|
|
|
|
|
|
###
|
|
### win32 - cygwin / mingw32 / rsxnt
|
|
###
|
|
|
|
ifeq ($(target),cygwin)
|
|
include $(srcdir)/Makedefs.gcc
|
|
##CXX = g++-2
|
|
e = .exe
|
|
CCARCH += -mcygwin -march=i386 -mcpu=i686
|
|
endif
|
|
|
|
ifeq ($(target),mingw32)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CCARCH += -mno-cygwin -march=i386 -mcpu=i686
|
|
endif
|
|
|
|
# mingw32 as included in cygwin
|
|
ifeq ($(target),no-cygwin)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CCARCH += -mno-cygwin -march=i386 -mcpu=i686
|
|
endif
|
|
|
|
# mingw32 cross compiler
|
|
ifeq ($(target),cross-mingw32)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CC = i586-mingw32msvc-gcc
|
|
CXX = i586-mingw32msvc-g++
|
|
CCARCH += -march=i386 -mcpu=i686
|
|
endif
|
|
|
|
# rsxnt (g++ 2.8.1)
|
|
ifeq ($(target),rsxnt)
|
|
include $(srcdir)/Makedefs.gcc
|
|
e = .exe
|
|
CXX = gcc
|
|
CFLAGS_O = -O2
|
|
CCARCH += -Zwin32 -Zsys -mno-probe
|
|
LDFLAGS = -L. -s
|
|
STUBEDIT_EXE = pestack -s1024 -c1024 $@
|
|
endif
|
|
|
|
|
|
###
|
|
### win32 - Borland C++
|
|
###
|
|
|
|
ifeq ($(target),bc)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = bcc32 -3
|
|
ifeq ($(UPX_BROKEN_INCLUDES),1)
|
|
ifneq ($(srcdir),.)
|
|
INCLUDES += -I$(srcdir)
|
|
endif
|
|
INCLUDES += -I$(srcdir)/acc
|
|
ifneq ($(strip $(wildcard $(srcdir)/filter)),)
|
|
INCLUDES += -I$(srcdir)/filter
|
|
endif
|
|
endif
|
|
CFLAGS = -w -w-inl -g1
|
|
CFLAGS_OUTPUT = -o$@
|
|
LDFLAGS = -ls
|
|
LINK_EXE_OUTPUT = -e$@
|
|
LDLIBS = $(DOS_LDLIBS)
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -d
|
|
else
|
|
CFLAGS += -O2 -d
|
|
endif
|
|
|
|
endif # bc
|
|
|
|
|
|
###
|
|
### win32 - Digital Mars C++
|
|
###
|
|
|
|
ifeq ($(target),dm)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = dmc -mn
|
|
CFLAGS = -w- -wx
|
|
CXXFLAGS = $(CFLAGS) -Aa -Ab -Ae -Ar
|
|
CFLAGS_OUTPUT = -o$@
|
|
LDFLAGS = -L/map
|
|
LINK_EXE_OUTPUT = -o$@
|
|
LDLIBS = $(DOS_LDLIBS)
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -o- -g -s
|
|
else
|
|
CFLAGS += -o
|
|
endif
|
|
|
|
endif # dm
|
|
|
|
|
|
###
|
|
### win32 - Intel C++
|
|
###
|
|
|
|
ifeq ($(target),ic)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = icl -nologo
|
|
CFLAGS = -W3 -WX
|
|
CXXFLAGS = $(CFLAGS) -EHac -GR
|
|
LDFLAGS =
|
|
LINK_EXE_OUTPUT = -Fe$@
|
|
LINK_EXE_LDFLAGS = /link /map:$T.map
|
|
##LINK_EXE_LDFLAGS += /verbose
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq (1,2)
|
|
# statically link libc.lib
|
|
CC += -ML
|
|
## DOS_LDLIBS := $(DOS_LDLIBS:.lib=_ml.lib)
|
|
else
|
|
# link against msvcrt.dll
|
|
CC += -MD
|
|
endif
|
|
LDLIBS = $(DOS_LDLIBS) setargv.obj
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -ZI
|
|
LINK_EXE_LDFLAGS += /debug
|
|
else
|
|
CFLAGS += -O1 -GF
|
|
LINK_EXE_LDFLAGS += /release
|
|
endif
|
|
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
|
|
|
|
endif # ic
|
|
|
|
|
|
###
|
|
### win32 - Symantec C++
|
|
###
|
|
|
|
ifeq ($(target),sc)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = sc -mn
|
|
CFLAGS = -w- -wx
|
|
CXXFLAGS = $(CFLAGS) -EH -ER
|
|
CFLAGS_OUTPUT = -o$@
|
|
LDFLAGS = -L/map
|
|
LINK_EXE_OUTPUT = -o$@
|
|
LDLIBS = $(DOS_LDLIBS)
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -o- -g -s
|
|
else
|
|
CFLAGS += -o
|
|
endif
|
|
|
|
endif # dm
|
|
|
|
|
|
###
|
|
### win32 - Visual C++
|
|
###
|
|
|
|
ifeq ($(target),vc)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = cl -nologo
|
|
CFLAGS = -W4 -WX
|
|
CXXFLAGS = $(CFLAGS) -EHac -GR
|
|
LDFLAGS =
|
|
LINK_EXE_OUTPUT = -Fe$@
|
|
LINK_EXE_LDFLAGS = /link /map:$T.map
|
|
##LINK_EXE_LDFLAGS += /verbose
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq (1,1)
|
|
# statically link libc.lib
|
|
CC += -ML
|
|
## DOS_LDLIBS := $(DOS_LDLIBS:.lib=_ml.lib)
|
|
else
|
|
# link against msvcrt.dll
|
|
CC += -MD
|
|
endif
|
|
LDLIBS = $(DOS_LDLIBS) setargv.obj
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -ZI
|
|
LINK_EXE_LDFLAGS += /debug
|
|
else
|
|
CFLAGS += -O1 -GF
|
|
LINK_EXE_LDFLAGS += /release
|
|
##LINK_EXE_LDFLAGS += /opt:nowin98
|
|
endif
|
|
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
|
|
|
|
endif # vc
|
|
|
|
|
|
###
|
|
### win32 - Watcom C++
|
|
###
|
|
|
|
ifeq ($(target),wc)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = wcl386 -zq -bt=nt -mf -5r
|
|
##CC = wcl386 -zq -bt=dos -l=CauseWay -mf -5r
|
|
CFLAGS = -zc -w5 -we
|
|
CXXFLAGS = $(CFLAGS) -xs -xr
|
|
CFLAGS_OUTPUT = -fo=$@
|
|
LDFLAGS = -k0x100000 -fm
|
|
LINK_EXE_OUTPUT = -fe=$@
|
|
LDLIBS = $(DOS_LDLIBS)
|
|
|
|
CC_SRC = $(subst /,\\,$<)
|
|
CXX_SRC = $(subst /,\\,$<)
|
|
INCLUDES := $(strip $(subst /,\\,$(INCLUDES)))
|
|
ifeq (1,2)
|
|
WCL386 := $(INCLUDES)
|
|
export WCL386
|
|
INCLUDES :=
|
|
endif
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS +=
|
|
else
|
|
# note: it seems that the optimizer is generating bad code with `-ox'
|
|
CFLAGS += -olr
|
|
endif
|
|
|
|
endif # wc
|
|
|
|
|
|
###
|
|
### win64 - Intel C++
|
|
###
|
|
|
|
ifeq ($(target),win64-ic)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = ecl -nologo
|
|
CFLAGS = -W3
|
|
CXXFLAGS = $(CFLAGS) -EHac -GR
|
|
LDFLAGS =
|
|
LINK_EXE_OUTPUT = -Fe$@
|
|
LINK_EXE_LDFLAGS = /link /map:$T.map
|
|
##LINK_EXE_LDFLAGS += /verbose
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq (1,2)
|
|
# statically link libc.lib
|
|
CC += -ML
|
|
## DOS_LDLIBS := $(DOS_LDLIBS:.lib=_ml.lib)
|
|
else
|
|
# link against msvcrt.dll
|
|
CC += -MD
|
|
endif
|
|
LDLIBS = $(DOS_LDLIBS) setargv.obj
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -ZI
|
|
LINK_EXE_LDFLAGS += /debug
|
|
else
|
|
CFLAGS += -O1 -GF
|
|
LINK_EXE_LDFLAGS += /release
|
|
endif
|
|
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
|
|
|
|
endif # win64-ic
|
|
|
|
|
|
###
|
|
### win64 - Visual C++
|
|
###
|
|
|
|
ifeq ($(target),win64-vc)
|
|
o = .obj
|
|
a = .lib
|
|
e = .exe
|
|
CC = cl -nologo
|
|
CFLAGS = -W4
|
|
CXXFLAGS = $(CFLAGS) -EHac -GR
|
|
LDFLAGS =
|
|
LINK_EXE_OUTPUT = -Fe$@
|
|
LINK_EXE_LDFLAGS = /link /map:$T.map
|
|
##LINK_EXE_LDFLAGS += /verbose
|
|
|
|
ifneq ($(strip $(DOS_LIBDIRS)),)
|
|
LIB := $(DOS_LIBDIRS);$(LIB)
|
|
endif
|
|
export LIB
|
|
|
|
ifeq (1,1)
|
|
# statically link libc.lib
|
|
CC += -ML
|
|
## DOS_LDLIBS := $(DOS_LDLIBS:.lib=_ml.lib)
|
|
else
|
|
# link against msvcrt.dll
|
|
CC += -MD
|
|
endif
|
|
LDLIBS = $(DOS_LDLIBS) setargv.obj
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -Od -ZI
|
|
LINK_EXE_LDFLAGS += /debug
|
|
else
|
|
CFLAGS += -O1 -GF
|
|
LINK_EXE_LDFLAGS += /release
|
|
endif
|
|
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
|
|
|
|
endif # win64-vc
|
|
|
|
|
|
# /***********************************************************************
|
|
# // malloc debuggers and memory checkers - somewhat obsolete, use valgrind
|
|
# ************************************************************************/
|
|
|
|
ifeq (1,2)
|
|
# compile in extra valgrind support
|
|
DEFS += -DWITH_VALGRIND
|
|
endif
|
|
|
|
ifeq (1,2)
|
|
LDLIBS += -lefence
|
|
endif
|
|
|
|
ifeq (1,2)
|
|
DEFS += -DWITH_DMALLOC
|
|
LDLIBS += -ldmalloc
|
|
endif
|
|
|
|
ifeq (1,2)
|
|
DEFS += -DWITH_GC -DLINUX_THREADS -D_REENTRANT
|
|
LDLIBS += -lgc -lpthread
|
|
# only needed when using -static:
|
|
##LDFLAGS += -Wl,-defsym,_DYNAMIC=0
|
|
endif
|
|
|
|
|
|
# /***********************************************************************
|
|
# // main targets
|
|
# ************************************************************************/
|
|
|
|
all: $(upx_exe)
|
|
|
|
$(upx_exe): $(OBJECTS) $(LIBS) $(RESOURCES)
|
|
$(strip $(CXX_LINK_EXE))
|
|
$(strip $(STUBEDIT_EXE))
|
|
$(strip $(STUBIFY_EXE))
|
|
$(strip $(CHMOD_EXE))
|
|
|
|
mostlyclean:
|
|
-rm -f *.d *.err *.i *.log *.map *~ gdb-trans*
|
|
|
|
clean: mostlyclean
|
|
-rm -f *.a *.lib *.o *.obj *.res *.tds tags TAGS ID
|
|
-rm -f *.idb *.pdb
|
|
-rm -f $(upx_exe) upx upx.exe upx.ttp upx_nrv upx_nrv.exe upx_nrv.ttp upx_ucl upx_ucl.exe upx_ucl.ttp
|
|
-rm -rf .deps _deps
|
|
|
|
distclean: clean
|
|
|
|
maintainer-clean: distclean
|
|
|
|
.PHONY: all mostlyclean clean distclean maintainer-clean
|
|
|
|
|
|
# /***********************************************************************
|
|
# // rules
|
|
# ************************************************************************/
|
|
|
|
%$o : %.c
|
|
$(strip $(CC_COMPILE))
|
|
|
|
%$o : %.cpp
|
|
$(strip $(CXX_COMPILE))
|
|
|
|
%.res : %.rc
|
|
rc -l 0x409 -fo$@ $<
|
|
|
|
|
|
# vi:nowrap
|