From 42da88597339feda94e4efb0f0dc79e008df5ac0 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 7 Sep 2008 16:41:49 +0000 Subject: Native RO buildsystem. Beware of the NOP. svn path=/trunk/hubbub/; revision=5275 --- Makefile-ronative | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ build/Makefile.common | 4 ++-- src/Makefile | 4 ++-- test/Makefile | 10 +++++++-- 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 Makefile-ronative diff --git a/Makefile-ronative b/Makefile-ronative new file mode 100644 index 0000000..9479d90 --- /dev/null +++ b/Makefile-ronative @@ -0,0 +1,57 @@ +# Toolchain definitions for building on RISC OS +GCCSDK_INSTALL_ENV ?= + +CC := gcc +AR := ar +LD := gcc + +CP := cp +RM := rm +MKDIR := mkdir +MV := mv +ECHO := echo +MAKE := make +PERL := perl +# As good a way of doing nothing as we get, really (FX 1 == set user flag, X ignores errors) +PKGCONFIG := X FX 1 +INSTALL := echo +SED := sed +TOUCH := touch +LCOV := echo +GENHTML := echo + +# Toolchain flags +WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ + -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wnested-externs -Werror -pedantic +CFLAGS = -std=c99 -D_BSD_SOURCE -I$(TOP)/include/ $(WARNFLAGS) \ + -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include +RELEASECFLAGS = $(CFLAGS) -DNDEBUG -O2 +DEBUGCFLAGS = $(CFLAGS) -O0 -g +ARFLAGS := -cru +LDFLAGS = -L$(GCCSDK_INSTALL_ENV)/libs -L$(TOP)/ + +CPFLAGS := +RMFLAGS := -f +MKDIRFLAGS := -p +MVFLAGS := +ECHOFLAGS := +MAKEFLAGS := +PKGCONFIGFLAGS := +TOUCHFLAGS := + +EXEEXT := + +# Default installation prefix +PREFIX ?= $(GCCSDK_INSTALL_ENV) + +# This is nasty, but needed because $(CURDIR) will +# contain colons, and thus confuse make mightily +$(shell SetMacro Alias$$Hubbubpwd Set %0 :|$$CSD>|mUnset Alias$$Hubbubpwd) +$(shell Hubbubpwd Hubbub$$Dir) +TOP := + +# Tell everyone that we're building on RISC OS, so they can work around things. +HOST := riscos + +include build/Makefile.common diff --git a/build/Makefile.common b/build/Makefile.common index 5c8a850..7d8c66b 100644 --- a/build/Makefile.common +++ b/build/Makefile.common @@ -7,8 +7,8 @@ all: release COMPONENT := libhubbub # Environment -EXPORT := $(CURDIR)/dist -TOP := $(CURDIR) +TOP ?= $(CURDIR) +EXPORT := $(TOP)/dist RELEASEDIR := build/Release DEBUGDIR := build/Debug COVERAGEDIR := build/coverage diff --git a/src/Makefile b/src/Makefile index 72b5c3d..14c6d8b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -32,8 +32,8 @@ dirstack_$(sp) := $(d) d := $(DIR) # Manipulate include paths -CFLAGS := $(CFLAGS) -I$(d) `$(PKGCONFIG) libparserutils --cflags` -LDFLAGS := $(LDFLAGS) `$(PKGCONFIG) libparserutils --libs` +CFLAGS := $(CFLAGS) -I$(d) $(shell $(PKGCONFIG) libparserutils --cflags) +LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils --libs) # Sources SRCS_$(d) := hubbub.c parser.c diff --git a/test/Makefile b/test/Makefile index a26df39..c74854d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -34,9 +34,9 @@ d := $(DIR) # Extend toolchain settings # We require the presence of libjson -- http://oss.metaparadigm.com/json-c/ CFLAGS := $(CFLAGS) -I$(TOP)/src/ -I$(d) \ - `$(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json` \ + $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json) \ -Wno-unused-parameter -LDFLAGS := $(LDFLAGS) `$(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json` +LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json) ifdef PROFILE CFLAGS := $(CFLAGS) -pg -fno-omit-frame-pointer @@ -78,8 +78,14 @@ $(2): $(1) endef # Build rules for each test binary -- they all depend on the debug library +# Except when building on RISC OS, of course because then make utterly fails to +# detect that the debug library exists. define compile_test +ifeq ($(HOST),riscos) +$(2): $(3) +else $(2): $(3) $(TOP)/$(COMPONENT)-debug.a +endif @$$(ECHO) $$(ECHOFLAGS) "==> $(1)" @$$(CC) -c -g $$(DEBUGCFLAGS) -o $$@.o $(1) @$$(LD) -g -o $$@ $$@.o -lhubbub-debug $$(LDFLAGS) -lgcov -- cgit v1.2.3