WebSurf/Makefile

549 lines
16 KiB
Makefile
Raw Normal View History

#
# Makefile for NetSurf
#
# Copyright 2007 Daniel Silverstone <dsilvers@netsurf-browser.org>
#
#
# Trivially, invoke as:
# make
# to build native, or:
# make TARGET=riscos
# to cross-build for RO.
#
# Tested on unix platforms (building for GTK and cross-compiling for RO) and
# on RO (building for RO).
#
# To clean, invoke as above, with the 'clean' target
#
# To build developer Doxygen generated documentation, invoke as above,
# with the 'docs' target:
# make docs
#
all: all-program
# Determine host type
# NOTE: HOST determination on RISC OS could fail because of missing bug fixes
# in UnixLib which only got addressed in UnixLib 5 / GCCSDK 4.
# When you don't have 'uname' available, you will see:
# File 'uname' not found
# When you do and using a 'uname' compiled with a buggy UnixLib, you
# will see the following printed on screen:
# RISC OS
# 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. ;-)
HOST := $(shell uname -s)
ifeq ($(HOST),)
HOST := riscos
$(warning Build platform determination failed but that's a known problem for RISC OS so we're assuming a native RISC OS build.)
else
ifeq ($(HOST),RISC OS)
# Fixup uname -s returning "RISC OS"
HOST := riscos
endif
endif
ifeq ($(HOST),riscos)
# Build happening on RO platform, default target is RO backend
ifeq ($(TARGET),)
TARGET := riscos
endif
else
ifeq ($(HOST),BeOS)
HOST := beos
endif
ifeq ($(HOST),Haiku)
# Haiku implements the BeOS API
HOST := beos
endif
ifeq ($(HOST),beos)
# Build happening on BeOS platform, default target is BeOS backend
ifeq ($(TARGET),)
TARGET := beos
endif
# BeOS still uses gcc2
GCCVER := 2
else
# Build happening on non-RO platform, default target is GTK backend
ifeq ($(TARGET),)
TARGET := gtk
endif
endif
endif
SUBTARGET =
RESOURCES =
ifneq ($(TARGET),riscos)
ifneq ($(TARGET),gtk)
ifneq ($(TARGET),beos)
ifneq ($(TARGET),debug)
$(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos" or "debug")
endif
endif
endif
endif
Q=@
VQ=@
PERL=perl
MKDIR=mkdir
TOUCH=touch
ifeq ($(TARGET),riscos)
ifeq ($(HOST),riscos)
# Build for RO on RO
GCCSDK_INSTALL_ENV := <NSLibs$$Dir>
CC := gcc
EXEEXT :=
PKG_CONFIG :=
else
# Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
# either using GCCSDK 4 - ELF)
GCCSDK_INSTALL_ENV ?= /home/riscos/env
GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin
CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
SUBTARGET := -elf
EXEEXT := ,e1f
ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
else
SUBTARGET := -aof
EXEEXT := ,ff8
endif
PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
First merge of Adam Blokus' GSoC work from his branch 'branches/adamblokus/netsurf'. Merged revisions 4212-4552,4554-4709,4711-4724 via svnmerge from svn://svn.netsurf-browser.org/branches/adamblokus/netsurf ........ r4212 | adamblokus | 2008-05-26 19:42:31 +0200 (Mon, 26 May 2008) | 4 lines Pdf plotting skeleton pinned on Print Preview in GTK. Just creates a file and draws lines. ........ r4213 | adamblokus | 2008-05-27 00:11:03 +0200 (Tue, 27 May 2008) | 4 lines Pdf plotter - added drawing some graphic primitives. Still with limited functionality, but a snapshot of the currently viewed page can be made and resembles the original. ........ r4214 | adamblokus | 2008-05-27 11:43:31 +0200 (Tue, 27 May 2008) | 2 lines Corrected encoding name ........ r4215 | adamblokus | 2008-05-27 12:47:26 +0200 (Tue, 27 May 2008) | 3 lines Colours and polygons added. ........ r4217 | adamblokus | 2008-05-27 21:39:35 +0200 (Tue, 27 May 2008) | 6 lines Added rectangles, filled boxes and clipping. Taken into consideration joty's comments. Added a todo list for this part. Added some debug stuff and checking boundaries. ........ r4218 | adamblokus | 2008-05-28 12:37:30 +0200 (Wed, 28 May 2008) | 2 lines Added path ploting (not sure if valid argument order for bezier) and dashed/dotted line styles ........ r4221 | adamblokus | 2008-05-28 22:11:05 +0200 (Wed, 28 May 2008) | 3 lines Some more options in graphic primitives and normalizing some parameters. ........ r4235 | adamblokus | 2008-05-31 22:54:56 +0200 (Sat, 31 May 2008) | 4 lines Plotting changed as jmb suggested (is the least invasive one from the possible) Added dummy bitmap plotting - way of plotting an image is determined by its type. ........ r4251 | adamblokus | 2008-06-03 17:12:15 +0200 (Tue, 03 Jun 2008) | 3 lines Added plotting jpg and png images - quite a lot to improve in this code, but it seems to work ;) ........ r4263 | adamblokus | 2008-06-05 14:20:32 +0200 (Thu, 05 Jun 2008) | 3 lines Added hadling images other than png and jpeg - with transparency. ........ r4267 | adamblokus | 2008-06-06 15:36:34 +0200 (Fri, 06 Jun 2008) | 5 lines Added handling NULL-returns from all mallocs. Added plot_bitmap_tile handling. Changed code style a little. ........ r4327 | adamblokus | 2008-06-12 17:46:34 +0200 (Thu, 12 Jun 2008) | 5 lines Added a first prototype of the paged-output organization. Still not sure about naming, file locations etc. Works with the same pdf plotting as before. ........ r4328 | adamblokus | 2008-06-13 13:52:15 +0200 (Fri, 13 Jun 2008) | 4 lines Added primitive width adjustment and outputing the whole website in multiple pages. ........ r4336 | joty | 2008-06-15 15:06:57 +0200 (Sun, 15 Jun 2008) | 1 line Fix RISC OS build failure (change r4235 wasn't complete). ........ r4337 | joty | 2008-06-15 18:15:32 +0200 (Sun, 15 Jun 2008) | 16 lines This enables "Export PDF" in RISC OS build: - Docs/Doxyfile(PREDEFINED): Added WITH_PDF_EXPORT - Makefile.sources(S_PDF): Add to RISC OS target as well. - utils/config.h: Define WITH_PDF_EXPORT which controls if we want to have PDF export functionality or not. - riscos/save_pdf.c,riscos/save_pdf.h(save_as_pdf): Use PDF print API made by Adam Blokus to write a PDF file under RISC OS. - riscos/save.c: Call save_as_pdf added. - riscos/menus.c: Add 'Export->PDF' menu entry. - riscos/menus.h(menu_action): Added BROWSER_EXPORT_PDF. - desktop/gui.h(gui_save_type): Added GUI_SAVE_PDF. - desktop/print.c(print_run): Added return value. - Makefile(CCACHE): Moved closed to the place where CC is set for the first time. (LDFLAGS): Centralised adding all non-pkgconfig libraries and added Haru + PNG libs. ........ r4343 | adamblokus | 2008-06-16 01:08:52 +0200 (Mon, 16 Jun 2008) | 3 lines Added margins and page size adjustment. ........ r4412 | adamblokus | 2008-06-21 20:22:07 +0200 (Sat, 21 Jun 2008) | 4 lines Added 'fuzzy' margins on page bottom. Disabled direct png embedding, because it is too unstable in Haru now. ........ r4421 | adamblokus | 2008-06-22 18:52:28 +0200 (Sun, 22 Jun 2008) | 2 lines Added "Save as.." dialog and Export->PDF menu entry. Print preview still works with default path. ........ r4437 | adamblokus | 2008-06-25 02:44:46 +0200 (Wed, 25 Jun 2008) | 4 lines Added skeleton of applying loose layout. Minor code cleaning-up. ........ r4492 | adamblokus | 2008-07-02 09:02:42 +0200 (Wed, 02 Jul 2008) | 5 lines Implemented the elementar ideas of the loose layout. Added scaling in the printing routine. Added some basic demonstrations. ........ r4493 | adamblokus | 2008-07-02 09:05:55 +0200 (Wed, 02 Jul 2008) | 3 lines Cleaned up the loosing code - commited to much of leftover rubbish code. ........ r4507 | adamblokus | 2008-07-04 14:25:48 +0200 (Fri, 04 Jul 2008) | 4 lines Added duplicating box tree and current content - window flickering during printing solved. Minor error checking after new HPDF_Image_AddSMask call. ........ r4515 | adamblokus | 2008-07-06 22:28:16 +0200 (Sun, 06 Jul 2008) | 2 lines Changes in loosen layout (image resizing). ........ r4517 | adamblokus | 2008-07-06 22:38:23 +0200 (Sun, 06 Jul 2008) | 2 lines Added pdf font handling and rendering functions with the use of Haru functions. ........ r4555 | adamblokus | 2008-07-10 00:59:05 +0200 (Thu, 10 Jul 2008) | 2 lines Added a very basic and still buggy GTK print implementation. ........ r4565 | adamblokus | 2008-07-10 14:50:16 +0200 (Thu, 10 Jul 2008) | 2 lines Added gtk printing one more time - I have forgotten to add the main file. ........ r4566 | adamblokus | 2008-07-10 14:57:02 +0200 (Thu, 10 Jul 2008) | 2 lines removed error with comment ........ r4569 | adamblokus | 2008-07-10 15:52:55 +0200 (Thu, 10 Jul 2008) | 5 lines Major style improvements - added a lot of doxygen comments, followed tlsa's style guide. Added some more error checking, too. ........ r4575 | adamblokus | 2008-07-10 18:48:26 +0200 (Thu, 10 Jul 2008) | 2 lines Cleaned up the code. ........ r4687 | adamblokus | 2008-07-17 14:17:19 +0200 (Thu, 17 Jul 2008) | 2 lines Changed everything according to jmb's review plus some minor bug fixes to gtk_print. ........ r4688 | adamblokus | 2008-07-17 17:16:34 +0200 (Thu, 17 Jul 2008) | 2 lines Solved the netsurf.glade clash from r4421. ........ r4693 | adamblokus | 2008-07-18 18:11:51 +0200 (Fri, 18 Jul 2008) | 2 lines Fixed bug with wrong number of pages in gtk printing. ........ r4695 | adamblokus | 2008-07-18 19:59:24 +0200 (Fri, 18 Jul 2008) | 3 lines - fixed uncommented line from the previous commit - fixed bug with scale bigger than 1.0 (incorretly clipped page) ........ r4696 | adamblokus | 2008-07-18 23:28:00 +0200 (Fri, 18 Jul 2008) | 2 lines Fixed bug in gtk_print_font_paint (and nsfont_paint). ........ r4697 | adamblokus | 2008-07-18 23:35:38 +0200 (Fri, 18 Jul 2008) | 2 lines Bug fix in nsfont_paint. ........ r4711 | adamblokus | 2008-07-19 22:44:15 +0200 (Sat, 19 Jul 2008) | 2 lines Added gtk_selection files. ........ r4712 | adamblokus | 2008-07-20 11:15:06 +0200 (Sun, 20 Jul 2008) | 2 lines Addam missing glade files. ........ r4713 | joty | 2008-07-20 17:13:10 +0200 (Sun, 20 Jul 2008) | 1 line Follow change r4517 for RISC OS and BeOS platforms : Added pdf font handling and rendering functions with the use of Haru functions. ........ r4714 | joty | 2008-07-20 18:19:50 +0200 (Sun, 20 Jul 2008) | 1 line Declare haru_nsfont iso define an instance for each C source including the font_haru.h header. This fixes breakage of PDF export on RISC OS. ........ r4724 | adamblokus | 2008-07-23 03:30:08 +0200 (Wed, 23 Jul 2008) | 6 lines Applied changes according to joty's review. Added checking the dimensions of a plotted image to pdf plotter. Commented out jpg embedding (it seems to cause some problems I'll bring it back when I figure out what's wrong) . Added back some files removed by mistake. ........ svn path=/trunk/netsurf/; revision=4741
2008-07-26 09:01:59 -07:00
CCACHE := $(shell which ccache)
ifneq ($(CCACHE),)
CC := $(CCACHE) $(CC)
endif
endif
else
ifeq ($(TARGET),beos)
# Building for BeOS/Haiku
#ifeq ($(HOST),beos)
# Build for BeOS on BeOS
GCCSDK_INSTALL_ENV := /boot/develop
CC := gcc
CXX := g++
EXEEXT :=
PKG_CONFIG :=
#endif
else
# Building for GTK or debug
PKG_CONFIG := pkg-config
endif
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 -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)
LDFLAGS := -L/boot/home/config/lib
LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -liconv
endif
# ----------------------------------------------------------------------------
# GTK flag setup (using pkg-config)
# ----------------------------------------------------------------------------
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
# add a line similar to below for each optional pkg-configed lib here
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG rendering))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,RISC OS sprite rendering))
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
-DGTK_DISABLE_DEPRECATED \
-D_BSD_SOURCE \
-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)
GTKLDFLAGS := $(shell $(PKG_CONFIG) --cflags --libs libglade-2.0 gtk+-2.0 gthread-2.0 gmodule-2.0 lcms)
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 \
-mpoke-function-name
CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include \
-I$(GCCSDK_INSTALL_ENV)/include/libxml2 \
-I$(GCCSDK_INSTALL_ENV)/include/libmng
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
ifeq ($(HOST),riscos)
LDFLAGS += -LOSLib: -lOSLib32
else
LDFLAGS += -lOSLib32
ifeq ($(SUBTARGET),-elf)
# Go for static builds & AIF binary at the moment:
CFLAGS += -static
LDFLAGS += -static
EXEEXT := ,ff8
endif
endif
endif
# ----------------------------------------------------------------------------
# BeOS target flag setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),beos)
CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
-Drestrict="" -Wno-multichar
# DEBUG
CFLAGS += -g -O0
# -DDEBUG=1
BEOS_BERES := beres
BEOS_RC := rc
BEOS_XRES := xres
BEOS_SETVER := setversion
BEOS_MIMESET := mimeset
VERSION_FULL := $(shell sed -n '/"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
RSRC_BEOS = $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.rdef,%.rsrc,$(RDEF_BEOS))))
RESOURCES = $(RSRC_BEOS)
ifeq ($(HOST),beos)
CFLAGS += -I/boot/home/config/include \
-I/boot/home/config/include/libxml2 \
-I/boot/home/config/include/libmng
ifneq ($(wildcard /boot/develop/lib/*/libzeta.so),)
LDFLAGS += -lzeta
endif
ifneq ($(wildcard /boot/develop/lib/*/libnetwork.so),)
# Haiku
NETLDFLAGS := -lnetwork
else
ifneq ($(wildcard /boot/develop/lib/*/libbind.so),)
# BONE
NETLDFLAGS := -lsocket -lbind
else
# net_server, will probably never work
NETLDFLAGS := -lnet
endif
endif
else
# cross: Haiku ?
NETLDFLAGS := -lnetwork
endif
LDFLAGS += -lbe -ltranslation $(NETLDFLAGS)
endif
# ----------------------------------------------------------------------------
# Debug target setup
# ----------------------------------------------------------------------------
ifeq ($(TARGET),debug)
CFLAGS += -std=c99 -DDEBUG_BUILD \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
$(WARNFLAGS) -I. -I../../libsprite/trunk/ -g $(OPT0FLAGS) \
$(shell $(PKG_CONFIG) --cflags librosprite) \
$(shell xml2-config --cflags)
LDFLAGS += $(shell $(PKG_CONFIG) --libs librosprite)
endif
# ----------------------------------------------------------------------------
# General make rules
# ----------------------------------------------------------------------------
$(OBJROOT)/created:
$(VQ)echo " MKDIR: $(OBJROOT)"
$(Q)$(MKDIR) $(OBJROOT)
$(Q)$(TOUCH) $(OBJROOT)/created
DEPROOT := $(OBJROOT)/deps
$(DEPROOT)/created: $(OBJROOT)/created
$(VQ)echo " MKDIR: $(DEPROOT)"
$(Q)$(MKDIR) $(DEPROOT)
$(Q)$(TOUCH) $(DEPROOT)/created
WARNFLAGS = -W -Wall -Wundef -Wpointer-arith \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Winline
ifneq ($(GCCVER),2)
WARNFLAGS += -Wno-unused-parameter
endif
OPT0FLAGS = -O0
# -O and -O2 can use -Wuninitialized which gives us more static checking.
# unfortunately the optimiser is what provides the hints in the code tree
# so we cannot do it when we do -O0 (E.g. debug)
OPTFLAGS = -O -Wuninitialized
OPT2FLAGS = -O2 -Wuninitialized
CLEANS := clean-target
include Makefile.sources
OBJECTS := $(sort $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.s,%.o,$(SOURCES)))))))
$(EXETARGET): $(OBJECTS) $(RESOURCES)
$(VQ)echo " LINK: $(EXETARGET)"
ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
$(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS)
else
$(Q)$(CC) -o $(EXETARGET:,ff8=,e1f) $(OBJECTS) $(LDFLAGS)
$(Q)$(ELF2AIF) $(EXETARGET:,ff8=,e1f) $(EXETARGET)
$(Q)$(RM) $(EXETARGET:,ff8=,e1f)
endif
ifeq ($(TARGET),beos)
$(VQ)echo " XRES: $(EXETARGET)"
$(Q)$(BEOS_XRES) -o $(EXETARGET) $(RSRC_BEOS)
$(VQ)echo " SETVER: $(EXETARGET)"
$(Q)$(BEOS_SETVER) $(EXETARGET) \
-app $(VERSION_MAJ) $(VERSION_MIN) 0 d 0 \
-short "NetSurf $(VERSION_FULL)" \
-long "NetSurf $(VERSION_FULL) ©"
$(VQ)echo " MIMESET: $(EXETARGET)"
$(Q)$(BEOS_MIMESET) $(EXETARGET)
endif
ifeq ($(TARGET),beos)
$(RSRC_BEOS): $(RDEF_BEOS)
$(VQ)echo " RC: $<"
$(Q)$(BEOS_RC) -o $@ $<
endif
clean-target:
$(VQ)echo " CLEAN: $(EXETARGET)"
$(Q)$(RM) $(EXETARGET)
clean-builddir:
$(VQ)echo " CLEAN: $(OBJROOT)"
$(Q)$(RM) -r $(OBJROOT)
CLEANS += clean-builddir
all-program: $(EXETARGET)
.SUFFIXES:
DEPFILES :=
# Now some macros which build the make system
# 1 = Source file
# 2 = dep filename, no prefix
# 3 = obj filename, no prefix
ifeq ($(GCCVER),2)
# simpler deps tracking for gcc2...
define dependency_generate_c
DEPFILES += $(2)
$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1) css/css_enum.h css/parser.h Makefile.config
$$(VQ)echo " DEP: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(2)
$$(Q)$$(CC) $$(CFLAGS) -MM \
$(1) | sed 's,^.*:,$$(DEPROOT)/$2 $$(OBJROOT)/$(3):,' \
> $$(DEPROOT)/$(2)
endef
else
define dependency_generate_c
DEPFILES += $(2)
$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1) css/css_enum.h css/parser.h Makefile.config
$$(VQ)echo " DEP: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(2)
$$(Q)$$(CC) $$(CFLAGS) -MM -MT '$$(DEPROOT)/$2 $$(OBJROOT)/$(3)' \
-MF $$(DEPROOT)/$(2) $(1)
endef
endif
# 1 = Source file
# 2 = dep filename, no prefix
# 3 = obj filename, no prefix
define dependency_generate_s
DEPFILES += $(2)
$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1)
$$(VQ)echo " DEP: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(2)
$$(Q)$$(CC) $$(CFLAGS) -MM -MT '$$(DEPROOT)/$2 $$(OBJROOT)/$(3)' \
-MF $$(DEPROOT)/$(2) $(1)
endef
# 1 = Source file
# 2 = obj filename, no prefix
# 3 = dep filename, no prefix
define compile_target_c
$$(OBJROOT)/$(2): $$(OBJROOT)/created $$(DEPROOT)/$(3)
$$(VQ)echo " COMPILE: $(1)"
$$(Q)$$(CC) $$(CFLAGS) -o $$@ -c $(1)
endef
define compile_target_cpp
$$(OBJROOT)/$(2): $$(OBJROOT)/created $$(DEPROOT)/$(3)
$$(VQ)echo " COMPILE: $(1)"
$$(Q)$$(CXX) $$(CFLAGS) -o $$@ -c $(1)
endef
# 1 = Source file
# 2 = obj filename, no prefix
# 3 = dep filename, no prefix
define compile_target_s
$$(OBJROOT)/$(2): $$(OBJROOT)/created
$$(VQ)echo " ASSEMBLE: $(1)"
$$(Q)$$(CC) $$(ASFLAGS) -o $$@ -c $(1)
endef
# Rules to construct dep lines for each object...
$(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \
$(call dependency_generate_c,$(SOURCE),$(subst /,_,$(SOURCE:.c=.d)),$(subst /,_,$(SOURCE:.c=.o)))))
$(eval $(foreach SOURCE,$(filter %.cpp,$(SOURCES)), \
$(call dependency_generate_c,$(SOURCE),$(subst /,_,$(SOURCE:.cpp=.d)),$(subst /,_,$(SOURCE:.cpp=.o)))))
# Cannot currently generate dep files for S files because they're objasm
# when we move to gas format, we will be able to.
#$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
# $(call dependency_generate_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.d)),$(subst /,_,$(SOURCE:.s=.o)))))
ifneq ($(MAKECMDGOALS),clean)
-include $(sort $(addprefix $(DEPROOT)/,$(DEPFILES)))
endif
# And rules to build the objects themselves...
$(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \
$(call compile_target_c,$(SOURCE),$(subst /,_,$(SOURCE:.c=.o)),$(subst /,_,$(SOURCE:.c=.d)))))
$(eval $(foreach SOURCE,$(filter %.cpp,$(SOURCES)), \
$(call compile_target_cpp,$(SOURCE),$(subst /,_,$(SOURCE:.cpp=.o)),$(subst /,_,$(SOURCE:.cpp=.d)))))
$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst /,_,$(SOURCE:.s=.d)))))
.PHONY: all clean docs install install-gtk
clean: $(CLEANS)
install-gtk:
mkdir -p $(DESTDIR)/usr/share/netsurf/throbber
mkdir -p $(DESTDIR)/usr/bin
@cp -v nsgtk $(DESTDIR)/usr/bin
@cp -vrL gtk/res/adblock.css $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/ca-bundle.txt $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/default.css $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/gtkdefault.css $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/license $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/netsurf.xpm $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/netsurf-16x16.xpm $(DESTDIR)/usr/share/netsurf
@cp -vrL gtk/res/throbber/*.png $(DESTDIR)/usr/share/netsurf/throbber
gzip -9v < gtk/res/messages > $(DESTDIR)/usr/share/netsurf/messages
gzip -9v < gtk/res/downloads.glade > $(DESTDIR)/usr/share/netsurf/downloads.glade
gzip -9v < gtk/res/netsurf.glade > $(DESTDIR)/usr/share/netsurf/netsurf.glade
gzip -9v < gtk/res/options.glade > $(DESTDIR)/usr/share/netsurf/options.glade
install: all-program install-$(TARGET)
docs:
doxygen Docs/Doxyfile