From: James Bursa Date: Sun, 3 Feb 2008 18:27:57 +0000 (-0000) Subject: Add support for cross-compiling to RISC OS. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=508052e6ae2ce1b98735e133433009cc5274cb32;p=libsvgtiny.git Add support for cross-compiling to RISC OS. svn path=/trunk/libsvgtiny/; revision=3831 --- 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 -