Refactor Makefile a little to be slightly more organised. Made more features configurable from Makefile.config

svn path=/trunk/netsurf/; revision=4775
This commit is contained in:
Rob Kendrick 2008-07-28 20:56:24 +00:00
parent 052f99d379
commit fe7cae2bfe
7 changed files with 131 additions and 46 deletions

View File

@ -138,33 +138,61 @@ endif
OBJROOT := build-$(HOST)-$(TARGET)$(SUBTARGET)
# ----------------------------------------------------------------------------
# General flag setup
# ----------------------------------------------------------------------------
include Makefile.config
# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
# 2: Parameters to add to CFLAGS
# 3: Parameters to add to LDFLAGS
define feature_enabled
ifeq ($$(NETSURF_USE_$(1)),YES)
CFLAGS += $(2)
LDFLAGS += $(3)
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))
$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng))
# common libraries without pkg-config support
LDFLAGS += -lz
# ----------------------------------------------------------------------------
# RISC OS host flag setup
# ----------------------------------------------------------------------------
ifeq ($(HOST),riscos)
LDFLAGS := -Xlinker -symbols=$(OBJROOT)/sym -lxml2 -lz -lm -lcurl -lssl -lcrypto -lmng -ljpeg \
-lcares
else
LDFLAGS := -Xlinker -symbols=$(OBJROOT)/sym -lxml2 -lz -lm -lcurl -lssl \
-lcrypto -lcares
$(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,))
endif
# ----------------------------------------------------------------------------
# BeOS flag setup
# ----------------------------------------------------------------------------
ifeq ($(HOST),beos)
# some people do *not* have libm...
LDFLAGS := -L/boot/home/config/lib
LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -ljpeg -liconv
LDFLAGS += -lmng -ljpeg
else
LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
endif
# Common libraries without pkgconfig support:
LDFLAGS += -lz -lm -lmng -ljpeg
ifeq ($(NETSURF_USE_HARU_PDF),YES)
LDFLAGS += -lhpdf -lpng
CFLAGS += -DWITH_PDF_EXPORT
endif
LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -liconv
endif
# ----------------------------------------------------------------------------
# GTK flag setup (using pkg-config)
# ----------------------------------------------------------------------------
ifeq ($(TARGET),gtk)
# Building for GTK, we need the GTK flags
FEATURE_CFLAGS :=
FEATURE_LDFLAGS :=
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
@ -180,8 +208,8 @@ define pkg_config_find_and_add
endif
ifeq ($$(NETSURF_USE_$(1)),YES)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
FEATURE_CFLAGS += $$(shell pkg-config --cflags $(2)) $$(NETSURF_FEATURE_$(1)_CFLAGS)
FEATURE_LDFLAGS += $$(shell pkg-config --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
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))
@ -205,23 +233,30 @@ GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
-DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\" \
$(WARNFLAGS) -I. -g $(OPT2FLAGS) \
$(shell $(PKG_CONFIG) --cflags libglade-2.0 gtk+-2.0) \
$(shell xml2-config --cflags)
GTKCFLAGS += $(FEATURE_CFLAGS)
GTKLDFLAGS := $(shell $(PKG_CONFIG) --cflags --libs libglade-2.0 gtk+-2.0 gthread-2.0 gmodule-2.0 lcms)
GTKLDFLAGS += $(FEATURE_LDFLAGS)
CFLAGS += $(GTKCFLAGS)
LDFLAGS += $(GTKLDFLAGS)
# ----------------------------------------------------------------------------
# Windows flag setup
# ----------------------------------------------------------------------------
ifeq ($(HOST),Windows_NT)
CFLAGS += -U__STRICT_ANSI__
endif
endif
# ----------------------------------------------------------------------------
# RISC OS target flag setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),riscos)
CFLAGS += -I. $(OPTFLAGS) $(WARNFLAGS) -Driscos \
-std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
@ -234,8 +269,7 @@ ifeq ($(HOST),riscos)
CFLAGS += -I<OSLib$$Dir> -mthrowback
endif
ASFLAGS += -xassembler-with-cpp -I. -I$(GCCSDK_INSTALL_ENV)/include
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lrufl -lpencil \
-lsvgtiny
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lrufl
ifeq ($(HOST),riscos)
LDFLAGS += -LOSLib: -lOSLib32
else
@ -249,6 +283,10 @@ endif
endif
endif
# ----------------------------------------------------------------------------
# BeOS target flag setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),beos)
CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
@ -293,6 +331,9 @@ endif
LDFLAGS += -lbe -ltranslation $(NETLDFLAGS)
endif
# ----------------------------------------------------------------------------
# Debug target setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),debug)
CFLAGS += -std=c99 -DDEBUG_BUILD \
@ -306,6 +347,10 @@ CFLAGS += -std=c99 -DDEBUG_BUILD \
LDFLAGS += $(shell $(PKG_CONFIG) --libs librosprite)
endif
# ----------------------------------------------------------------------------
# General make rules
# ----------------------------------------------------------------------------
$(OBJROOT)/created:
$(VQ)echo " MKDIR: $(OBJROOT)"
$(Q)$(MKDIR) $(OBJROOT)

