#
# Makefile for List - A simple database
#

#DEBUG=-g

all : list.prc listfr.prc listgr.prc listjp.prc listru.prc listdk.prc listsp.prc

# link the prc together
list.prc : list.o edit.o view.o custom.o select.o find.o english/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o list
	m68k-palmos-coff-obj-res list
	cp english/*.bin .
	build-prc list.prc "List" LSdb *.list.grc *.bin
	ls -l *.prc

listfr.prc : list.o edit.o view.o custom.o select.o find.o french/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listfr
	m68k-palmos-coff-obj-res listfr
	cp french/*.bin .
	build-prc listfr.prc "List" LSdb *.listfr.grc *.bin
	ls -l *.prc

listgr.prc : list.o edit.o view.o custom.o select.o find.o german/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listgr
	m68k-palmos-coff-obj-res listgr
	cp german/*.bin .
	build-prc listgr.prc "List" LSdb *.listgr.grc *.bin
	ls -l *.prc

listjp.prc : list.o edit.o view.o custom.o select.o find.o japanese/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listjp
	m68k-palmos-coff-obj-res listjp
	cp japanese/*.bin .
	build-prc listjp.prc "List" LSdb *.listjp.grc *.bin
	ls -l *.prc

listru.prc : list.o edit.o view.o custom.o select.o find.o russian/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listru
	m68k-palmos-coff-obj-res listru
	cp russian/*.bin .
	build-prc listru.prc "List" LSdb *.listru.grc *.bin
	ls -l *.prc

listdk.prc : list.o edit.o view.o custom.o select.o find.o danish/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listdk
	m68k-palmos-coff-obj-res listdk
	cp danish/*.bin .
	build-prc listdk.prc "List" LSdb *.listdk.grc *.bin
	ls -l *.prc

listsp.prc : list.o edit.o view.o custom.o select.o find.o spanish/tfrm03e8.bin
	m68k-palmos-coff-gcc $(DEBUG) -O1 list.o edit.o view.o custom.o select.o find.o -o listsp
	m68k-palmos-coff-obj-res listsp
	cp spanish/*.bin .
	build-prc listsp.prc "List" LSdb *.listsp.grc *.bin
	ls -l *.prc

# generate the resources
english/tfrm03e8.bin: english/list.rc listrc.h icon.bmp
	cd english;pilrc list.rc

french/tfrm03e8.bin: french/list.rc listrc.h icon.bmp
	cd french;pilrc list.rc 

german/tfrm03e8.bin: german/list.rc listrc.h icon.bmp
	cd german;pilrc list.rc 

japanese/tfrm03e8.bin: japanese/list.rc listrc.h icon.bmp
	cd japanese;pilrc list.rc 

russian/tfrm03e8.bin: russian/list.rc listrc.h icon.bmp
	cd russian;pilrc list.rc 

danish/tfrm03e8.bin: danish/list.rc listrc.h icon.bmp
	cd danish;pilrc list.rc 

spanish/tfrm03e8.bin: spanish/list.rc listrc.h icon.bmp
	cd spanish;pilrc list.rc 

# compile the C code
.c.o: list.h listrc.h
	m68k-palmos-coff-gcc $(DEBUG) -O1 -c $*.c

# nuke the non-source files (and emacs backups)
clean: release
	rm *.prc 

# remove everything - but the source and the executables
release:
	-rm *.bin english/*.bin french/*.bin german/*.bin japanese/*.bin russian/*.bin \
		danish/*.bin spanish/*.bin *.grc *.o list listfr listgr listjp listru listdk listsp

