A load of pedantic indenting, so I've half a chance of reading this in future.

Use immediate assignment for configuration options -- there's no point in re-evaluating them every time.

svn path=/trunk/netsurf/; revision=4783
This commit is contained in:
John Mark Bell 2008-07-28 23:16:59 +00:00
parent 86f4561e4c
commit 28f45754d5
2 changed files with 260 additions and 251 deletions

View File

@ -35,7 +35,7 @@ all: all-program
# In both cases HOST make variable is empty and we recover from that by
# assuming we're building on RISC OS.
# In case you don't see anything printed (including the warning), you
# have an update to date RISC OS build system. ;-)
# have an up-to-date RISC OS build system. ;-)
HOST := $(shell uname -s)
ifeq ($(HOST),)
HOST := riscos
@ -148,19 +148,55 @@ include Makefile.config
# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
# 2: Parameters to add to CFLAGS
# 3: Parameters to add to LDFLAGS
# 4: Human-readable name for the feature
define feature_enabled
ifeq ($$(NETSURF_USE_$(1)),YES)
CFLAGS += $(2)
LDFLAGS += $(3)
$$(info AUTOCONF: building with $(4))
else
$$(info AUTOCONF: building without $(4))
endif
endef
$(eval $(call feature_enabled,BMP,-DWITH_BMP,))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,))
$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg))
$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng))
# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
# 2: pkg-config required modules for feature
# 3: Human-readable name for the feature
define pkg_config_find_and_add
ifeq ($$(PKG_CONFIG),)
$$(error pkg-config is required to auto-detect feature availability)
endif
$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng))
ifneq ($$(NETSURF_USE_$(1)),NO)
NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell $$(PKG_CONFIG) --exists $(2) && echo yes)
ifeq ($$(NETSURF_USE_$(1)),AUTO)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
NETSURF_USE_$(1) := YES
endif
else
$$(info AUTOCONF: building with $(3))
endif
ifeq ($$(NETSURF_USE_$(1)),YES)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) $$(NETSURF_FEATURE_$(1)_CFLAGS)
LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
$$(info AUTOCONF: auto-enabled $(3) ($(2)).)
else
$$(error Unable to find library for: $(3) ($(2))
endif
endif
else
$$(info AUTOCONF: building without $(3))
endif
endef
$(eval $(call feature_enabled,BMP,-DWITH_BMP,,BMP support))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,,GIF support))
$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg,JPEG support))
$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support))
$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng,PDF export))
# common libraries without pkg-config support
LDFLAGS += -lz
@ -177,11 +213,10 @@ else
LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
endif
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny))
$(eval $(call feature_enabled,DRAW,-DWITH_DRAW,-lpencil))
$(eval $(call feature_enabled,SPRITE,-DWITH_SPRITE,))
$(eval $(call feature_enabled,ARTWORKS,-DWITH_ARTWORKS,))
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG rendering))
$(eval $(call feature_enabled,DRAW,-DWITH_DRAW,-lpencil,Drawfile export))
$(eval $(call feature_enabled,SPRITE,-DWITH_SPRITE,RISC OS sprite rendering))
$(eval $(call feature_enabled,ARTWORKS,-DWITH_ARTWORKS,Artworks rendering))
endif
# ----------------------------------------------------------------------------
@ -200,31 +235,6 @@ endif
ifeq ($(TARGET),gtk)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
# 2: pkg-config required modules for feature
# 3: Human-readable name for the feature
define pkg_config_find_and_add
ifneq ($$(NETSURF_USE_$(1)),NO)
NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell pkg-config --exists $(2) && echo yes)
ifeq ($$(NETSURF_USE_$(1)),AUTO)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
NETSURF_USE_$(1) := YES
endif
endif
ifeq ($$(NETSURF_USE_$(1)),YES)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
CFLAGS += $$(shell pkg-config --cflags $(2)) $$(NETSURF_FEATURE_$(1)_CFLAGS)
LDFLAGS += $$(shell pkg-config --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
$$(info AUTOCONF: auto-enabled $(3) ($(2)).)
else
$$(error Unable to find library for: $$(3) ($(2))
endif
endif
endif
endef
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
@ -256,7 +266,6 @@ LDFLAGS += $(GTKLDFLAGS)
ifeq ($(HOST),Windows_NT)
CFLAGS += -U__STRICT_ANSI__
endif
endif
# ----------------------------------------------------------------------------

View File

@ -11,24 +11,24 @@
# Enable NetSurf's built-in BMP support
# Valid options: YES, NO
NETSURF_USE_BMP=YES
NETSURF_USE_BMP := YES
# Enable NetSurf's built-in GIF support
# Valid options: YES, NO
NETSURF_USE_GIF=YES
NETSURF_USE_GIF := YES
# Enable NetSurf's use of IJG's libjpeg
# Valid options: YES, NO
NETSURF_USE_JPEG=YES
NETSURF_USE_JPEG := YES
# Enable NetSurf's use of libmng for displaying MNGs and PNGs
# Valid options: YES, NO
NETSURF_USE_MNG=YES
NETSURF_USE_MNG := YES
# Use libharu to enable PDF export and GTK printing support. There is no
# auto-detection available for this, as it does not have a pkg-config file
# Valid options: YES, NO
NETSURF_USE_HARU_PDF=YES
NETSURF_USE_HARU_PDF := YES
# ----------------------------------------------------------------------------
# RISC OS-specific options
@ -37,15 +37,15 @@ ifeq ($(TARGET),riscos)
# Use James Bursa's libsvgtiny for rendering SVG images
# Valid options: YES, NO
NETSURF_USE_NSSVG=YES
NETSURF_USE_NSSVG := YES
# Use pencil to enable export to Drawfile
# Valid options: YES, NO
NETSURF_USE_DRAW=YES
NETSURF_USE_DRAW := YES
# Enable NetSurf's RISC OS Sprite support via Tinct
# Valid options: YES, NO
NETSURF_USE_SPRITE=YES
NETSURF_USE_SPRITE := YES
endif
@ -56,15 +56,15 @@ ifeq ($(TARGET),gtk)
# Where to search for NetSurf's resources after looking in ~/.netsurf and
# $NETSURFRES. It must have a trailing /
NETSURF_GTK_RESOURCES=/usr/local/share/netsurf/
NETSURF_GTK_RESOURCES := /usr/local/share/netsurf/
# Use librsvg in conjunction with Cairo to render SVG images
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG=AUTO
NETSURF_USE_RSVG := AUTO
# Use James Shaw's librosprite for rendering RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE=AUTO
NETSURF_USE_ROSPRITE := AUTO
endif