From e56e9208e7b6f6d6c3c8814edf2ce4588df67fbe Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Mon, 11 Jun 2007 20:51:19 +0000 Subject: - 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 -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 --- makefile | 35 ++++++++++++++++++++++++++++------- 1 file 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 $@ $< -- cgit v1.2.3