View File

@ -2,19 +2,68 @@
# NetSurf build configuration
#
# Some of these options support an 'AUTO' option, as well as YES and NO. If
# AUTO is set, the Makefile will attempt to detect if that feature is available
# AUTO is available, the Makefile will attempt to detect if that feature is
# available when such is used.
# ----------------------------------------------------------------------------
# Options relating to all versions of NetSurf
# ----------------------------------------------------------------------------
# Enable NetSurf's built-in BMP support
# Valid options: YES, NO
NETSURF_USE_BMP=YES
# Enable NetSurf's built-in GIF support
# Valid options: YES, NO
NETSURF_USE_GIF=YES
# Enable NetSurf's use of IJG's libjpeg
# Valid options: YES, NO
NETSURF_USE_JPEG=YES
# Enable NetSurf's use of libmng for displaying MNGs and PNGs
# Valid options: YES, NO
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.
# auto-detection available for this, as it does not have a pkg-config file
# Valid options: YES, NO
NETSURF_USE_HARU_PDF=YES
# The following options are GTK-specific
# ----------------------------------------------------------------------------
# RISC OS-specific options
# ----------------------------------------------------------------------------
ifeq ($(TARGET),riscos)
# Use James Bursa's libsvgtiny for rendering SVG images
# Valid options: YES, NO
NETSURF_USE_NSSVG=YES
# Use pencil to enable export to Drawfile
# Valid options: YES, NO
NETSURF_USE_DRAW=YES
# Enable NetSurf's RISC OS Sprite support via Tinct
# Valid options: YES, NO
NETSURF_USE_SPRITE=YES
endif
# ----------------------------------------------------------------------------
# GTK-specific options
# ----------------------------------------------------------------------------
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/
# Use librsvg in conjunction with Cairo to render SVG images
# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG=AUTO
# Use James Shaw's librosprite for rendering RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE=AUTO
endif

View File

@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "utils/log.h"

View File

@ -59,9 +59,6 @@
#include "utils/utf8.h"
#include "utils/utils.h"
/* Where to search for shared resources. Must have trailing / */
#define RESPATH "/usr/share/netsurf/"
bool gui_in_multitask = false;
char *default_stylesheet_url;
@ -127,7 +124,7 @@ static char *find_resource(char *buf, const char *filename, const char *def)
return buf;
}
strcpy(t, RESPATH);
strcpy(t, GTK_RESPATH);
strcat(t, filename);
realpath(t, buf);
if (access(buf, R_OK) == 0)

View File

@ -302,8 +302,9 @@ int ro_content_filetype_from_type(content_type type) {
#ifdef WITH_ARTWORKS
case CONTENT_ARTWORKS: return 0xd94;
#endif
#ifdef WITH_NS_SVG
case CONTENT_SVG: return 0xaad;
#endif
default: break;
}
return 0;

View File

@ -1437,7 +1437,11 @@ void ro_gui_window_redraw(wimp_draw *redraw)
/* rendering textplain has no advantages using knockout rendering other
* than to slow things down. */
if (c->type == CONTENT_TEXTPLAIN || c->type == CONTENT_SVG)
if (c->type == CONTENT_TEXTPLAIN
#ifdef WITH_NS_SVG
|| c->type == CONTENT_SVG
#endif
)
knockout = false;
/* HTML rendering handles scale itself */

View File

@ -46,18 +46,6 @@ char *strndup(const char *s, size_t n);
#define WITH_SSL
#endif
/* Image renderering modules */
#define WITH_BMP
#define WITH_JPEG
#define WITH_MNG
#define WITH_GIF
#if defined(riscos)
#define WITH_NS_SVG /* internal SVG renderer */
#define WITH_DRAW
#define WITH_SPRITE
#define WITH_ARTWORKS
#endif
/* Platform specific features */
#if defined(riscos)
/* Plugin module */