summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Tytgat <joty@netsurf-browser.org>2007-06-11 20:51:19 (GMT)
committer John Tytgat <joty@netsurf-browser.org>2007-06-11 20:51:19 (GMT)
commite56e9208e7b6f6d6c3c8814edf2ce4588df67fbe (patch)
treed81fcb054c9cbc720d207acab30f45380288d6ef
parent7e4c61c041a5df2de851e79af00b45886896ef31 (diff)
downloadlibpencil-e56e9208e7b6f6d6c3c8814edf2ce4588df67fbe.tar.gz
libpencil-e56e9208e7b6f6d6c3c8814edf2ce4588df67fbe.tar.bz2
- makefile:
- support for GCCSDK 3.4 (AOF) and GCCSDK 4 (ELF) based on AB_ELFBUILD (= a variable also used in GCCSDK Autobuilder). - changed the library name from pencil.o to libpencil.a. Needed for GCCSDK 4 but if you're using -L<libdir> -lpencil in your link line, this rename make that this works for both GCCSDK 3.4 and GCCSDK 4. svn path=/trunk/pencil/; revision=3344
-rw-r--r--makefile35
1 files changed, 28 insertions, 7 deletions
diff --git a/makefile b/makefile
index ef4dbd0..56be142 100644
--- a/makefile
+++ b/makefile
@@ -6,30 +6,51 @@
#
SOURCE = pencil_build.c pencil_save.c
+HDRS = pencil.h pencil_internal.h
GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin
GCCSDK_INSTALL_ENV ?= /home/riscos/env
+ifeq (${AB_ELFBUILD},yes)
+EXEEXT=,e1f
+else
+EXEEXT=,ff8
+endif
+
+.PHONY: all install clean
+
+ifeq (${AB_ELFBUILD},yes)
+CC = $(GCCSDK_INSTALL_CROSSBIN)/arm-unknown-riscos-gcc
+AR = $(GCCSDK_INSTALL_CROSSBIN)/arm-unknown-riscos-ar
+else
CC = $(GCCSDK_INSTALL_CROSSBIN)/gcc
+AR = $(GCCSDK_INSTALL_CROSSBIN)/ar
+endif
CFLAGS = -std=c99 -O3 -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -Winline -Wno-cast-align \
-mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include
+ARFLAGS = cr
LIBS = -L$(GCCSDK_INSTALL_ENV)/lib -lOSLib32 -lrufl
INSTALL = $(GCCSDK_INSTALL_ENV)/ro-install
-all: pencil.o pencil_test,ff8
+OBJS = $(SOURCE:.c=.o)
-pencil.o: $(SOURCE) pencil.h pencil_internal.h
- $(CC) $(CFLAGS) -c -o $@ $(SOURCE)
+all: libpencil.a pencil_test$(EXEEXT)
-pencil_test,ff8: pencil_test.c pencil.o
+libpencil.a: $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+pencil_test$(EXEEXT): pencil_test.c libpencil.a
$(CC) $(CFLAGS) $(LIBS) -o $@ $^
-install: pencil.o
- $(INSTALL) pencil.o $(GCCSDK_INSTALL_ENV)/lib/libpencil.o
+install: libpencil.a
+ $(INSTALL) libpencil.a $(GCCSDK_INSTALL_ENV)/lib/libpencil.a
$(INSTALL) pencil.h $(GCCSDK_INSTALL_ENV)/include/pencil.h
clean:
- -rm pencil.o pencil_test,ff8
+ -rm *.o libpencil.a pencil_test$(EXEEXT)
+
+.c.o: $(HDRS)
+ $(CC) $(CFLAGS) -c -o $@ $<