]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Add support for cross-compiling to RISC OS.
authorJames Bursa <james@netsurf-browser.org>
Sun, 3 Feb 2008 18:27:57 +0000 (18:27 -0000)
committerJames Bursa <james@netsurf-browser.org>
Sun, 3 Feb 2008 18:27:57 +0000 (18:27 -0000)
svn path=/trunk/libsvgtiny/; revision=3831

makefile
svgtiny_display

index c4ca3f6485928eae06e75560b47b96d7e4933cbd..565e46e52e0a69363782dbf2943a52196ba04d90 100644 (file)
--- 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 $@ $<
index 4bc1396f3f73e77f7adc426ac2991c2ea5a72358..3fa4926c4f9ec0d54cd7214daefefe26ce033e22 100755 (executable)
@@ -1,3 +1,3 @@
 set -e
 make
-./svgtiny_test $1 | convert mvg:- png:- | display -
+bin/svgtiny_test $1 | convert mvg:- png:- | display -