
LIBNAME = miniGLLib
CREATOR = MnGL

CC = m68k-palmos-coff-gcc
XTRALIBS = -lnfm -Wl,-Map,mapfile
OBJRES = m68k-palmos-coff-obj-res
BUILDPRC = build-prc

OBJS = miniGL_lib.o miniGL_main.o fastgraph.o fastmath.o

$(LIBNAME).prc: libr0000.$(LIBNAME).grc ./appl2libr
	$(BUILDPRC) $@ $(LIBNAME) $(CREATOR) libr0000.$(LIBNAME).grc
	./appl2libr $@

./appl2libr: appl2libr.c
	gcc -o $@ $<

libr0000.$(LIBNAME).grc: $(LIBNAME)
	$(OBJRES) $(LIBNAME)
	rm -f {code,pref,data}0000.$(LIBNAME).grc
	mv code0001.$(LIBNAME).grc libr0000.$(LIBNAME).grc

$(LIBNAME) : $(OBJS)
	$(CC) -shared -nostartfiles -o $(LIBNAME) $(OBJS) $(XTRALIBS)

.c.o:
	$(CC) -O5 -w $(INCLUDES) -c $<

clean:
	rm -f *.grc *.o $(LIBNAME) appl2libr
