2007-12-23 00:15:58 +03:00
#
# Makefile for NetSurf
#
# Copyright 2007 Daniel Silverstone <dsilvers@netsurf-browser.org>
2008-07-29 01:21:40 +04:00
# Copyright 2008 Rob Kendrick <rjek@netsurf-browser.org>
2024-01-05 20:29:03 +03:00
# Copyright 2024 Vincent Sanders <vince@netsurf-browser.org>
2007-12-23 00:15:58 +03:00
#
# Trivially, invoke as:
2008-03-19 07:03:40 +03:00
# make
2007-12-23 00:15:58 +03:00
# to build native, or:
2008-03-19 07:03:40 +03:00
# make TARGET=riscos
2007-12-23 00:15:58 +03:00
# to cross-build for RO.
#
2008-07-29 01:21:40 +04:00
# Look at Makefile.config for configuration options.
#
2021-01-17 23:06:24 +03:00
# Best results obtained building on unix platforms cross compiling for others
2007-12-23 00:15:58 +03:00
#
# To clean, invoke as above, with the 'clean' target
#
2008-03-09 20:06:45 +03:00
# To build developer Doxygen generated documentation, invoke as above,
# with the 'docs' target:
2008-03-19 07:03:40 +03:00
# make docs
2008-03-09 20:06:45 +03:00
#
2007-12-23 00:15:58 +03:00
2015-07-07 18:02:54 +03:00
.PHONY : all
2007-12-23 00:15:58 +03:00
all : all -program
2021-01-17 23:06:24 +03:00
# default values for base variables
2011-04-22 13:00:24 +04:00
2015-04-07 02:08:14 +03:00
# Resources executable target depends upon
RESOURCES =
# Messages executable target depends on
MESSAGES :=
# The filter applied to the fat (full) messages to generate split messages
MESSAGES_FILTER = any
# The languages in the fat messages to convert
2020-09-02 10:59:38 +03:00
MESSAGES_LANGUAGES = de en fr it nl zh_CN
2015-04-07 02:08:14 +03:00
# The target directory for the split messages
2018-04-22 12:51:43 +03:00
MESSAGES_TARGET = resources
2015-04-07 02:08:14 +03:00
2014-09-05 19:01:44 +04:00
# build verbosity
i f e q ( $( V ) , 1 )
Q:=
e l s e
Q = @
e n d i f
VQ = @
2021-01-17 23:06:24 +03:00
# compute HOST, TARGET and SUBTARGET
i n c l u d e f r o n t e n d s / M a k e f i l e . h t s
2010-12-30 00:26:45 +03:00
2024-02-27 12:26:37 +03:00
# tools used in builds
i n c l u d e M a k e f i l e . t o o l s
2012-08-20 21:08:47 +04:00
# Target paths
2017-01-06 02:00:41 +03:00
OBJROOT = build/$( HOST) -$( TARGET) $( SUBTARGET)
2010-10-29 04:54:27 +04:00
DEPROOT := $( OBJROOT) /deps
TOOLROOT := $( OBJROOT) /tools
2008-04-07 23:13:11 +04:00
2016-02-15 17:59:23 +03:00
# keep C flags from environment
CFLAGS_ENV := $( CFLAGS)
CXXFLAGS_ENV := $( CXXFLAGS)
2008-07-26 21:08:23 +04:00
2021-01-18 00:10:31 +03:00
# library and feature building macros
i n c l u d e M a k e f i l e . m a c r o s
2008-07-29 03:16:59 +04:00
2010-10-27 22:39:24 +04:00
# ----------------------------------------------------------------------------
# General flag setup
# ----------------------------------------------------------------------------
2024-02-27 12:26:37 +03:00
# host compiler flags
BUILD_CFLAGS = -g -W -Wall -Wundef -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-declarations -Wuninitialized \
-Wno-unused-parameter
2014-09-05 19:01:44 +04:00
# Set up the warning flags here so that they can be overridden in the
# Makefile.config
COMMON_WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-declarations -Wuninitialized
2016-02-15 17:59:23 +03:00
2012-12-13 23:27:16 +04:00
i f n e q ( $( CC_MAJOR ) , 2 )
2014-09-05 19:01:44 +04:00
COMMON_WARNFLAGS += -Wno-unused-parameter
2010-10-27 22:39:24 +04:00
e n d i f
2016-02-15 17:59:23 +03:00
2012-12-13 23:27:16 +04:00
# deal with lots of unwanted warnings from javascript
i f e q ( $( call cc_ver_ge ,4,6) , 1 )
2016-02-15 17:59:23 +03:00
COMMON_WARNFLAGS += -Wno-unused-but-set-variable
2012-12-13 23:27:16 +04:00
e n d i f
2016-02-15 17:59:23 +03:00
2024-02-27 12:26:37 +03:00
i f e q ( $( TOOLCHAIN ) , g c c )
2024-03-05 11:29:15 +03:00
# Implicit fallthrough warnings
2024-02-27 12:26:37 +03:00
ifeq ( $( call cc_ver_ge,7,1) ,1)
2024-03-05 11:29:15 +03:00
COMMON_WARNFLAGS += -Wimplicit-fallthrough= 5
2024-02-27 12:26:37 +03:00
endif
e l s e
2024-03-05 11:29:15 +03:00
# non gcc has different warning syntax
COMMON_WARNFLAGS += -Wimplicit-fallthrough
2018-09-07 14:53:51 +03:00
e n d i f
2016-02-15 17:59:23 +03:00
# deal with chaging warning flags for different platforms
2014-09-03 21:24:44 +04:00
i f e q ( $( HOST ) , O p e n B S D )
# OpenBSD headers are not compatible with redundant declaration warning
2014-09-05 19:01:44 +04:00
COMMON_WARNFLAGS += -Wno-redundant-decls
2014-09-03 21:24:44 +04:00
e l s e
2014-09-05 19:01:44 +04:00
COMMON_WARNFLAGS += -Wredundant-decls
2014-09-03 21:24:44 +04:00
e n d i f
2010-10-27 22:39:24 +04:00
2014-09-05 19:01:44 +04:00
# c++ default warning flags
CXXWARNFLAGS :=
# C default warning flags
CWARNFLAGS := -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
2017-08-31 01:27:28 +03:00
# Pull in the default configuration
2010-10-27 22:39:24 +04:00
i n c l u d e M a k e f i l e . d e f a u l t s
2017-08-31 01:27:28 +03:00
# Pull in the user configuration
- i n c l u d e M a k e f i l e . c o n f i g
2014-11-14 16:46:08 +03:00
# libraries enabled by feature switch without pkgconfig file
2014-04-30 14:56:05 +04:00
$( eval $ ( call feature_switch ,JPEG ,JPEG ( libjpeg ) ,-DWITH_JPEG ,-ljpeg ,-UWITH_JPEG ,) )
$( eval $ ( call feature_switch ,HARU_PDF ,PDF export ( haru ) ,-DWITH_PDF_EXPORT ,-lhpdf -lpng ,-UWITH_PDF_EXPORT ,) )
$( eval $ ( call feature_switch ,LIBICONV_PLUG ,glibc internal iconv ,-DLIBICONV_PLUG ,,-ULIBICONV_PLUG ,-liconv ) )
2015-08-09 14:27:28 +03:00
$( eval $ ( call feature_switch ,DUKTAPE ,Javascript ( Duktape ) ,,,,,) )
2008-07-29 00:56:24 +04:00
2014-11-14 16:46:08 +03:00
# Common libraries with pkgconfig
2015-04-18 00:48:55 +03:00
$( eval $ ( call pkg_config_find_and_add ,libcss ,CSS ) )
$( eval $ ( call pkg_config_find_and_add ,libdom ,DOM ) )
2014-11-27 00:29:13 +03:00
$( eval $ ( call pkg_config_find_and_add ,libnsutils ,nsutils ) )
2014-11-14 16:46:08 +03:00
# Common libraries without pkg-config support
2008-07-29 00:56:24 +04:00
LDFLAGS += -lz
2016-05-06 00:28:51 +03:00
# Optional libraries with pkgconfig
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs
2019-02-17 14:50:52 +03:00
# We only need to define the ones where the feature name doesn't exactly
# match the WITH_FEATURE flag
2016-05-06 00:28:51 +03:00
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
2016-10-19 12:12:41 +03:00
# libcurl and openssl ordering matters as if libcurl requires ssl it
# needs to come first in link order to ensure its symbols can be
# resolved by the subsequent openssl
2016-08-13 15:09:39 +03:00
# freemint does not support pkg-config for libcurl
i f e q ( $( HOST ) , m i n t )
CFLAGS += $( shell curl-config --cflags)
LDFLAGS += $( shell curl-config --libs)
e l s e
$( eval $( call pkg_config_find_and_add_enabled,CURL,libcurl,Curl) )
e n d i f
2016-10-19 12:12:41 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,OPENSSL ,openssl ,OpenSSL ) )
2016-08-13 15:09:39 +03:00
2019-10-03 02:28:08 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,UTF 8PROC ,libutf 8proc ,utf 8) )
2023-11-26 18:51:40 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,JPEGXL ,libjxl ,JPEGXL ) )
2019-02-17 15:09:17 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,WEBP ,libwebp ,WEBP ) )
2016-05-06 00:28:51 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,PNG ,libpng ,PNG ) )
$( eval $ ( call pkg_config_find_and_add_enabled ,BMP ,libnsbmp ,BMP ) )
$( eval $ ( call pkg_config_find_and_add_enabled ,GIF ,libnsgif ,GIF ) )
$( eval $ ( call pkg_config_find_and_add_enabled ,NSSVG ,libsvgtiny ,SVG ) )
$( eval $ ( call pkg_config_find_and_add_enabled ,ROSPRITE ,librosprite ,Sprite ) )
2016-09-20 23:45:35 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,NSPSL ,libnspsl ,PSL ) )
2017-08-31 09:57:35 +03:00
$( eval $ ( call pkg_config_find_and_add_enabled ,NSLOG ,libnslog ,LOG ) )
2016-05-06 00:28:51 +03:00
2016-06-06 16:47:27 +03:00
# List of directories in which headers are searched for
INCLUDE_DIRS := . include $( OBJROOT)
2012-12-20 19:27:07 +04:00
# export the user agent format
2008-07-29 19:10:31 +04:00
CFLAGS += -DNETSURF_UA_FORMAT_STRING= \" $( NETSURF_UA_FORMAT_STRING) \"
2014-09-05 19:01:44 +04:00
CXXFLAGS += -DNETSURF_UA_FORMAT_STRING= \" $( NETSURF_UA_FORMAT_STRING) \"
2008-07-29 19:10:31 +04:00
2012-12-20 19:27:07 +04:00
# set the default homepage to use
CFLAGS += -DNETSURF_HOMEPAGE= \" $( NETSURF_HOMEPAGE) \"
2014-09-05 19:01:44 +04:00
CXXFLAGS += -DNETSURF_HOMEPAGE= \" $( NETSURF_HOMEPAGE) \"
Merged revisions 5309-5406,5409-5422 via svnmerge from
svn://svn.netsurf-browser.org/branches/vince/netsurf-fb
........
r5309 | vince | 2008-09-13 10:59:10 +0100 (Sat, 13 Sep 2008) | 2 lines
first stab at framebuffer frontend
........
r5313 | vince | 2008-09-14 15:08:52 +0100 (Sun, 14 Sep 2008) | 2 lines
add line plotters
........
r5314 | vince | 2008-09-14 15:28:12 +0100 (Sun, 14 Sep 2008) | 2 lines
add rectangle plot to 16bpp plotters
........
r5315 | vince | 2008-09-14 19:58:57 +0100 (Sun, 14 Sep 2008) | 2 lines
improve 16bpp image plot
........
r5316 | vince | 2008-09-15 00:35:32 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract the os specific framebuffer init
........
r5317 | vince | 2008-09-15 11:18:51 +0100 (Mon, 15 Sep 2008) | 2 lines
first cut of linux frontend
........
r5318 | vince | 2008-09-15 12:01:00 +0100 (Mon, 15 Sep 2008) | 2 lines
remove junk includes
........
r5319 | vince | 2008-09-15 12:09:02 +0100 (Mon, 15 Sep 2008) | 2 lines
make plotters OS agnostic again
........
r5322 | vince | 2008-09-15 15:55:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Linux frontend operates
........
r5323 | vince | 2008-09-15 16:32:47 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract out OS specific input
........
r5326 | vince | 2008-09-15 19:21:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Improve linux mode setting
........
r5329 | vince | 2008-09-15 21:13:33 +0100 (Mon, 15 Sep 2008) | 2 lines
improve text clipping
........
r5339 | vince | 2008-09-16 00:07:57 +0100 (Tue, 16 Sep 2008) | 2 lines
possibly fix text clipping issue
........
r5342 | vince | 2008-09-16 00:39:36 +0100 (Tue, 16 Sep 2008) | 2 lines
consolidate polygon plotters
........
r5344 | dsilvers | 2008-09-16 10:21:06 +0100 (Tue, 16 Sep 2008) | 1 line
Fix up the framebuffer target makefile a bit more, add some config options for it
........
r5345 | dsilvers | 2008-09-16 10:22:19 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure the appropriate frontend is selected when building framebuffer
........
r5346 | dsilvers | 2008-09-16 10:27:16 +0100 (Tue, 16 Sep 2008) | 1 line
Update build system to support targetting separate framebuffer frontends in different build trees, update executable to be nsfb-blah
........
r5350 | vince | 2008-09-16 17:15:04 +0100 (Tue, 16 Sep 2008) | 1 line
Add -g to provide symbols for framebuffer link
........
r5351 | vince | 2008-09-16 17:17:09 +0100 (Tue, 16 Sep 2008) | 1 line
framebuffer scheduler now works, plotters tweaked, gui tracks window redraw requirements better, keypresses not duplicated under linux fb
........
r5352 | dsilvers | 2008-09-16 17:38:53 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure we only allow one fetcher at a time
........
r5361 | vince | 2008-09-17 11:48:44 +0100 (Wed, 17 Sep 2008) | 2 lines
initial cursor support
........
r5362 | vince | 2008-09-17 13:56:47 +0100 (Wed, 17 Sep 2008) | 2 lines
add mouse handling
........
r5363 | vince | 2008-09-17 14:14:44 +0100 (Wed, 17 Sep 2008) | 2 lines
add framebuffer resources
........
r5364 | vince | 2008-09-17 17:12:21 +0100 (Wed, 17 Sep 2008) | 2 lines
add reasonable pointer
........
r5366 | vince | 2008-09-17 17:17:25 +0100 (Wed, 17 Sep 2008) | 2 lines
fix pointer alpha
........
r5370 | vince | 2008-09-18 13:43:53 +0100 (Thu, 18 Sep 2008) | 2 lines
warning squash and cleanup ready for trunk merge
........
r5375 | vince | 2008-09-19 14:58:43 +0100 (Fri, 19 Sep 2008) | 2 lines
Working mouse navigation
........
r5377 | vince | 2008-09-20 14:06:22 +0100 (Sat, 20 Sep 2008) | 2 lines
Improve scrolling
........
r5378 | vince | 2008-09-20 14:46:46 +0100 (Sat, 20 Sep 2008) | 2 lines
fix redraw issues with scrolling
........
r5380 | vince | 2008-09-20 17:08:43 +0100 (Sat, 20 Sep 2008) | 3 lines
Alter panning to use its own flag so it doesnt cause invalid redraw
operations
........
r5381 | vince | 2008-09-20 21:52:45 +0100 (Sat, 20 Sep 2008) | 2 lines
add dummy framebuffer
........
r5383 | vince | 2008-09-21 00:00:15 +0100 (Sun, 21 Sep 2008) | 2 lines
fix segfault when cursor is off teh bottom of teh screen
........
r5384 | vince | 2008-09-21 00:06:08 +0100 (Sun, 21 Sep 2008) | 2 lines
fix off by one in pointer fix
........
r5385 | vince | 2008-09-21 00:25:09 +0100 (Sun, 21 Sep 2008) | 2 lines
when fixing bloody silly off by one errors remember to fix *both* references
........
r5387 | vince | 2008-09-21 00:38:13 +0100 (Sun, 21 Sep 2008) | 2 lines
last try at stopping the pointer segfault
........
r5388 | vince | 2008-09-21 16:24:18 +0100 (Sun, 21 Sep 2008) | 2 lines
improve vertical text clipping
........
r5392 | vince | 2008-09-21 23:11:51 +0100 (Sun, 21 Sep 2008) | 2 lines
Improve text plotters
........
r5393 | vince | 2008-09-21 23:34:38 +0100 (Sun, 21 Sep 2008) | 2 lines
fix 32bpp line plotting
........
r5394 | vince | 2008-09-22 00:00:03 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix off by one error in line plotting clipping
........
r5397 | vince | 2008-09-22 13:46:22 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix bitmap tileing
........
r5398 | vince | 2008-09-22 17:46:02 +0100 (Mon, 22 Sep 2008) | 2 lines
enable knockout renderer
........
r5399 | vince | 2008-09-22 18:43:48 +0100 (Mon, 22 Sep 2008) | 2 lines
ensure clipping region lies within window, caused by knockout renderer
........
r5400 | vince | 2008-09-22 19:20:25 +0100 (Mon, 22 Sep 2008) | 2 lines
update cursor to one swiped from X windows
........
r5405 | vince | 2008-09-23 09:09:05 +0100 (Tue, 23 Sep 2008) | 2 lines
fix vertical scroll limit
........
r5412 | dsilvers | 2008-09-23 10:53:14 +0100 (Tue, 23 Sep 2008) | 1 line
Revert noisy fetcher patch
........
r5413 | dsilvers | 2008-09-23 10:58:00 +0100 (Tue, 23 Sep 2008) | 1 line
Add header guards
........
r5414 | dsilvers | 2008-09-23 11:31:31 +0100 (Tue, 23 Sep 2008) | 1 line
Tidy the region clipping slightly
........
r5416 | dsilvers | 2008-09-23 12:05:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rationalise how the framebuffer frontend finds resources and options
........
r5418 | dsilvers | 2008-09-23 13:59:00 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure options are overridden after load, and squash an fb_gui.c warning
........
r5419 | dsilvers | 2008-09-23 14:20:07 +0100 (Tue, 23 Sep 2008) | 1 line
Support fb_mode and fb_device options
........
r5420 | dsilvers | 2008-09-23 14:21:48 +0100 (Tue, 23 Sep 2008) | 1 line
Support option_fb_device in the able frontend
........
r5421 | dsilvers | 2008-09-23 14:25:17 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure target_blank is disabled
........
r5422 | dsilvers | 2008-09-23 14:39:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rework linux fb frontend to support scanning and opening all event devices for input
........
svn path=/trunk/netsurf/; revision=5423
2008-09-23 18:00:40 +04:00
2017-08-31 09:57:35 +03:00
# set the logging level
CFLAGS += -DNETSURF_LOG_LEVEL= $( NETSURF_LOG_LEVEL)
CXXFLAGS += -DNETSURF_LOG_LEVEL= $( NETSURF_LOG_LEVEL)
2018-07-28 16:24:31 +03:00
# If we're building the sanitize goal, override things
2018-07-28 13:17:07 +03:00
i f n e q ( $( filter -out sanitize ,$ ( MAKECMDGOALS ) ) , $( MAKECMDGOALS ) )
override NETSURF_USE_SANITIZER : = YES
override NETSURF_RECOVER_SANITIZERS : = NO
e n d i f
# If we're going to use the sanitizer set it up
i f e q ( $( NETSURF_USE_SANITIZER ) , Y E S )
SAN_FLAGS := -fsanitize= address -fsanitize= undefined
i f e q ( $( NETSURF_RECOVER_SANITIZERS ) , N O )
SAN_FLAGS += -fno-sanitize-recover
e n d i f
e l s e
SAN_FLAGS :=
e n d i f
CFLAGS += $( SAN_FLAGS)
CXXFLAGS += $( SAN_FLAGS)
LDFLAGS += $( SAN_FLAGS)
2017-09-08 23:15:41 +03:00
# and the logging filter
CFLAGS += -DNETSURF_BUILTIN_LOG_FILTER= \" $( NETSURF_BUILTIN_LOG_FILTER) \"
CXXFLAGS += -DNETSURF_BUILTIN_LOG_FILTER= \" $( NETSURF_BUILTIN_LOG_FILTER) \"
# and the verbose logging filter
CFLAGS += -DNETSURF_BUILTIN_VERBOSE_FILTER= \" $( NETSURF_BUILTIN_VERBOSE_FILTER) \"
CXXFLAGS += -DNETSURF_BUILTIN_VERBOSE_FILTER= \" $( NETSURF_BUILTIN_VERBOSE_FILTER) \"
2020-03-27 01:05:21 +03:00
# Determine if the C compiler supports statement expressions
# This is needed to permit certain optimisations in our library headers
i f n e q ( $( shell $ ( CC ) -dM -E - < /dev /null | grep __GNUC__ ) , )
CFLAGS += -DSTMTEXPR= 1
CXXFLAGS += -DSTMTEXPR= 1
e n d i f
2020-10-02 15:09:19 +03:00
# We trace during link so that we can determine if a libary changes under us in
# order to re-link. This *may* be gcc specific, so may need tweaks in future.
LDFLAGS += -Wl,--trace
2008-07-29 00:56:24 +04:00
# ----------------------------------------------------------------------------
# General make rules
# ----------------------------------------------------------------------------
2008-03-22 03:49:56 +03:00
$(OBJROOT)/created :
$( VQ) echo " MKDIR: $( OBJROOT) "
2015-08-09 14:27:28 +03:00
$( Q) $( MKDIR) -p $( OBJROOT)
2008-03-22 03:49:56 +03:00
$( Q) $( TOUCH) $( OBJROOT) /created
$(DEPROOT)/created : $( OBJROOT ) /created
$( VQ) echo " MKDIR: $( DEPROOT) "
2015-08-09 14:27:28 +03:00
$( Q) $( MKDIR) -p $( DEPROOT)
2008-03-22 03:49:56 +03:00
$( Q) $( TOUCH) $( DEPROOT) /created
2009-02-26 17:14:29 +03:00
$(TOOLROOT)/created : $( OBJROOT ) /created
$( VQ) echo " MKDIR: $( TOOLROOT) "
2015-08-09 14:27:28 +03:00
$( Q) $( MKDIR) -p $( TOOLROOT)
2009-02-26 17:14:29 +03:00
$( Q) $( TOUCH) $( TOOLROOT) /created
2015-04-07 02:08:14 +03:00
CLEANS :=
2008-12-09 14:12:58 +03:00
POSTEXES :=
2010-10-29 04:54:27 +04:00
# ----------------------------------------------------------------------------
2011-08-28 18:29:15 +04:00
# Target specific setup
2010-10-29 04:54:27 +04:00
# ----------------------------------------------------------------------------
2016-05-06 00:28:51 +03:00
i n c l u d e f r o n t e n d s / M a k e f i l e
2007-12-23 00:15:58 +03:00
2020-06-22 12:49:34 +03:00
# ----------------------------------------------------------------------------
# Build tools setup
# ----------------------------------------------------------------------------
i n c l u d e t o o l s / M a k e f i l e
2010-10-29 04:54:27 +04:00
# ----------------------------------------------------------------------------
2011-08-28 18:29:15 +04:00
# General source file setup
2010-10-29 04:54:27 +04:00
# ----------------------------------------------------------------------------
2013-03-11 21:50:12 +04:00
# Content sources
i n c l u d e c o n t e n t / M a k e f i l e
# utility sources
i n c l u d e u t i l s / M a k e f i l e
# http utility sources
i n c l u d e u t i l s / h t t p / M a k e f i l e
2017-01-15 15:47:38 +03:00
# nsurl utility sources
i n c l u d e u t i l s / n s u r l / M a k e f i l e
2013-03-11 21:50:12 +04:00
# Desktop sources
i n c l u d e d e s k t o p / M a k e f i l e
# S_COMMON are sources common to all builds
2017-01-15 15:47:38 +03:00
S_COMMON := \
$( S_CONTENT) \
$( S_FETCHERS) \
$( S_UTILS) \
$( S_HTTP) \
$( S_NSURL) \
$( S_DESKTOP) \
$( S_JAVASCRIPT_BINDING)
2010-10-29 04:54:27 +04:00
2016-06-06 16:47:27 +03:00
2015-04-07 02:08:14 +03:00
# ----------------------------------------------------------------------------
# Message targets
# ----------------------------------------------------------------------------
2016-06-07 18:01:04 +03:00
# generate the message file rules
2015-04-07 02:08:14 +03:00
$( eval $ ( foreach LANG ,$ ( MESSAGES_LANGUAGES ) , \
$( call split_messages,$( LANG) ) ) )
clean-messages :
$( VQ) echo " CLEAN: $( CLEAN_MESSAGES) "
$( Q) $( RM) $( CLEAN_MESSAGES)
CLEANS += clean-messages
2010-10-29 04:54:27 +04:00
# ----------------------------------------------------------------------------
# Source file setup
# ----------------------------------------------------------------------------
2011-08-28 18:29:15 +04:00
# Force exapnsion of source file list
SOURCES := $( SOURCES)
2010-10-29 04:54:27 +04:00
i f e q ( $( SOURCES ) , )
$( error Unable to build NetSurf , could not determine set of sources to build )
e n d i f
2011-01-19 04:36:21 +03:00
OBJECTS := $( sort $( addprefix $( OBJROOT) /,$( subst /,_,$( patsubst %.c,%.o,$( patsubst %.cpp,%.o,$( patsubst %.m,%.o,$( patsubst %.s,%.o,$( SOURCES) ) ) ) ) ) ) )
2007-12-23 00:15:58 +03:00
2016-06-07 18:01:04 +03:00
# Include directory flags
IFLAGS = $( addprefix -I,$( INCLUDE_DIRS) )
2020-10-02 15:09:19 +03:00
$(EXETARGET) : $( OBJECTS ) $( RESOURCES ) $( MESSAGES ) tools /linktrace -to -depfile .pl
2007-12-23 00:15:58 +03:00
$( VQ) echo " LINK: $( EXETARGET) "
2022-06-03 05:11:11 +03:00
i f n e q ( $( TARGET ) , r i s c o s )
2020-10-02 15:09:19 +03:00
$( Q) $( CC) -o $( EXETARGET) $( OBJECTS) $( LDFLAGS) > $( DEPROOT) /link-raw.d
2009-03-28 03:59:11 +03:00
e l s e
2022-06-03 05:11:11 +03:00
@# RISC OS targets are a bit special: we need to convert ELF -> AIF
2022-11-02 16:55:38 +03:00
ifeq ( $( SUBTARGET) ,-aof)
2022-06-03 05:11:11 +03:00
$( Q) $( CC) -o $( EXETARGET) $( OBJECTS) $( LDFLAGS) > $( DEPROOT) /link-raw.d
else
2020-10-02 15:09:19 +03:00
$( Q) $( CXX) -o $( EXETARGET:,ff8= ,e1f) $( OBJECTS) $( LDFLAGS) > $( DEPROOT) /link-raw.d
2009-03-28 03:59:11 +03:00
$( Q) $( ELF2AIF) $( EXETARGET:,ff8= ,e1f) $( EXETARGET)
$( Q) $( RM) $( EXETARGET:,ff8= ,e1f)
2022-06-03 05:11:11 +03:00
endif
2009-03-28 03:59:11 +03:00
e n d i f
2020-10-02 15:09:19 +03:00
$( VQ) echo " LINKDEPS: $( EXETARGET) "
2020-10-02 15:11:10 +03:00
$( Q) echo -n " $( EXETARGET) $( DEPROOT) /link.d: " > $( DEPROOT) /link.d
2020-10-02 15:09:19 +03:00
$( Q) $( PERL) tools/linktrace-to-depfile.pl < $( DEPROOT) /link-raw.d >> $( DEPROOT) /link.d
2008-07-29 12:57:51 +04:00
i f e q ( $( NETSURF_STRIP_BINARY ) , Y E S )
$( VQ) echo " STRIP: $( EXETARGET) "
$( Q) $( STRIP) $( EXETARGET)
e n d i f
2008-06-04 00:13:34 +04:00
i f e q ( $( TARGET ) , b e o s )
$( 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) " \
2021-01-24 20:51:06 +03:00
-long " NetSurf $( VERSION_FULL) © 2003 - 2021 The NetSurf Developers "
2008-06-04 00:13:34 +04:00
$( VQ) echo " MIMESET: $( EXETARGET) "
$( Q) $( BEOS_MIMESET) $( EXETARGET)
e n d i f
2007-12-23 00:15:58 +03:00
clean-target :
$( VQ) echo " CLEAN: $( EXETARGET) "
$( Q) $( RM) $( EXETARGET)
2015-04-07 02:08:14 +03:00
CLEANS += clean-target
2007-12-23 00:15:58 +03:00
2011-03-13 14:59:20 +03:00
2007-12-23 00:15:58 +03:00
clean-builddir :
$( VQ) echo " CLEAN: $( OBJROOT) "
$( Q) $( RM) -r $( OBJROOT)
CLEANS += clean-builddir
2008-12-09 14:12:58 +03:00
2020-06-22 12:49:34 +03:00
.PHONY : all -program
2011-03-13 14:59:20 +03:00
2015-04-07 02:08:14 +03:00
all-program : $( EXETARGET ) $( POSTEXES )
2007-12-23 00:15:58 +03:00
.SUFFIXES :
DEPFILES :=
# 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) ) ) ) )
2008-06-04 00:13:34 +04:00
$( eval $ ( foreach SOURCE ,$ ( filter %.cpp ,$ ( SOURCES ) ) , \
$( call dependency_generate_c,$( SOURCE) ,$( subst /,_,$( SOURCE:.cpp= .d) ) ,$( subst /,_,$( SOURCE:.cpp= .o) ) ) ) )
2011-01-19 04:36:21 +03:00
$( eval $ ( foreach SOURCE ,$ ( filter %.m ,$ ( SOURCES ) ) , \
$( call dependency_generate_c,$( SOURCE) ,$( subst /,_,$( SOURCE:.m= .d) ) ,$( subst /,_,$( SOURCE:.m= .o) ) ) ) )
2007-12-23 00:15:58 +03:00
# 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)))))
2015-07-09 00:17:20 +03:00
i f e q ( $( filter $ ( MAKECMDGOALS ) ,clean test coverage ) , )
2008-03-05 15:30:29 +03:00
- i n c l u d e $( sort $ ( addprefix $ ( DEPROOT ) /,$ ( DEPFILES ) ) )
2020-10-02 15:09:19 +03:00
- i n c l u d e $( DEPROOT ) / l i n k . d
2007-12-23 00:15:58 +03:00
e n d i f
# 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) ) ) ) )
2008-06-04 00:13:34 +04:00
$( eval $ ( foreach SOURCE ,$ ( filter %.cpp ,$ ( SOURCES ) ) , \
$( call compile_target_cpp,$( SOURCE) ,$( subst /,_,$( SOURCE:.cpp= .o) ) ,$( subst /,_,$( SOURCE:.cpp= .d) ) ) ) )
2011-01-19 04:36:21 +03:00
$( eval $ ( foreach SOURCE ,$ ( filter %.m ,$ ( SOURCES ) ) , \
$( call compile_target_c,$( SOURCE) ,$( subst /,_,$( SOURCE:.m= .o) ) ,$( subst /,_,$( SOURCE:.m= .d) ) ) ) )
2007-12-23 00:15:58 +03:00
$( eval $ ( foreach SOURCE ,$ ( filter %.s ,$ ( SOURCES ) ) , \
$( call compile_target_s,$( SOURCE) ,$( subst /,_,$( SOURCE:.s= .o) ) ,$( subst /,_,$( SOURCE:.s= .d) ) ) ) )
2015-07-07 18:02:54 +03:00
# ----------------------------------------------------------------------------
# Test setup
# ----------------------------------------------------------------------------
i n c l u d e t e s t / M a k e f i l e
# ----------------------------------------------------------------------------
# Clean setup
# ----------------------------------------------------------------------------
.PHONY : clean
2007-12-23 00:15:58 +03:00
clean : $( CLEANS )
2008-03-09 20:06:45 +03:00
2015-07-07 18:02:54 +03:00
# ----------------------------------------------------------------------------
# build distribution package
# ----------------------------------------------------------------------------
.PHONY : package -$( TARGET ) package
2012-08-23 14:46:31 +04:00
package : all -program package -$( TARGET )
2009-04-17 19:25:02 +04:00
2013-04-29 01:09:03 +04:00
2015-07-07 18:02:54 +03:00
# ----------------------------------------------------------------------------
# local install on the host system
# ----------------------------------------------------------------------------
.PHONY : install install -$( TARGET )
install : all -program install -$( TARGET )
# ----------------------------------------------------------------------------
# Documentation build
# ----------------------------------------------------------------------------
.PHONY : docs
2017-06-09 19:28:55 +03:00
docs : docs /Doxyfile
2015-10-07 11:18:14 +03:00
doxygen $<
2015-07-07 18:02:54 +03:00
# ----------------------------------------------------------------------------
# Transifex message processing
# ----------------------------------------------------------------------------
2013-05-08 01:52:30 +04:00
.PHONY : messages -split -tfx messages -fetch -tfx messages -import -tfx
# split fat messages into properties files suitable for uploading to transifex
messages-split-tfx :
2024-05-25 20:24:03 +03:00
for splitlang in $( FAT_LANGUAGES) ; do $( PERL) ./utils/split-messages.pl -l $$ { splitlang} -f transifex -p any -o Messages.any.$$ { splitlang} .tfx resources/FatMessages; done
2013-05-08 01:52:30 +04:00
# download property files from transifex
messages-fetch-tfx :
2024-05-25 20:24:03 +03:00
for splitlang in $( FAT_LANGUAGES) ; do $( RM) Messages.any.$$ { splitlang} .tfx ; $( PERL) ./utils/fetch-transifex.pl -w insecure -l $$ { splitlang} -o Messages.any.$$ { splitlang} .tfx ; done
2013-05-08 01:52:30 +04:00
# merge property files into fat messages
messages-import-tfx : messages -fetch -tfx
2024-05-25 20:24:03 +03:00
for tfxlang in $( FAT_LANGUAGES) ; do $( PERL) ./utils/import-messages.pl -l $$ { tfxlang} -p any -f transifex -o resources/FatMessages -i resources/FatMessages -I Messages.any.$$ { tfxlang} .tfx ; $( RM) Messages.any.$$ { tfxlang} .tfx; done
2013-04-29 01:09:03 +04:00