diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aba94c4d..2c920f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,13 +118,13 @@ jobs: run: | (cd build/extra/gcc/release && DESTDIR=$PWD/Install-with-cmake cmake --install .) (cd build/extra/gcc/release && DESTDIR=$PWD/Install-with-make make install) - - name: 'Run basic tests' + - name: 'Run ctest tests' run: | make -C build/extra/gcc/debug test make -C build/extra/gcc/release test make -C build/extra/clang/debug test make -C build/extra/clang/release test - - name: 'Run basic tests 32-bit' + - name: 'Run ctest tests 32-bit' if: ${{ matrix.use_m32 }} run: | make -C build/extra/gcc-m32/debug test @@ -152,6 +152,8 @@ jobs: - { os: macos-11, gcc: gcc-10, gxx: 'g++-10', testsuite: true } - { os: macos-12, gcc: gcc-11, gxx: 'g++-11', testsuite: true } - { os: macos-13, gcc: gcc-12, gxx: 'g++-12', testsuite: true } + env: + UPX_CONFIG_EXPECT_THREADS: 'ON' steps: - name: 'Install brew packages' if: ${{ matrix.testsuite }} @@ -203,7 +205,7 @@ jobs: run: | (cd build/extra/clang/release && DESTDIR=$PWD/Install-with-cmake cmake --install .) (cd build/extra/clang/release && DESTDIR=$PWD/Install-with-make make install) - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ !contains(matrix.os, 'macos-13') }} # FIXME: UPX on macos-13 is broken => disable self-test for now run: | make -C build/extra/clang/debug test @@ -236,6 +238,8 @@ jobs: include: - { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, arch: amd64 } - { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, arch: amd64 } + env: + UPX_CONFIG_EXPECT_THREADS: 'ON' steps: - run: git config --global core.autocrlf false - name: 'Check out code' @@ -265,7 +269,7 @@ jobs: with: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ matrix.arch != 'amd64_arm64' }} run: | ctest --test-dir build/debug -C Debug @@ -425,6 +429,7 @@ jobs: # { zig_target: x86_64-macos.13.0-none } - { zig_target: x86_64-windows-gnu } env: + UPX_CONFIG_EXPECT_THREADS: 'ON' # for zig-cc wrapper scripts (see below): ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING ZIG_FLAGS: ${{ matrix.zig_flags }} diff --git a/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml b/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml index b4512d9d..ebf617eb 100644 --- a/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml +++ b/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' jobs: job-cmake-macos-xcode: # uses cmake + xcodebuild @@ -44,7 +45,7 @@ jobs: with: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ matrix.run_test }} run: | ctest --test-dir build/xcode -C Debug diff --git a/.github/workflows/weekly-ci-bs-cmake-windows-make.yml b/.github/workflows/weekly-ci-bs-cmake-windows-make.yml index 69bd84a3..9d794d4c 100644 --- a/.github/workflows/weekly-ci-bs-cmake-windows-make.yml +++ b/.github/workflows/weekly-ci-bs-cmake-windows-make.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' UPX_CMAKE_BUILD_FLAGS: --verbose UPX_CMAKE_CONFIG_FLAGS: -G "Unix Makefiles" @@ -85,7 +86,7 @@ jobs: with: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ matrix.arch != 'amd64_arm64' }} shell: bash run: | diff --git a/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml b/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml index 02e8e2be..00e978ef 100644 --- a/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml +++ b/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' UPX_CMAKE_BUILD_FLAGS: --verbose UPX_CMAKE_CONFIG_FLAGS: -G Ninja @@ -84,7 +85,7 @@ jobs: with: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ matrix.arch != 'amd64_arm64' }} shell: bash run: | diff --git a/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml b/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml index 135e5402..976b2075 100644 --- a/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml +++ b/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' jobs: job-cmake-windows-nmake: # uses cmake + nmake @@ -44,7 +45,7 @@ jobs: shell: cmd run: | set X=${{ matrix.clang_cl && '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl' || '' }} - cmake -S . -B build/debug -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug %X% + cmake -S . -B build/debug -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug %X% cd build/debug nmake dir *.exe @@ -53,7 +54,7 @@ jobs: shell: cmd run: | set X=${{ matrix.clang_cl && '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl' || '' }} - cmake -S . -B build/release -G "NMake Makefiles" %X% + cmake -S . -B build/release -G "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON %X% cd build/release nmake dir *.exe @@ -71,7 +72,7 @@ jobs: with: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests' + - name: 'Run ctest tests' if: ${{ matrix.arch != 'amd64_arm64' }} run: | ctest --test-dir build/debug diff --git a/.github/workflows/weekly-ci-bs-misc.yml b/.github/workflows/weekly-ci-bs-misc.yml index 644586a4..727edb2c 100644 --- a/.github/workflows/weekly-ci-bs-misc.yml +++ b/.github/workflows/weekly-ci-bs-misc.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' UPX_CMAKE_BUILD_FLAGS: --verbose jobs: diff --git a/.github/workflows/weekly-ci-cc-alpine-linux.yml b/.github/workflows/weekly-ci-cc-alpine-linux.yml index dd09b064..f4c4c689 100644 --- a/.github/workflows/weekly-ci-cc-alpine-linux.yml +++ b/.github/workflows/weekly-ci-cc-alpine-linux.yml @@ -174,12 +174,12 @@ jobs: (cd "upx with space"/build/xtarget/gcc-static/release && DESTDIR="$PWD/Install with cmake" cmake --install .) (cd "upx with space"/build/xtarget/gcc-static/release && DESTDIR="$PWD/Install with make" make install) - - { name: 'Run basic tests clang Debug', run: 'make -C "upx with space"/build/xtarget/clang-static/debug test' } - - { name: 'Run basic tests clang Release', run: 'make -C "upx with space"/build/xtarget/clang-static/release test' } - - { name: 'Run basic tests gcc Debug', run: 'make -C "upx with space"/build/xtarget/gcc-static/debug test' } - - { name: 'Run basic tests gcc Release', run: 'make -C "upx with space"/build/xtarget/gcc-static/release test' } + - { name: 'Run ctest tests clang Debug', run: 'make -C "upx with space"/build/xtarget/clang-static/debug test' } + - { name: 'Run ctest tests clang Release', run: 'make -C "upx with space"/build/xtarget/clang-static/release test' } + - { name: 'Run ctest tests gcc Debug', run: 'make -C "upx with space"/build/xtarget/gcc-static/debug test' } + - { name: 'Run ctest tests gcc Release', run: 'make -C "upx with space"/build/xtarget/gcc-static/release test' } - - name: 'Run basic tests C++20, C++23 and LTO' + - name: 'Run ctest tests C++20, C++23 and LTO' if: matrix.use_cxx20 || matrix.use_cxx23 || matrix.use_cxx2b || matrix.use_lto run: | for dir in "upx with space"/build/xtarget/*-cxx*/*; do diff --git a/.github/workflows/weekly-ci-cc-alpine-mingw.yml b/.github/workflows/weekly-ci-cc-alpine-mingw.yml index 799b9367..c85485eb 100644 --- a/.github/workflows/weekly-ci-cc-alpine-mingw.yml +++ b/.github/workflows/weekly-ci-cc-alpine-mingw.yml @@ -10,6 +10,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' jobs: job-alpine-mingw: # uses cmake + make @@ -18,8 +19,8 @@ jobs: fail-fast: false matrix: include: - - { container: 'alpine:3.11', wine: false, i686_mingw: false } # skip Wine testsuite; TODO: internal error: doctest check failed - - { container: 'alpine:3.12', wine: false, i686_mingw: false } # skip Wine testsuite; TODO: internal error: doctest check failed + - { container: 'alpine:3.11', wine: true, i686_mingw: false } # wine-4.0.3 + - { container: 'alpine:3.12', wine: true, i686_mingw: false } # wine-4.0.3 - { container: 'alpine:3.13', wine: true, i686_mingw: false } # wine-4.0.3 - { container: 'alpine:3.14', wine: true, i686_mingw: false } # wine-6.18 - { container: 'alpine:3.15', wine: true, i686_mingw: false } # wine-6.23 @@ -27,7 +28,7 @@ jobs: - { container: 'alpine:3.17', wine: true, i686_mingw: false } # wine-7.21 # Wine >= 8.0 can run i686 32-bit programs in WOW64 mode on pure 64-bit systems - { container: 'alpine:3.18', wine: true, i686_mingw: true } # wine-8.13 - - { container: 'alpine:edge', wine: true, i686_mingw: true } # wine-8.17 + - { container: 'alpine:edge', wine: true, i686_mingw: true } # wine-8.19 name: ${{ format('container {0}', matrix.container) }} runs-on: ubuntu-latest container: ${{ matrix.container }} @@ -37,12 +38,17 @@ jobs: apk update && apk upgrade && apk add bash cmake coreutils file git make tar xz apk add mingw-w64-gcc test "${{ matrix.i686_mingw }}" = "true" && apk add i686-mingw-w64-gcc - test "${{ matrix.wine }}" = "true" && apk add wine true - - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} + - name: 'Install Wine' + if: ${{ matrix.wine }} run: | + apk add wine + test -f /usr/bin/wine || ln -s -v wine64 /usr/bin/wine # this seems to be needed for Wine when running in a container (beause of UID mismatch??) mkdir -p -v ~/.wine + wineboot --init + - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} + run: | # this seems to be needed when running in a container (beause of UID mismatch??) git config --global --add safe.directory '*' git clone --branch "$GITHUB_REF_NAME" --depth 1 "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" . @@ -89,7 +95,7 @@ jobs: run: | git clone --depth=1 https://github.com/upx/upx-testsuite ../upx-testsuite testsuite_1="$(readlink -fn ./misc/testsuite/upx_testsuite_1.sh)" - export upx_exe_runner="wine64" + export upx_exe_runner="wine" if test "${{ matrix.i686_mingw }}" = "true"; then UPX_TESTSUITE_LEVEL=2 \ env -C build/extra/cross-windows-mingw32/debug upx_exe=./upx.exe bash "$testsuite_1" @@ -109,7 +115,7 @@ jobs: cd build/extra/cross-windows-mingw32/debug [[ -f upx && ! -f upx.exe ]] && mv -i -v upx upx.exe pwd; file ./upx.exe - wine=wine64 + wine=wine tt='./upx.exe' $wine ./upx.exe --version-short $wine ./upx.exe --sysinfo -v @@ -128,7 +134,7 @@ jobs: cd build/extra/cross-windows-mingw32/release [[ -f upx && ! -f upx.exe ]] && mv -i -v upx upx.exe pwd; file ./upx.exe - wine=wine64 + wine=wine tt='./upx.exe' $wine ./upx.exe --version-short $wine ./upx.exe --sysinfo -v @@ -176,3 +182,19 @@ jobs: $wine ./upx.exe -d tt.packed.exe -o tt.unpacked.exe $wine ./tt.packed.exe --version-short $wine ./tt.unpacked.exe --version-short + + - name: 'Run ctest tests under Wine - mingw32/debug' + if: ${{ matrix.wine && matrix.i686_mingw }} + run: 'make -C build/extra/cross-windows-mingw32/debug test' + + - name: 'Run ctest tests under Wine - mingw32/release' + if: ${{ matrix.wine && matrix.i686_mingw }} + run: 'make -C build/extra/cross-windows-mingw32/release test' + + - name: 'Run ctest tests under Wine - mingw64/debug' + if: ${{ matrix.wine }} + run: 'make -C build/extra/cross-windows-mingw64/debug test' + + - name: 'Run ctest tests under Wine - mingw64/release' + if: ${{ matrix.wine }} + run: 'make -C build/extra/cross-windows-mingw64/release test' diff --git a/.github/workflows/weekly-ci-cc-llvm-mingw.yml b/.github/workflows/weekly-ci-cc-llvm-mingw.yml index 56a3afe4..e4f5ecc5 100644 --- a/.github/workflows/weekly-ci-cc-llvm-mingw.yml +++ b/.github/workflows/weekly-ci-cc-llvm-mingw.yml @@ -12,6 +12,7 @@ env: CMAKE_VERBOSE_MAKEFILE: 'ON' CTEST_OUTPUT_ON_FAILURE: 'ON' DEBIAN_FRONTEND: noninteractive + UPX_CONFIG_EXPECT_THREADS: 'ON' jobs: job-llvm-mingw: # uses cmake + make @@ -26,12 +27,12 @@ jobs: - name: llvm-mingw-20230614-ucrt llvm_version: 16.0.6 url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230614/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz' - - name: llvm-mingw-20231031-msvcrt - llvm_version: 17.0.4 - url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20231031/llvm-mingw-20231031-msvcrt-ubuntu-20.04-x86_64.tar.xz' - - name: llvm-mingw-20231031-ucrt - llvm_version: 17.0.4 - url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20231031/llvm-mingw-20231031-ucrt-ubuntu-20.04-x86_64.tar.xz' + - name: llvm-mingw-20231114-msvcrt + llvm_version: 17.0.5 + url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20231114/llvm-mingw-20231114-msvcrt-ubuntu-20.04-x86_64.tar.xz' + - name: llvm-mingw-20231114-ucrt + llvm_version: 17.0.5 + url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20231114/llvm-mingw-20231114-ucrt-ubuntu-20.04-x86_64.tar.xz' name: ${{ format('{0} {1}', matrix.name, matrix.llvm_version) }} runs-on: ubuntu-latest steps: @@ -53,24 +54,28 @@ jobs: run: | export CC="aarch64-w64-mingw32-clang -static" CXX="aarch64-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" + export CMAKE_SYSTEM_NAME=Windows make UPX_XTARGET=aarch64-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang armv7' if: success() || failure() # run this step even if the previous step failed run: | export CC="armv7-w64-mingw32-clang -static" CXX="armv7-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" + export CMAKE_SYSTEM_NAME=Windows make UPX_XTARGET=armv7-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang i686' if: success() || failure() # run this step even if the previous step failed run: | export CC="i686-w64-mingw32-clang -static" CXX="i686-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" + export CMAKE_SYSTEM_NAME=Windows # CMAKE_CROSSCOMPILING_EMULATOR=wine make UPX_XTARGET=i686-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang x86_64' if: success() || failure() # run this step even if the previous step failed run: | export CC="x86_64-w64-mingw32-clang -static" CXX="x86_64-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" + export CMAKE_SYSTEM_NAME=Windows # CMAKE_CROSSCOMPILING_EMULATOR=wine64 make UPX_XTARGET=x86_64-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Make artifact' run: | diff --git a/.github/workflows/weekly-ci-rt-checkers.yml b/.github/workflows/weekly-ci-rt-checkers.yml index fffd916b..acb38d6e 100644 --- a/.github/workflows/weekly-ci-rt-checkers.yml +++ b/.github/workflows/weekly-ci-rt-checkers.yml @@ -76,12 +76,12 @@ jobs: name: ${{ env.artifact_name }} path: tmp/artifact - - name: 'Run basic tests clang-static' + - name: 'Run ctest tests clang-static' run: 'make -C build/xtarget/clang-static/$release test' - - name: 'Run basic tests clang-asan' + - name: 'Run ctest tests clang-asan' if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: ASAN not supported run: 'make -C build/xtarget/clang-asan/$release test' - - name: 'Run basic tests clang-msan' + - name: 'Run ctest tests clang-msan' if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: MSAN not supported run: 'make -C build/xtarget/clang-msan/$release test' diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c207d04..050e7f4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,15 +119,12 @@ upx_cache_bool_vars(ON CMAKE_C_STANDARD_REQUIRED CMAKE_CXX_STANDARD_REQUIRED CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_REQUIRED_QUIET ) -# global CMake settings that default to OFF -upx_cache_bool_vars(OFF - CMAKE_VERBOSE_MAKEFILE -) # internal UPX settings that default to OFF upx_cache_bool_vars(OFF UPX_CONFIG_CMAKE_DISABLE_TEST UPX_CONFIG_CMAKE_DISABLE_INSTALL UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO UPX_CONFIG_CMAKE_DISABLE_PLATFORM_CHECK UPX_CONFIG_DISABLE_C_STANDARD UPX_CONFIG_DISABLE_CXX_STANDARD + UPX_CONFIG_EXPECT_THREADS UPX_CONFIG_REQUIRE_THREADS ) # determine Git revision @@ -673,6 +670,10 @@ endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO print_var(CMAKE_INSTALL_PREFIX CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE) if(Threads_FOUND) message(STATUS "WITH_THREADS = 1") +elseif(UPX_CONFIG_REQUIRE_THREADS) + message(FATAL_ERROR "ERROR: WITH_THREADS required") +elseif(UPX_CONFIG_EXPECT_THREADS AND NOT UPX_CONFIG_DISABLE_THREADS) + message(FATAL_ERROR "ERROR: WITH_THREADS expected") endif() if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|None|Release)$") message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"") diff --git a/Makefile b/Makefile index 401ba676..6d302bf0 100644 --- a/Makefile +++ b/Makefile @@ -63,8 +63,9 @@ include ./misc/make/Makefile-extra.mk endif # developer convenience +CTEST = ctest test: $(.DEFAULT_GOAL) - cd $(.DEFAULT_GOAL) && ctest + cd $(.DEFAULT_GOAL) && $(CTEST) ifneq ($(wildcard /usr/bin/env),) # needs bash, perl, xargs, etc. check-whitespace clang-format run-testsuite run-testsuite-debug run-testsuite-release: PHONY src/Makefile $(MAKE) -C src $@ diff --git a/misc/make/Makefile-extra.mk b/misc/make/Makefile-extra.mk index fffe5b22..720bae22 100644 --- a/misc/make/Makefile-extra.mk +++ b/misc/make/Makefile-extra.mk @@ -124,46 +124,46 @@ build/extra/cross-linux-gnu-aarch64/debug: PHONY; $(call run_config_and_build, build/extra/cross-linux-gnu-aarch64/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-linux-gnu-aarch64/%: export CC = aarch64-linux-gnu-gcc build/extra/cross-linux-gnu-aarch64/%: export CXX = aarch64-linux-gnu-g++ -build/extra/cross-linux-gnu-aarch64/%: CMAKE_SYSTEM_NAME = Linux -build/extra/cross-linux-gnu-aarch64/%: CMAKE_CROSSCOMPILING_EMULATOR = qemu-aarch64 +build/extra/cross-linux-gnu-aarch64/%: CMAKE_SYSTEM_NAME ?= Linux +build/extra/cross-linux-gnu-aarch64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= qemu-aarch64 # cross compiler: Linux glibc arm-linux-gnueabihf build/extra/cross-linux-gnu-arm-eabihf/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-linux-gnu-arm-eabihf/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-linux-gnu-arm-eabihf/%: export CC = arm-linux-gnueabihf-gcc build/extra/cross-linux-gnu-arm-eabihf/%: export CXX = arm-linux-gnueabihf-g++ -Wno-psabi -build/extra/cross-linux-gnu-arm-eabihf/%: CMAKE_SYSTEM_NAME = Linux -build/extra/cross-linux-gnu-arm-eabihf/%: CMAKE_CROSSCOMPILING_EMULATOR = qemu-arm +build/extra/cross-linux-gnu-arm-eabihf/%: CMAKE_SYSTEM_NAME ?= Linux +build/extra/cross-linux-gnu-arm-eabihf/%: CMAKE_CROSSCOMPILING_EMULATOR ?= qemu-arm # cross compiler: Windows x86 win32 MinGW (i386) build/extra/cross-windows-mingw32/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-windows-mingw32/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-windows-mingw32/%: export CC = i686-w64-mingw32-gcc -static -D_WIN32_WINNT=0x0400 build/extra/cross-windows-mingw32/%: export CXX = i686-w64-mingw32-g++ -static -D_WIN32_WINNT=0x0400 -build/extra/cross-windows-mingw32/%: CMAKE_SYSTEM_NAME = Windows -build/extra/cross-windows-mingw32/%: CMAKE_CROSSCOMPILING_EMULATOR = wine +build/extra/cross-windows-mingw32/%: CMAKE_SYSTEM_NAME ?= Windows +build/extra/cross-windows-mingw32/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine # cross compiler: Windows x64 win64 MinGW (amd64) build/extra/cross-windows-mingw64/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-windows-mingw64/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-windows-mingw64/%: export CC = x86_64-w64-mingw32-gcc -static -D_WIN32_WINNT=0x0400 build/extra/cross-windows-mingw64/%: export CXX = x86_64-w64-mingw32-g++ -static -D_WIN32_WINNT=0x0400 -build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_NAME = Windows -build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR = wine +build/extra/cross-windows-mingw64/%: CMAKE_SYSTEM_NAME ?= Windows +build/extra/cross-windows-mingw64/%: CMAKE_CROSSCOMPILING_EMULATOR ?= wine64 # cross compiler: macOS arm64 (aarch64) build/extra/cross-darwin-arm64/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-darwin-arm64/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-darwin-arm64/%: export CC = clang -target arm64-apple-darwin build/extra/cross-darwin-arm64/%: export CXX = clang++ -target arm64-apple-darwin -build/extra/cross-darwin-arm64/%: CMAKE_SYSTEM_NAME = Darwin +build/extra/cross-darwin-arm64/%: CMAKE_SYSTEM_NAME ?= Darwin # cross compiler: macOS x86_64 (amd64) build/extra/cross-darwin-x86_64/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-darwin-x86_64/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/cross-darwin-x86_64/%: export CC = clang -target x86_64-apple-darwin build/extra/cross-darwin-x86_64/%: export CXX = clang++ -target x86_64-apple-darwin -build/extra/cross-darwin-x86_64/%: CMAKE_SYSTEM_NAME = Darwin +build/extra/cross-darwin-x86_64/%: CMAKE_SYSTEM_NAME ?= Darwin #*********************************************************************** # C/C++ static analyzers @@ -239,6 +239,8 @@ ifneq ($(origin UPX_CMAKE_CONFIG_FLAGS),command line) # needed to work around a # it easy to set other variables like CMAKE_AR or CMAKE_RANLIB __add_cmake_config = $(and $($1),-D$1="$($1)") # pass common CMake settings from environment/make to cmake +build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE) +# pass common CMake toolchain settings from environment/make to cmake build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_AR) build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_NM) build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB) diff --git a/src/Makefile b/src/Makefile index be822b46..a99ad64c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,9 +3,8 @@ # Copyright (C) Markus Franz Xaver Johannes Oberhumer # -# NOTE: this Makefile is deprecated - please directly use the CMake build -# instead. And see the top-level Makefile for some pre-defined CMake -# build configurations. +# NOTE: this Makefile is deprecated - please directly use +# the top-level CMake build instead. ifndef srcdir srcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))