summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2023-08-04 01:08:27 +0200
committeraristocratos <gnmjpl@gmail.com>2023-08-04 01:08:27 +0200
commit1b126f55e38de76a2cca796593ef1554828d61e6 (patch)
tree7ff4e7e479e9ce2948ccca9b0b6295e24386f224
parentc8ec6bbb000a865f14c50414e456955c473a2f3a (diff)
Update Makefile for partial static compilation on freebsd
-rw-r--r--Makefile11
-rw-r--r--README.md2
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index f3e1467..bf65595 100644
--- a/Makefile
+++ b/Makefile
@@ -92,15 +92,17 @@ ifneq ($(PLATFORM) $(ARCH),macos arm64)
endif
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)
$(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m"))
endif
else
override ADDFLAGS += -static-libgcc -static-libstdc++
endif
- ifneq ($(PLATFORM),macos)
+ ifeq ($(PLATFORM_LC),linux)
override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings
+ else ifeq ($(PLATFORM_LC),freebsd)
+ override ADDFLAGS += -DSTATIC_BUILD
endif
endif
@@ -123,7 +125,10 @@ else ifeq ($(PLATFORM_LC),freebsd)
PLATFORM_DIR := freebsd
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
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
else ifeq ($(PLATFORM_LC),macos)
PLATFORM_DIR := osx
diff --git a/README.md b/README.md
index a28cbe9..2eecb90 100644
--- a/README.md
+++ b/README.md
@@ -510,6 +510,8 @@ Also needs a UTF8 locale and a font that covers:
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 `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag).