#
# makefile to build TolleUhr.000, TolleUhr.020 and libraries
#

# compiler driver (including version)
#
CC		= gcc#-V2.3.3

# default compiler flags
#
CFLAGS		= -O2 -fno-function-cse -fno-force-mem -msmall-code

# useful for development (faster compiling since no optimizations)
#
#CFLAGS		= -Dextern=static -D__OPTIMIZE__ -w -msmall-code

# linker options (no debug info,no startup, no libraries)
#
LDFLAGS		= -s -nostdlib

# which libraries (DoMethod)
#
LDLIBS		= -lamiga

# default targets
#
all:		TolleUhr.000 TolleUhr.020

# libraries (if requested)
#
libs:		tolleuhr.library.000 tolleuhr.library.020

# plain version (libmath.a -> mul32/div[u]32/mod[u]32 for 68000)
#
TolleUhr.000:	TolleUhr.o00
		$(CC) $(LDFLAGS) -o $@ $? $(LDLIBS) lib/libmath.a

tolleuhr.library.000: tuLibInit.o TolleUhr.o00
		$(CC) $(LDFLAGS) -o $@ $? $(LDLIBS) lib/libmath.a

TolleUhr.o00:	TolleUhr.c
		$(CC) $(CFLAGS) -o $@ $< -c

# 020 and up
#
TolleUhr.020:	TolleUhr.o20
		$(CC) $(LDFLAGS) -o $@ $? $(LDLIBS)

tolleuhr.library.020: tuLibInit.o TolleUhr.o20
		$(CC) $(LDFLAGS) -o $@ $? $(LDLIBS)

TolleUhr.o20:	TolleUhr.c
		$(CC) $(CFLAGS) -m68020 -o $@ $< -c

# library startup (change to suit your asm setup!)
#
tuLibInit.o:	tulibinit.s
		snma i=include: s=on $?
		hunk2gcc $@
		rm $@
		mv obj.* $@
