aboutsummaryrefslogtreecommitdiff
path: root/mk/lib.mk
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-10-14 20:07:20 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-10-14 20:07:20 +0000
commit7869be49c2735280ceabbd13c087b4a06444ae63 (patch)
treea93530cdfba9f3056f727de26548c71157de19e5 /mk/lib.mk
parent2dd11f07808c8b86513260b85f35a70cbe9b1249 (diff)
parent4c0cde95ad8dc95f876e5cf32790e73e08f49b28 (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
Diffstat (limited to 'mk/lib.mk')
-rw-r--r--mk/lib.mk40
1 files changed, 24 insertions, 16 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
index a09ebaa97..92f0983d5 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -10,8 +10,25 @@ bin-scripts :=
noinst-scripts :=
man-pages :=
install-tests :=
-OS = $(shell uname -s)
+ifdef HOST_OS
+ HOST_KERNEL = $(firstword $(subst -, ,$(HOST_OS)))
+ ifeq ($(HOST_KERNEL), cygwin)
+ HOST_CYGWIN = 1
+ endif
+ ifeq ($(patsubst darwin%,,$(HOST_KERNEL)),)
+ HOST_DARWIN = 1
+ endif
+ ifeq ($(patsubst freebsd%,,$(HOST_KERNEL)),)
+ HOST_FREEBSD = 1
+ endif
+ ifeq ($(HOST_KERNEL), linux)
+ HOST_LINUX = 1
+ endif
+ ifeq ($(patsubst solaris%,,$(HOST_KERNEL)),)
+ HOST_SOLARIS = 1
+ endif
+endif
# Hack to define a literal space.
space :=
@@ -31,7 +48,6 @@ libdir ?= $(prefix)/lib
bindir ?= $(prefix)/bin
libexecdir ?= $(prefix)/libexec
datadir ?= $(prefix)/share
-jardir ?= $(datadir)/java
localstatedir ?= $(prefix)/var
sysconfdir ?= $(prefix)/etc
mandir ?= $(prefix)/share/man
@@ -51,16 +67,16 @@ endif
BUILD_SHARED_LIBS ?= 1
ifeq ($(BUILD_SHARED_LIBS), 1)
- ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+ ifdef HOST_CYGWIN
GLOBAL_CFLAGS += -U__STRICT_ANSI__ -D_GNU_SOURCE
GLOBAL_CXXFLAGS += -U__STRICT_ANSI__ -D_GNU_SOURCE
else
GLOBAL_CFLAGS += -fPIC
GLOBAL_CXXFLAGS += -fPIC
endif
- ifneq ($(OS), Darwin)
- ifneq ($(OS), SunOS)
- ifneq ($(OS), FreeBSD)
+ ifndef HOST_DARWIN
+ ifndef HOST_SOLARIS
+ ifndef HOST_FREEBSD
GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries
endif
endif
@@ -74,7 +90,6 @@ BUILD_DEBUG ?= 1
ifeq ($(BUILD_DEBUG), 1)
GLOBAL_CFLAGS += -g
GLOBAL_CXXFLAGS += -g
- GLOBAL_JAVACFLAGS += -g
endif
@@ -84,7 +99,6 @@ include mk/clean.mk
include mk/install.mk
include mk/libraries.mk
include mk/programs.mk
-include mk/jars.mk
include mk/patterns.mk
include mk/templates.mk
include mk/tests.mk
@@ -102,7 +116,6 @@ $(foreach mf, $(makefiles), $(eval $(call include-sub-makefile, $(mf))))
# Instantiate stuff.
$(foreach lib, $(libraries), $(eval $(call build-library,$(lib))))
$(foreach prog, $(programs), $(eval $(call build-program,$(prog))))
-$(foreach jar, $(jars), $(eval $(call build-jar,$(jar))))
$(foreach script, $(bin-scripts), $(eval $(call install-program-in,$(script),$(bindir))))
$(foreach script, $(bin-scripts), $(eval programs-list += $(script)))
$(foreach script, $(noinst-scripts), $(eval programs-list += $(script)))
@@ -113,7 +126,7 @@ $(foreach file, $(man-pages), $(eval $(call install-data-in, $(file), $(mandir)/
.PHONY: default all man help
-all: $(programs-list) $(libs-list) $(jars-list) $(man-pages)
+all: $(programs-list) $(libs-list) $(man-pages)
man: $(man-pages)
@@ -138,12 +151,6 @@ ifdef libs-list
@echo ""
@for i in $(libs-list); do echo " $$i"; done
endif
-ifdef jars-list
- @echo ""
- @echo "The following JARs can be built:"
- @echo ""
- @for i in $(jars-list); do echo " $$i"; done
-endif
@echo ""
@echo "The following variables control the build:"
@echo ""
@@ -153,4 +160,5 @@ endif
@echo " CFLAGS: Flags for the C compiler"
@echo " CXX ($(CXX)): C++ compiler to be used"
@echo " CXXFLAGS: Flags for the C++ compiler"
+ @echo " CPPFLAGS: C preprocessor flags, used for both CC and CXX"
@$(print-var-help)