diff --git a/src/Makefile b/src/Makefile index 410ea2fa..0eceaaab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,10 +15,12 @@ VPATH := . $(srcdir) endif ifeq ($(CXX),) -USE_GNUC = 1 CXX = g++ endif -ifneq ($(USE_GNUC),) +ifeq ($(firstword $(CXX)),g++) +USE_GNUC ?= 1 +endif +ifeq ($(USE_GNUC),1) CXXFLAGS += -O2 -MMD CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Werror endif @@ -29,15 +31,17 @@ exeext ?= .out libext ?= .a objext ?= .o -# we need UCL and zlib - you can set envvar UCLDIR -ifneq ($(wildcard $(UCLDIR)/include/ucl/ucl.h),) -INCLUDES += -I$(UCLDIR)/include -LIBS += $(addprefix -L,$(dir $(wildcard $(UCLDIR)/libucl$(libext) $(UCLDIR)/src/.libs/libucl$(libext)))) -endif -ifneq ($(wildcard $(LZMADIR)/include/ucl/ucl.h),) -INCLUDES += -I$(LZMADIR) +# 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 lzma443.tar.bz2 +ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip),) +DEFS += -DWITH_LZMA +INCLUDES += -I$(LZMADIR) +endif upx_SOURCES := $(wildcard $(srcdir)/*.cpp) upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext))) @@ -52,8 +56,11 @@ upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES) %.o : %.cpp $(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<) -ifneq ($(USE_GNUC),) -compress.o : CXXFLAGS += -Wno-non-virtual-dtor +ifeq ($(USE_GNUC),1) +compress_lzma$(objext) : EXTRA_CXXFLAGS += -Wno-cast-qual +compress_lzma$(objext) : EXTRA_CXXFLAGS += -Wno-non-virtual-dtor +compress_lzma$(objext) : EXTRA_CXXFLAGS += -Wno-unused +##compress_lzma$(objext) : EXTRA_CXXFLAGS += -Wno-error endif mostlyclean clean distclean maintainer-clean: diff --git a/src/stub/Makefile b/src/stub/Makefile index d50228d2..e7953c4f 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -8,12 +8,12 @@ MAKEFLAGS += -rR SHELL = /bin/sh -ifeq ($(strip $(UCLDIR)),) +ifeq ($(strip $(UPX_UCLDIR)),) # change this to reflect where the UCL library is -UCLDIR = $(HOME)/local/src/ucl-1.03 +UPX_UCLDIR = $(HOME)/local/src/ucl-1.03 endif -ifeq ($(wildcard $(UCLDIR)/upx),) -$(error Please set UCLDIR in Makefile or environment) +ifeq ($(wildcard $(UPX_UCLDIR)/upx),) +$(error Please set UPX_UCLDIR in Makefile or environment) endif # update path for our special stub build tools @@ -68,10 +68,10 @@ MAKEFILE_DEPS = $(MAKEFILE_LIST) # // source directories # ************************************************************************/ -UCL_UPX = $(UCLDIR)/upx -UCL_I386 = $(UCLDIR)/upx/i386 -UCL_M68K = $(UCLDIR)/upx/m68k -UCL_MR3K = $(UCLDIR)/upx/mr3k +UCL_UPX = $(UPX_UCLDIR)/upx +UCL_I386 = $(UPX_UCLDIR)/upx/i386 +UCL_M68K = $(UPX_UCLDIR)/upx/m68k +UCL_MR3K = $(UPX_UCLDIR)/upx/mr3k .SUFFIXES: .SUFFIXES: .asm .ash .asx .asy .bin .c .h .s