summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2008-02-03 18:27:57 (GMT)
committer James Bursa <james@netsurf-browser.org>2008-02-03 18:27:57 (GMT)
commit508052e6ae2ce1b98735e133433009cc5274cb32 (patch)
treeb08690b1624d3a048a238aa94d189d2f60b57a9b
parent2cdbd4fcb47430897d7aa896542dacb54c461cbc (diff)
downloadlibsvgtiny-508052e6ae2ce1b98735e133433009cc5274cb32.tar.gz
libsvgtiny-508052e6ae2ce1b98735e133433009cc5274cb32.tar.bz2
Add support for cross-compiling to RISC OS.
svn path=/trunk/libsvgtiny/; revision=3831
-rw-r--r--makefile66
-rwxr-xr-xsvgtiny_display2
2 files changed, 49 insertions, 19 deletions
diff --git a/makefile b/makefile
index c4ca3f6..565e46e 100644
--- a/makefile
+++ b/makefile
@@ -8,31 +8,61 @@
SOURCE = svgtiny.c colors.c
HDRS = svgtiny.h
-.PHONY: all install clean
-
-CFLAGS = -std=c99 -g -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
+CFLAGS = -std=c99 -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
- -Wnested-externs -Winline -Wno-cast-align \
- `xml2-config --cflags`
-LIBS = `xml2-config --libs`
+ -Wnested-externs -Winline -Wno-cast-align
ARFLAGS = cr
-OBJS = $(SOURCE:.c=.o)
+ifeq ($(TARGET),riscos)
+GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin
+GCCSDK_INSTALL_ENV ?= /home/riscos/env
+CC = $(GCCSDK_INSTALL_CROSSBIN)/gcc
+AR = $(GCCSDK_INSTALL_CROSSBIN)/ar
+CFLAGS += -Driscos -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include \
+ -I$(GCCSDK_INSTALL_ENV)/include/libxml2
+LIBS = -L$(GCCSDK_INSTALL_ENV)/lib -lxml2 -lz
+EXEEXT = ,ff8
+else
+CFLAGS += -g `xml2-config --cflags` -fgnu89-inline
+LIBS = `xml2-config --libs`
+endif
-all: libsvgtiny.a svgtiny_test$(EXEEXT)
+ifeq ($(TARGET),)
+OBJDIR = objects
+LIBDIR = lib
+BINDIR = bin
+else
+OBJDIR = $(TARGET)-objects
+LIBDIR = $(TARGET)-lib
+BINDIR = $(TARGET)-bin
+endif
-libsvgtiny.a: $(OBJS)
- $(AR) $(ARFLAGS) $@ $(OBJS)
+OBJS = $(addprefix $(OBJDIR)/, $(SOURCE:.c=.o))
-svgtiny_test$(EXEEXT): svgtiny_test.c libsvgtiny.a
- $(CC) $(CFLAGS) $(LIBS) -o $@ $^
+.PHONY: all install clean
-clean:
- -rm *.o libsvgtiny.a svgtiny_test$(EXEEXT) colors.c
+all: $(LIBDIR)/libsvgtiny.a $(BINDIR)/svgtiny_test$(EXEEXT) colors.c
-colors.c: colors.gperf
- gperf --output-file=$@ $<
+$(LIBDIR)/libsvgtiny.a: $(OBJS)
+ @echo " LINK:" $@
+ @mkdir -p $(LIBDIR)
+ @$(AR) $(ARFLAGS) $@ $(OBJS)
+
+$(BINDIR)/svgtiny_test$(EXEEXT): svgtiny_test.c $(LIBDIR)/libsvgtiny.a
+ @echo " LINK:" $@
+ @mkdir -p $(BINDIR)
+ @$(CC) $(CFLAGS) $(LIBS) -o $@ $^
+
+$(OBJDIR)/%.o: %.c $(HDRS)
+ @echo " COMPILE:" $<
+ @mkdir -p $(OBJDIR)
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+%.c: %.gperf
+ @echo " GPERF:" $<
+ @gperf --output-file=$@ $<
+
+clean:
+ -rm $(OBJS) $(LIBDIR)/libsvgtiny.a $(BINDIR)/svgtiny_test$(EXEEXT) colors.c
-.c.o: $(HDRS)
- $(CC) $(CFLAGS) -c -o $@ $<
diff --git a/svgtiny_display b/svgtiny_display
index 4bc1396..3fa4926 100755
--- a/svgtiny_display
+++ b/svgtiny_display
@@ -1,3 +1,3 @@
set -e
make
-./svgtiny_test $1 | convert mvg:- png:- | display -
+bin/svgtiny_test $1 | convert mvg:- png:- | display -