2007-12-23 00:15:58 +03:00
|
|
|
#
|
|
|
|
# Makefile for NetSurf
|
|
|
|
#
|
|
|
|
# Copyright 2007 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
# Trivially, invoke as:
|
|
|
|
# make -f Makefile.unix
|
|
|
|
# to build native, or:
|
|
|
|
# make -f Makefile.unix TARGET=riscos
|
|
|
|
# to cross-build for RO.
|
|
|
|
#
|
|
|
|
# Thus-far only tested on unix platforms. on RO in theory it ought to
|
|
|
|
# work as per the native build.
|
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
# make -f Makefile.unix docs
|
|
|
|
#
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
all: all-program
|
|
|
|
|
|
|
|
# Determine host type
|
|
|
|
HOST_SYSTEM := $(shell uname -s)
|
|
|
|
|
|
|
|
ifeq ($(HOST_SYSTEM),riscos)
|
|
|
|
# Native build on RO
|
|
|
|
HOST=riscos
|
|
|
|
ifeq ($(TARGET),)
|
|
|
|
TARGET := riscos
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
HOST=unix
|
|
|
|
ifeq ($(TARGET),)
|
|
|
|
TARGET := gtk
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
Q=@
|
|
|
|
VQ=@
|
|
|
|
PERL=perl
|
|
|
|
MKDIR=mkdir
|
|
|
|
TOUCH=touch
|
|
|
|
|
|
|
|
OBJROOT := $(HOST)-$(TARGET)
|
|
|
|
|
|
|
|
$(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
|
|
|
|
|
2008-02-10 01:37:51 +03:00
|
|
|
WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
|
|
|
|
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
|
|
|
|
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
|
|
|
|
-Wnested-externs -Winline -Wno-unused-parameter -Wuninitialized
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
STARTGROUP := -Wl,--start-group
|
|
|
|
ENDGROUP := -Wl,--end-group
|
|
|
|
|
|
|
|
ifeq ($(TARGET),riscos)
|
|
|
|
ifeq ($(HOST),riscos)
|
|
|
|
# Build for RO on RO
|
|
|
|
CC := gcc
|
|
|
|
else
|
|
|
|
# Cross-build for RO
|
|
|
|
CC := /home/riscos/cross/bin/gcc
|
|
|
|
endif
|
|
|
|
STARTGROUP :=
|
|
|
|
ENDGROUP :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
LDFLAGS := -lxml2 -lz -lm -lcurl -lssl -lcrypto -lmng \
|
|
|
|
-ljpeg
|
|
|
|
|
|
|
|
ifeq ($(TARGET),gtk)
|
|
|
|
# Building for GTK, we need the GTK flags
|
|
|
|
|
|
|
|
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
|
|
|
|
-DGTK_DISABLE_DEPRECATED \
|
|
|
|
-D_BSD_SOURCE \
|
|
|
|
-D_XOPEN_SOURCE=600 \
|
|
|
|
-D_POSIX_C_SOURCE=200112L \
|
|
|
|
$(WARNFLAGS) -I. -g -O \
|
|
|
|
$(shell pkg-config --cflags libglade-2.0 gtk+-2.0 librsvg-2.0) \
|
|
|
|
$(shell xml2-config --cflags)
|
|
|
|
|
|
|
|
GTKLDFLAGS := $(shell pkg-config --cflags --libs libglade-2.0 gtk+-2.0 gthread-2.0 gmodule-2.0 librsvg-2.0)
|
|
|
|
CFLAGS += $(GTKCFLAGS)
|
|
|
|
LDFLAGS += $(GTKLDFLAGS) -llcms
|
|
|
|
|
|
|
|
ifneq ($(HOST),riscos)
|
|
|
|
ifeq ($(shell uname -s),Windows_NT)
|
|
|
|
CFLAGS += -U__STRICT_ANSI__
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TARGET),riscos)
|
|
|
|
GCCSDK_INSTALL_ENV := /home/riscos/env
|
|
|
|
|
2008-02-10 01:37:51 +03:00
|
|
|
CFLAGS += -I. -O $(WARNFLAGS) -Driscos \
|
|
|
|
-std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
|
|
|
|
-mpoke-function-name
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include \
|
|
|
|
-I$(GCCSDK_INSTALL_ENV)/include/libxml2 \
|
|
|
|
-I$(GCCSDK_INSTALL_ENV)/include/libmng
|
|
|
|
ASFLAGS += -I. -I$(GCCSDK_INSTALL_ENV)/include
|
2008-02-03 22:11:36 +03:00
|
|
|
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lcares -lOSLib32 -lrufl -lpencil \
|
|
|
|
-lsvgtiny
|
2007-12-23 00:15:58 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
CLEANS := clean-target
|
|
|
|
|
|
|
|
include Makefile.sources
|
|
|
|
|
2008-03-05 15:30:29 +03:00
|
|
|
OBJECTS := $(sort $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.c,%.o,$(patsubst %.s,%.o,$(SOURCES))))))
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
$(EXETARGET): $(OBJECTS)
|
|
|
|
$(VQ)echo " LINK: $(EXETARGET)"
|
|
|
|
$(Q)$(CC) -o $(EXETARGET) $(STARTGROUP) $(OBJECTS) $(ENDGROUP) $(LDFLAGS)
|
|
|
|
|
|
|
|
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
|
|
|
|
define dependency_generate_c
|
2008-03-05 15:30:29 +03:00
|
|
|
|
2007-12-23 00:15:58 +03:00
|
|
|
DEPFILES += $(2)
|
2008-03-05 15:30:29 +03:00
|
|
|
|
2007-12-23 00:15:58 +03:00
|
|
|
$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1) css/css_enum.h css/parser.h
|
|
|
|
$$(VQ)echo " DEP: $(1)"
|
2008-03-05 15:30:29 +03:00
|
|
|
$$(Q)$$(RM) $$(DEPROOT)/$(2)
|
|
|
|
$$(Q)$$(CC) $$(CFLAGS) -M -MT '$$(DEPROOT)/$2 $$(OBJROOT)/$(3)' \
|
|
|
|
-MF $$(DEPROOT)/$(2) $(1)
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 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)"
|
2008-03-05 15:30:29 +03:00
|
|
|
$$(Q)$$(RM) $$(DEPROOT)/$(2)
|
|
|
|
$$(Q)$$(CC) $$(CFLAGS) -M -MT '$$(DEPROOT)/$2 $$(OBJROOT)/$(3)' \
|
|
|
|
-MF $$(DEPROOT)/$(2) $(1)
|
2007-12-23 00:15:58 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# 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)))))
|
|
|
|
|
|
|
|
# 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)
|
2008-03-05 15:30:29 +03:00
|
|
|
-include $(sort $(addprefix $(DEPROOT)/,$(DEPFILES)))
|
2007-12-23 00:15:58 +03:00
|
|
|
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 %.s,$(SOURCES)), \
|
|
|
|
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst /,_,$(SOURCE:.s=.d)))))
|
|
|
|
|
|
|
|
|
|
|
|
clean: $(CLEANS)
|
2008-03-09 20:06:45 +03:00
|
|
|
|
|
|
|
docs:
|
|
|
|
doxygen Docs/Doxyfile
|