[project @ 2004-06-02 21:40:55 by bursa]

Add some comments and targets and clean up.

svn path=/import/netsurf/; revision=924
This commit is contained in:
James Bursa 2004-06-02 21:40:55 +00:00
parent f28b24d306
commit e6909120d6
3 changed files with 114 additions and 77 deletions

158
makefile
View File

@ -4,50 +4,68 @@
# http://www.opensource.org/licenses/gpl-license
#
# The 'all' target is presented first so as not to screw up over targets included
# in the platform specific files
# There are 5 possible builds of NetSurf:
#
# riscos -- standard RISC OS build
# riscos_small -- identical to "riscos", but linked with smaller libraries
# (no openssl, and libcurl without ssl support)
# debug -- command line Unix/Linux, for debugging
# riscos_debug -- a cross between "riscos" and "debug"
# gtk -- experimental gtk version
#
# "riscos", "riscos_small", and "riscos_debug" can be compiled under RISC OS,
# or cross-compiled using gccsdk.
all: !NetSurf/!RunImage,ff8 $(DOCS)
OBJECTS_COMMON = cache.o content.o fetch.o fetchcache.o # content/
OBJECTS_COMMON += css.o css_enum.o parser.o ruleset.o scanner.o # css/
OBJECTS_COMMON += box.o form.o html.o layout.o textplain.o # render/
OBJECTS_COMMON += messages.o pool.o translit.o url.o utils.o # utils/
OBJECTS_COMMON += imagemap.o loginlist.o options.o # desktop/
OBJECTS_COMMON = cache.o content.o fetch.o fetchcache.o \
css.o css_enum.o parser.o ruleset.o scanner.o \
box.o form.o html.o layout.o textplain.o \
messages.o utils.o translit.o pool.o url.o imagemap.o \
jpeg.o save_complete.o loginlist.o gif.o gifread.o
OBJECTS = $(OBJECTS_COMMON) \
browser.o netsurf.o options.o \
htmlinstance.o htmlredraw.o \
401login.o constdata.o dialog.o download.o frames.o wimp.o gui.o \
menus.o mouseactions.o \
textselection.o toolbar.o theme.o window.o \
draw.o plugin.o png.o sprite.o \
about.o filetype.o font.o uri.o url_protocol.o history.o \
version.o thumbnail.o \
save.o save_draw.o save_text.o schedule.o help.o
OBJECTS_RISCOS = $(OBJECTS_COMMON)
OBJECTS_RISCOS += browser.o netsurf.o version.o # desktop/
OBJECTS_RISCOS += 401login.o about.o constdata.o dialog.o download.o \
draw.o filetype.o font.o gif.o gifread.o gui.o help.o \
history.o htmlinstance.o htmlredraw.o jpeg.o menus.o \
mouseactions.o plugin.o png.o save.o save_complete.o \
save_draw.o save_text.o schedule.o sprite.o \
textselection.o theme.o thumbnail.o toolbar.o uri.o \
url_protocol.o wimp.o window.o # riscos/
OBJECTS_DEBUG = $(OBJECTS_COMMON) \
netsurfd.o \
options.o filetyped.o fontd.o
OBJECTS_DEBUGRO = $(OBJECTS_COMMON) \
netsurfd.o \
constdata.o \
theme.o \
draw.o gif.o png.o sprite.o \
about.o filetype.o \
version.o \
options.o font.o schedule.o
OBJECTS_DEBUG = $(OBJECTS_COMMON)
OBJECTS_DEBUG += filetyped.o fontd.o netsurfd.o # debug/
OBJECTS_DEBUG += gif.o gifread.o jpeg.o png.o save_complete.o schedule.o \
save_draw.o # riscos/
OBJDIR = $(shell $(CC) -dumpmachine)
SOURCES=$(OBJECTS:.o=.c)
OBJS=$(OBJECTS:%.o=$(OBJDIR)/%.o)
OBJECTS_DEBUGRO = $(OBJECTS_COMMON)
OBJECTS_DEBUGRO += netsurfd.o # debug/
OBJECTS_DEBUGRO += version.o # desktop/
OBJECTS_DEBUGRO += about.o constdata.o draw.o filetype.o font.o \
gif.o gifread.o jpeg.o png.o save_complete.o schedule.o \
sprite.o theme.o toolbar.o wimp.o # riscos/
OBJECTS_GTK = $(OBJECTS_COMMON)
OBJECTS_GTK += filetyped.o # debug/
OBJECTS_GTK += browser.o netsurf.o # desktop/
OBJECTS_GTK += font_pango.o gtk_gui.o # gtk/
OBJDIR_RISCOS = $(shell $(CC) -dumpmachine)
SOURCES_RISCOS=$(OBJECTS_RISCOS:.o=.c)
OBJS_RISCOS=$(OBJECTS_RISCOS:%.o=$(OBJDIR_RISCOS)/%.o)
OBJDIR_DEBUG = $(shell $(CC_DEBUG) -dumpmachine)-debug
SOURCES_DEBUG=$(OBJECTS_DEBUG:.o=.c)
OBJS_DEBUG=$(OBJECTS_DEBUG:%.o=$(OBJDIR_DEBUG)/%.o)
OBJS_DEBUGRO=$(OBJECTS_DEBUGRO:%.o=$(OBJDIR_DEBUG)/%.o)
# Inclusion of platform specific files has to occur after the OBJDIR stuff as that
# is refered to in the files
OBJS_DEBUGRO=$(OBJECTS_DEBUGRO:%.o=$(OBJDIR_RISCOS)/%.o)
OBJDIR_GTK = $(shell gcc -dumpmachine)-gtk
SOURCES_GTK=$(OBJECTS_GTK:.o=.c)
OBJS_GTK=$(OBJECTS_GTK:%.o=$(OBJDIR_GTK)/%.o)
# Inclusion of platform specific files has to occur after the OBJDIR stuff as
# that is refered to in the files
OS = $(word 2,$(subst -, ,$(shell $(CC) -dumpmachine)))
ifeq ($(OS),riscos)
@ -56,7 +74,7 @@ else
include posix.mk
endif
VPATH = content:css:desktop:render:riscos:utils:debug
VPATH = content:css:desktop:render:riscos:utils:debug:gtk
WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-qual \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
@ -64,31 +82,50 @@ WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-qual \
-Wnested-externs -Winline -Wno-unused-parameter -Wuninitialized
# CFLAGS have to appear after the inclusion of platform specific files as the
# PLTFORM_CFLAGS variables are defined in them
# PLATFORM_CFLAGS variables are defined in them
CFLAGS = -std=c9x -D_BSD_SOURCE -Driscos -DBOOL_DEFINED -O $(WARNFLAGS) -I.. \
$(PLATFORM_CFLAGS) -mpoke-function-name
CFLAGS_DEBUG = -std=c9x -D_BSD_SOURCE $(WARNFLAGS) -I.. $(PLATFORM_CFLAGS_DEBUG) -g
CFLAGS_RISCOS = -std=c9x -D_BSD_SOURCE -Driscos -DBOOL_DEFINED -O \
$(WARNFLAGS) -I.. $(PLATFORM_CFLAGS) -mpoke-function-name
CFLAGS_DEBUG = -std=c9x -D_BSD_SOURCE -Ddebug $(WARNFLAGS) -I.. \
$(PLATFORM_CFLAGS_DEBUG) -g
CFLAGS_GTK = -std=c9x -D_BSD_SOURCE -D_POSIX_C_SOURCE -Dgtk \
$(WARNFLAGS) -I.. -g \
`pkg-config --cflags gtk+-2.0` `xml2-config --cflags`
# targets
u!RunImage,ff8 : $(OBJS)
riscos: $(RUNIMAGE)
$(RUNIMAGE) : $(OBJS_RISCOS)
$(CC) -o $@ $(LDFLAGS_RISCOS) $^
riscos_small: u!RunImage,ff8
u!RunImage,ff8 : $(OBJS_RISCOS)
$(CC) -o $@ $(LDFLAGS_SMALL) $^
netsurf.zip: !NetSurf/!RunImage,ff8 $(DOCS)
debug: nsdebug
nsdebug: $(OBJS_DEBUG)
$(CC_DEBUG) -o $@ $(LDFLAGS_DEBUG) $^
riscos_debug: nsrodebug,ff8
nsrodebug,ff8: $(OBJS_DEBUGRO)
$(CC) -o $@ $(LDFLAGS_RISCOS) $^
gtk: nsgtk
nsgtk: $(OBJS_GTK)
gcc -o nsgtk `pkg-config --cflags --libs gtk+-2.0 gthread-2.0` \
$(LDFLAGS_DEBUG) $^
netsurf.zip: $(RUNIMAGE)
rm netsurf.zip; riscos-zip -9vr, netsurf.zip !NetSurf
# debug targets
debug: netsurf
netsurf: $(OBJS_DEBUG)
$(CC_DEBUG) -o $@ $(LDFLAGS_DEBUG) $^
debugro: nsdebug,ff8
nsdebug,ff8: $(OBJS_DEBUGRO)
$(CC_DEBUG) -o $@ $(LDFLAGS_DEBUG) $^
# pattern rule for c source
$(OBJDIR)/%.o : %.c
$(CC) -o $@ -c $(CFLAGS) $<
$(OBJDIR_RISCOS)/%.o : %.c
@echo "==> $<"
@$(CC) -o $@ -c $(CFLAGS_RISCOS) $<
$(OBJDIR_DEBUG)/%.o : %.c
$(CC_DEBUG) -o $@ -c $(CFLAGS_DEBUG) $<
@echo "==> $<"
@$(CC_DEBUG) -o $@ -c $(CFLAGS_DEBUG) $<
$(OBJDIR_GTK)/%.o : %.c
@echo "==> $<"
@gcc -o $@ -c $(CFLAGS_GTK) $<
# special cases
css/css_enum.c css/css_enum.h: css/css_enums css/makeenum
@ -101,12 +138,17 @@ utils/translit.c: transtab
cd utils; ./tt2code < transtab > translit.c
# generate dependencies
depend : $(SOURCES) $(SOURCES_DEBUG)
-mkdir $(OBJDIR) $(OBJDIR_DEBUG)
$(CC) -MM -MG $(CFLAGS) $^ | sed 's|.*\.o:|$(OBJDIR)/&|g' > $@
$(CC_DEBUG) -MM -MG $(CFLAGS_DEBUG) $^ | sed 's|.*\.o:|$(OBJDIR_DEBUG)/&|g' >> $@
depend : $(SOURCES_RISCOS) $(SOURCES_DEBUG) $(SOURCES_GTK)
-mkdir $(OBJDIR_RISCOS) $(OBJDIR_DEBUG) $(OBJDIR_GTK)
$(CC) -MM -MG $(CFLAGS_RISCOS) $^ | sed 's|.*\.o:|$(OBJDIR_RISCOS)/&|g' > depend
$(CC_DEBUG) -MM -MG $(CFLAGS_DEBUG) $^ | sed 's|.*\.o:|$(OBJDIR_DEBUG)/&|g' >> depend
# remove generated files
clean :
-rm $(OBJDIR)/* $(OBJDIR_DEBUG)/* depend css/css_enum.c css/css_enum.h \
-rm $(OBJDIR_RISCOS)/* $(OBJDIR_DEBUG)/* $(OBJDIR_GTK)/* \
depend css/css_enum.c css/css_enum.h \
css/parser.c css/parser.h css/scanner.c css/scanner.h
ifneq ($(OS),riscos)
include depend
endif

View File

@ -1,15 +1,14 @@
CC = /riscos/bin/gcc
CC_DEBUG = gcc
PLATFORM_CFLAGS =
PLATFORM_CFLAGS_DEBUG = -I/usr/include/libxml2 -I/riscos/include
PLATFORM_CFLAGS_RISCOS =
PLATFORM_CFLAGS_DEBUG = -I/usr/include/libxml2 -I/riscos/src/OSLib \
-I/riscos/include/libjpeg -D_POSIX_C_SOURCE
LDFLAGS = -L/riscos/lib -lxml2 -lz -lcurl -lssl -lcrypto -lcares -lanim -lpng \
-loslib -ljpeg
LDFLAGS_SMALL = -L/riscos/lib -lxml2 -lz -lucurl -lcares -lanim -lpng -loslib -ljpeg
LDFLAGS_DEBUG = -L/usr/lib -lxml2 -lz -lm -lcurl -lssl -lcrypto -ldl -ljpeg
LDFLAGS_RISCOS = -L/riscos/lib -lxml2 -lz -lcurl -lssl -lcrypto -lcares -lpng \
-loslib -ljpeg
LDFLAGS_SMALL = -L/riscos/lib -lxml2 -lz -lucurl -lcares -lpng -loslib -ljpeg
LDFLAGS_DEBUG = -L/usr/lib -lxml2 -lz -lm -lcurl -lssl -lcrypto -ldl -lpng \
-ljpeg
!NetSurf/!RunImage,ff8 : $(OBJS)
$(CC) -o $@ $(LDFLAGS) $^
include depend
RUNIMAGE = !NetSurf/!RunImage,ff8

View File

@ -1,18 +1,14 @@
CC = gcc
CC_DEBUG = gcc
PLATFORM_CFLAGS = -INSLibs:include -IOSLib:
PLATFORM_CFLAGS_RISCOS = -INSLibs:include -IOSLib:
PLATFORM_CFLAGS_DEBUG = -INSLibs:include -IOSLib:
LDFLAGS = NSLibs:lib/libxml2 NSLibs:lib/libz NSLibs:lib/libcurl \
LDFLAGS_RISCOS = NSLibs:lib/libxml2 NSLibs:lib/libz NSLibs:lib/libcurl \
NSLibs:lib/libssl NSLibs:lib/libcrypto NSLibs:lib/libares \
NSLibs:lib/libanim NSLibs:lib/libpng NSLibs:lib/libjpeg OSLib:o.oslib32
NSLibs:lib/libpng NSLibs:lib/libjpeg OSLib:o.oslib32
LDFLAGS_SMALL = NSLibs:lib/libxml2 NSLibs:lib/libz NSLibs:lib/libcurl \
NSLibs:lib/libares NSLibs:lib/libanim NSLibs:lib/libpng \
NSLibs:lib/libares NSLibs:lib/libpng \
NSLibs:lib/libjpeg OSLib:o.oslib32
LDFLAGS_DEBUG = NSLibs:lib/libxml2 NSLibs:lib/libz NSLibs:lib/libcurl \
NSLibs:lib/libssl NSLibs:lib/libcrypto NSLibs:lib/libares \
NSLibs:lib/libanim NSLibs:lib/libpng NSLibs:lib/libjpeg OSLib:o.oslib32
!NetSurf/!RunImage,ff8 : $(OBJS)
$(CC) -o !NetSurf/!RunImage $(LDFLAGS) $^
RUNIMAGE = !NetSurf/!RunImage