Update Makefile for partial static compilation on freebsd

This commit is contained in:
aristocratos 2023-08-04 01:08:27 +02:00
parent c8ec6bbb00
commit 1b126f55e3
2 changed files with 10 additions and 3 deletions

View File

@ -92,15 +92,17 @@ ifneq ($(PLATFORM) $(ARCH),macos arm64)
endif endif
ifeq ($(STATIC),true) ifeq ($(STATIC),true)
ifeq ($(CXX_IS_CLANG),true) ifeq ($(CXX_IS_CLANG) $(CLANG_WORKS),true true)
ifeq ($(shell $(CXX) -print-target-triple | grep gnu >/dev/null; echo $$?),0) ifeq ($(shell $(CXX) -print-target-triple | grep gnu >/dev/null; echo $$?),0)
$(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m")) $(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m"))
endif endif
else else
override ADDFLAGS += -static-libgcc -static-libstdc++ override ADDFLAGS += -static-libgcc -static-libstdc++
endif endif
ifneq ($(PLATFORM),macos) ifeq ($(PLATFORM_LC),linux)
override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings
else ifeq ($(PLATFORM_LC),freebsd)
override ADDFLAGS += -DSTATIC_BUILD
endif endif
endif endif
@ -123,7 +125,10 @@ else ifeq ($(PLATFORM_LC),freebsd)
PLATFORM_DIR := freebsd PLATFORM_DIR := freebsd
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1) THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
SU_GROUP := wheel SU_GROUP := wheel
override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR) override ADDFLAGS += -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
ifneq ($(STATIC),true)
override ADDFLAGS += -lstdc++
endif
export MAKE = gmake export MAKE = gmake
else ifeq ($(PLATFORM_LC),macos) else ifeq ($(PLATFORM_LC),macos)
PLATFORM_DIR := osx PLATFORM_DIR := osx

View File

@ -510,6 +510,8 @@ Also needs a UTF8 locale and a font that covers:
Append `VERBOSE=true` to display full compiler/linker commands. Append `VERBOSE=true` to display full compiler/linker commands.
Append `STATIC=true` for static compilation (only libgcc and libstdc++ will be static!).
Append `QUIET=true` for less verbose output. Append `QUIET=true` for less verbose output.
Append `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag). Append `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag).