summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-04-30 11:56:05 +0100
committerVincent Sanders <vince@kyllikki.org>2014-04-30 11:56:57 +0100
commit56b42943d0ad0d032b2219290a2b7a02fa598466 (patch)
tree4c7b4eb8123aa875ecfbc3fe5f954b7d1816d32e /Makefile
parent1822b7c1633671cd41e60a04f7eeaf86dcec4141 (diff)
downloadnetsurf-56b42943d0ad0d032b2219290a2b7a02fa598466.tar.gz
netsurf-56b42943d0ad0d032b2219290a2b7a02fa598466.tar.bz2
improve iconv library handling
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 36 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4f9380a8b..864c5bd32 100644
--- a/Makefile
+++ b/Makefile
@@ -314,6 +314,8 @@ DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
+# A macro that conditionaly adds flags to the build when a feature is enabled.
+#
# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
# 2: Parameters to add to CFLAGS
# 3: Parameters to add to LDFLAGS
@@ -335,6 +337,33 @@ define feature_enabled
endif
endef
+# A macro that conditionaly adds flags to the build with a uniform display.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Human-readable name for the feature
+# 3: Parameters to add to CFLAGS when enabled
+# 4: Parameters to add to LDFLAGS when enabled
+# 5: Parameters to add to CFLAGS when disabled
+# 6: Parameters to add to LDFLAGS when disabled
+define feature_switch
+ ifeq ($$(NETSURF_USE_$(1)),YES)
+ CFLAGS += $(3)
+ LDFLAGS += $(4)
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info M.CONFIG: $(2) enabled (NETSURF_USE_$(1) := YES))
+ endif
+ else ifeq ($$(NETSURF_USE_$(1)),NO)
+ CFLAGS += $(5)
+ LDFLAGS += $(6)
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info M.CONFIG: $(2) disabled (NETSURF_USE_$(1) := NO))
+ endif
+ else
+ $$(info M.CONFIG: $(4) error (NETSURF_USE_$(1) := $$(NETSURF_USE_$(1))))
+ $$(error NETSURF_USE_$(1) must be YES or NO)
+ endif
+endef
+
# Extend flags with appropriate values from pkg-config for enabled features
#
# 1: pkg-config required modules for feature
@@ -431,10 +460,14 @@ endif
# Pull in the configuration
include Makefile.defaults
-$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg,JPEG (libjpeg)))
+# Build flags for libjpeg as it has no pkgconfig file
+$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
+
+# Build flags for haru
+$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
-$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng,PDF export (haru)))
-$(eval $(call feature_enabled,LIBICONV_PLUG,-DLIBICONV_PLUG,,glibc internal iconv))
+# Build flags for iconv
+$(eval $(call feature_switch,LIBICONV_PLUG,glibc internal iconv,-DLIBICONV_PLUG,,-ULIBICONV_PLUG,-liconv))
# common libraries without pkg-config support
LDFLAGS += -lz