summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile-ronative57
-rw-r--r--build/Makefile.common4
-rw-r--r--src/Makefile4
-rw-r--r--test/Makefile10
4 files changed, 69 insertions, 6 deletions
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 ?= <NSLibs$$Dir>
+
+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 <FileSwitch$$CurrentFilingSystem>:|<FileSwitch$$<FileSwitch$$CurrentFilingSystem>$$CSD>|mUnset Alias$$Hubbubpwd)
+$(shell Hubbubpwd Hubbub$$Dir)
+TOP := <Hubbub$$Dir>
+
+# 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