mirror of
https://github.com/upx/upx.git
synced 2025-08-07 22:46:51 +08:00
all: simplify include path handling; update src/Makefile
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -238,7 +238,7 @@ jobs:
|
||||
set s=%H%\upx\src
|
||||
cat .GITREV.txt
|
||||
set /p GITREV=<.GITREV.txt
|
||||
cl -MT -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -I%H%\upx\vendor\doctest -I%H%\upx\vendor\lzma-sdk -I%H%\upx\vendor\ucl\include -I%H%\upx\vendor\zlib -Feupx.exe %s%\*.cpp %s%\util\*.cpp %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
|
||||
cl -MT -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -I%H%\upx\vendor -Feupx.exe %s%\*.cpp %s%\util\*.cpp %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
|
||||
- name: 'Make artifact'
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -136,8 +136,7 @@ else()
|
||||
endif()
|
||||
|
||||
set(t upx)
|
||||
target_include_directories(${t} PRIVATE vendor/doctest vendor/ucl/include vendor/zlib)
|
||||
set_source_files_properties(src/compress_lzma.cpp PROPERTIES COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/vendor/lzma-sdk")
|
||||
target_include_directories(${t} PRIVATE vendor)
|
||||
target_compile_definitions(${t} PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
|
||||
if(GITREV_SHORT)
|
||||
target_compile_definitions(${t} PRIVATE UPX_VERSION_GITREV="${GITREV_SHORT}${GITREV_PLUS}")
|
||||
|
40
src/Makefile
40
src/Makefile
@ -2,7 +2,8 @@
|
||||
# UPX Makefile - needs GNU make
|
||||
#
|
||||
|
||||
# NOTE: this Makefile is deprecated, please use the CMake build instead !
|
||||
# IMPORTANT NOTE: this Makefile is deprecated and won't work
|
||||
# any longer - please use the CMake build instead!
|
||||
|
||||
MAKEFLAGS += -r
|
||||
.SUFFIXES:
|
||||
@ -11,7 +12,7 @@ export SHELL = /bin/sh
|
||||
# build configuration options for this Makefile
|
||||
BUILD_TYPE_DEBUG ?= 0
|
||||
BUILD_TYPE_SANITIZE ?= 0
|
||||
BUILD_USE_DEPEND ?= 1
|
||||
BUILD_USE_DEPEND ?= 0
|
||||
|
||||
ifndef srcdir
|
||||
srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
@ -26,6 +27,18 @@ ifneq ($(srcdir),.)
|
||||
vpath %.h .:$(srcdir)
|
||||
endif
|
||||
|
||||
# redirect to CMake build
|
||||
ifeq ($(BUILD_TYPE_DEBUG),1)
|
||||
default: $(top_srcdir)/build/debug/upx
|
||||
else
|
||||
default: $(top_srcdir)/build/release/upx
|
||||
endif
|
||||
.PHONY: default
|
||||
$(top_srcdir)/build/debug/upx:
|
||||
$(MAKE) -C $(top_srcdir) build/debug
|
||||
$(top_srcdir)/build/release/upx:
|
||||
$(MAKE) -C $(top_srcdir) build/release
|
||||
|
||||
# check git submodules
|
||||
ifeq ($(wildcard $(top_srcdir)/vendor/doctest/doctest/.),)
|
||||
$(error ERROR: missing git submodule; run 'git submodule update --init')
|
||||
@ -66,16 +79,8 @@ ifneq ($(GITREV_SHORT),)
|
||||
endif
|
||||
endif
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/vendor/doctest
|
||||
# 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))))
|
||||
else
|
||||
# please use the CMake build
|
||||
##INCLUDES += -I$(top_srcdir)/vendor/ucl/include
|
||||
endif
|
||||
LIBS += -lucl -lz
|
||||
INCLUDES += -I$(top_srcdir)/vendor
|
||||
LIBS += -lupx_vendor_ucl -lupx_vendor_zlib
|
||||
|
||||
# default flags that you can change or override
|
||||
ifeq ($(BUILD_TYPE_DEBUG),1)
|
||||
@ -136,7 +141,6 @@ upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
||||
$(strip $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ -E $<)
|
||||
|
||||
# object overrides
|
||||
compress_lzma$(objext) : INCLUDES += -I$(top_srcdir)/vendor/lzma-sdk
|
||||
# these are the only 2 objects that are actually speed-sensitive
|
||||
compress_lzma$(objext) : override CXXFLAGS_SANITIZE =
|
||||
filteri$(objext) : override CXXFLAGS_SANITIZE =
|
||||
@ -146,7 +150,6 @@ ifeq ($(BUILD_USE_DEPEND),1)
|
||||
@rm -f $@
|
||||
@echo "Updating $@"
|
||||
@$(strip $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -MM) $(filter %.cpp,$^) > $@
|
||||
./.depend : INCLUDES += -I$(top_srcdir)/vendor/lzma-sdk
|
||||
else
|
||||
./.depend:
|
||||
.PHONY: ./.depend
|
||||
@ -185,7 +188,9 @@ endif
|
||||
# you also can override upx_testsuite_SRCDIR
|
||||
ifndef upx_testsuite_SRCDIR
|
||||
# search standard locations below $(top_srcdir)
|
||||
ifneq ($(wildcard $(top_srcdir)/../upx-testsuite.git/files/packed/.),)
|
||||
ifneq ($(wildcard $(top_srcdir)/../upx--upx-testsuite.git/files/packed/.),)
|
||||
upx_testsuite_SRCDIR := $(top_srcdir)/../upx--upx-testsuite.git
|
||||
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite.git/files/packed/.),)
|
||||
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite.git
|
||||
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite/files/packed/.),)
|
||||
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite
|
||||
@ -196,10 +201,11 @@ endif
|
||||
# The actual (new) checksums are in tmp-testsuite/testsuite_1/.sha256sums.recreate
|
||||
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
|
||||
ifneq ($(wildcard $(top_srcdir)/.github/travis_testsuite_1.sh),)
|
||||
run-testsuite: export upx_exe := ./upx$(exeext)
|
||||
run-testsuite: export upx_exe := $(top_srcdir)/build/release/upx
|
||||
run-testsuite: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
||||
run-testsuite: export upx_testsuite_BUILDDIR := ./tmp-testsuite
|
||||
run-testsuite: upx$(exeext)
|
||||
run-testsuite: export UPX_DEBUG_DOCTEST_VERBOSE := 0
|
||||
run-testsuite: $(top_srcdir)/build/release/upx
|
||||
time -p bash $(top_srcdir)/.github/travis_testsuite_1.sh
|
||||
.PHONY: run-testsuite
|
||||
endif
|
||||
|
@ -232,9 +232,9 @@ error:
|
||||
#undef _NO_EXCEPTIONS
|
||||
#undef NULL
|
||||
#define NULL nullptr
|
||||
#include "C/Common/MyInitGuid.h"
|
||||
//#include "C/7zip/Compress/LZMA/LZMADecoder.h"
|
||||
#include "C/7zip/Compress/LZMA/LZMAEncoder.h"
|
||||
#include <lzma-sdk/C/Common/MyInitGuid.h>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.h>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.h>
|
||||
|
||||
namespace MyLzma {
|
||||
|
||||
@ -302,16 +302,16 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
|
||||
|
||||
} // namespace
|
||||
|
||||
#include "C/Common/Alloc.cpp"
|
||||
#include "C/Common/CRC.cpp"
|
||||
//#include "C/7zip/Common/InBuffer.cpp"
|
||||
#include "C/7zip/Common/OutBuffer.cpp"
|
||||
#include "C/7zip/Common/StreamUtils.cpp"
|
||||
#include "C/7zip/Compress/LZ/LZInWindow.cpp"
|
||||
//#include "C/7zip/Compress/LZ/LZOutWindow.cpp"
|
||||
//#include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
|
||||
#include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
||||
#include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
||||
#include <lzma-sdk/C/Common/Alloc.cpp>
|
||||
#include <lzma-sdk/C/Common/CRC.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Common/InBuffer.cpp>
|
||||
#include <lzma-sdk/C/7zip/Common/OutBuffer.cpp>
|
||||
#include <lzma-sdk/C/7zip/Common/StreamUtils.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZ/LZInWindow.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZ/LZOutWindow.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp>
|
||||
#undef RC_NORMALIZE
|
||||
|
||||
|
||||
@ -422,8 +422,8 @@ error:
|
||||
#undef _LZMA_OUT_READ
|
||||
#undef _LZMA_PROB32
|
||||
#undef _LZMA_LOC_OPT
|
||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA_C/LzmaDecode.h>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA_C/LzmaDecode.c>
|
||||
|
||||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||
upx_bytep dst, unsigned* dst_len,
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "conf.h"
|
||||
#include "compress.h"
|
||||
#include "util/membuffer.h"
|
||||
#include <zlib.h>
|
||||
#include <zlib/zlib.h>
|
||||
#include <zlib/deflate.h>
|
||||
|
||||
|
||||
void zlib_compress_config_t::reset()
|
||||
@ -102,6 +103,7 @@ int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
||||
mem_level, strategy);
|
||||
if (zr != Z_OK)
|
||||
goto error;
|
||||
assert(s.state->level == level);
|
||||
zr = deflate(&s, Z_FINISH);
|
||||
if (zr != Z_STREAM_END)
|
||||
goto error;
|
||||
|
@ -161,11 +161,8 @@ typedef unsigned char upx_byte;
|
||||
#define WITH_ZLIB 1
|
||||
#if (WITH_UCL)
|
||||
# define ucl_compress_config_t REAL_ucl_compress_config_t
|
||||
# include <ucl/uclconf.h>
|
||||
# include <ucl/ucl.h>
|
||||
# if !defined(UCL_VERSION) || (UCL_VERSION < 0x010300L)
|
||||
# error "please upgrade your UCL installation"
|
||||
# endif
|
||||
# include <ucl/include/ucl/uclconf.h>
|
||||
# include <ucl/include/ucl/ucl.h>
|
||||
# undef ucl_compress_config_t
|
||||
# undef ucl_compress_config_p
|
||||
#endif
|
||||
@ -740,7 +737,7 @@ unsigned membuffer_get_size(MemBuffer &mb);
|
||||
#include "util/xspan.h"
|
||||
|
||||
//#define DOCTEST_CONFIG_DISABLE 1
|
||||
#include <doctest/parts/doctest_fwd.h>
|
||||
#include <doctest/doctest/parts/doctest_fwd.h>
|
||||
|
||||
// util/dt_check.cpp
|
||||
void upx_compiler_sanity_check();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "packer.h"
|
||||
#include "p_vmlinz.h"
|
||||
#include "linker.h"
|
||||
#include <zlib.h>
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
static const
|
||||
#include "stub/i386-linux.kernel.vmlinuz.h"
|
||||
|
@ -38,7 +38,7 @@
|
||||
#endif
|
||||
#define DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
|
||||
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||
#include <doctest/parts/doctest.cpp>
|
||||
#include <doctest/doctest/parts/doctest.cpp>
|
||||
#endif
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
Reference in New Issue
Block a user