#
#   makefile for GIMME.LIB	    latest: 31-Oct-88	    (Manx version)
#
# NOTE: the default is to make a small code 16-bit int library gimme.lib
#	and test program
#
# NOTE: you must run make once for each library version you want.
#
#   how to make different versions of gimmelib:
#
#	make			- gimme.lib	(small code, 16-bit)
#	make T=32		- gimme32.lib	(small code, 32-bit)
#	make T=l		- gimmel.lib	(large code, 16-bit)
#	make T=l32		- gimmel32.lib	(large code, 32-bit)
#
# NOTE: the four versions above create object files with the following
# extensions, respectively:	.o, .o32, .ol, .ol32
#
# you can specify where the gimmelib include files are (for purposes of
# checking the date) by specifying  INCS=wherever  on the "make" command line
# the default is "gimmelib/"
# ie. in the gimmelib subdirectory of the current directory.
# NOTE: your INCS specification must end with '/' or ':'
#
# NOTE: the desired library must exist in the current directory
# (if it doesn't create an empty file with the appropriate name)
#

# library type (default: "" ie gimme.lib : small code 16-bit int)
T =
# where the include files are (must end with '/' or ':') [to check date]
INCS = gimmelib/


LOBJS = communic.o$T dbuf.o$T dbufquick.o$T dbufvquick.o$T dualpf.o$T \
	font.o$T graph.o$T inputhand.o$T \
	keyboard.o$T menu.o$T menustuff.o$T picture.o$T \
	postext.o$T requester.o$T screen.o$T \
	scrollbar.o$T sound.o$T stdstuff.o$T subtask.o$T \
	subtinit.o$T timerstuff.o$T timer.o$T window.o$T \
	bitmap.o$T bitplane.o$T color.o$T gadget.o$T gadgstuff.o$T message.o$T \
	intuistuff.o$T copystuff.o$T memchain.o$T globals.o$T

# NOTE: order is important because of inter-dependant routines
# note: stdstuff must come before subtask, timer
# note: communic,timerstuff must come before timer
# note: postext must come after graph
# note: color must come after picture
# note: window must come after screen
# note: bitmap must come after dbuf, dbufquick, dualpf, window
# note: bitplane should come after bitmap, picture
# note: message must come after subtinit
# note: gadget must come after scrollbar
# note: gadgstuff must come after gadget
# note: intuistuff and copystuff must come near-last
# note: memchain should come last, just before globals.o

DBGFLAG =
#debug version
#DBGFLAG = -DDEBUG -n

CFLAGS = +Irad:include/incall.pre $(DBGFLAG)

LFLAGS = -Lgimme$T -Lc$T

.c.o:
	cc $(CFLAGS) $*.c -o $@
	lb gimme$T.lib -r $* $*
.c.o32:
	cc $(CFLAGS) +L $*.c -o $@
	lb gimme$T.lib -r $@ $@
.c.ol:
	cc $(CFLAGS) +C $*.c -o $@
	lb gimme$T.lib -r $@ $@
.c.ol32:
	cc $(CFLAGS) +C +L $*.c -o $@
	lb gimme$T.lib -r $@ $@

# all (default) causes modules to be updated in the libraries
all: test

# rebuild causes the libraries to be remade from "scratch"
rebuild: rebuild_library test.o$T rebuild_test


gimme$T.lib: $(LOBJS)
	copy gimme$T.lib rad:lib/gimme$T.lib

test: gimme$T.lib test.o$T
	ln test.o$T -Lgimme$T -Lc$T
test.o: test.c
	cc $(CFLAGS) test.c -o $@
test.o32: test.c
	cc $(CFLAGS) +L test.c -o $@
test.ol: test.c
	cc $(CFLAGS) +C test.c -o $@
test.ol32: test.c
	cc $(CFLAGS) +C +L test.c -o $@


bitplane.o$T:	$(INCS)bitplane.h
color.o$T:	$(INCS)color.h
communic.o$T:	$(INCS)communic.h
copystuff.o$T:	$(INCS)copystuff.h $(INCS)intuistuff.h
dbuf.o$T dbufquick.o$T dbufvquick.o$T:	$(INCS)minterm.h
gadget.o$T:	$(INCS)gadget.h $(INCS)postext.h
gadgstuff.o$T:	$(INCS)gadget.h
globals.o$T:	$(INCS)globals.h $(INCS)requester.h $(INCS)scrollbar.h
graph.o$T:	$(INCS)graph.h $(INCS)postext.h
intuistuff.o$T: $(INCS)intuistuff.h
menustuff.o$T:	$(INCS)menustuff.h
picture.o$T:	$(INCS)picture.h $(INCS)bitplane.h $(INCS)postext.h \
		    $(INCS)minterm.h
postext.o$T:	$(INCS)postext.h
requester.o$T:	$(INCS)requester.h
screen.o$T:	$(INCS)window.h $(INCS)globals.h
scrollbar.o$T:	$(INCS)scrollbar.h
sound.o$T:	$(INCS)sound.h
stdstuff.o$T:	$(INCS)stdstuff.h
window.o$T:	$(INCS)window.h


rebuild_library: $(LOBJS)
	lb rad:lib/gimme$T.lib $(LOBJS)
	copy rad:lib/gimme$T.lib gimme$T.lib

rebuild_test:
	ln test.o$T $(LFLAGS)

