# Makefile fuer Yanoff

PRC=yf15.prc
CID = MJyf
CCBASE = m68k-palmos-gcc -Wall -Werror-implicit-function-declaration -Wstrict-prototypes -Wmissing-prototypes -Werror -O1

# Do we want to use the header files of PalmOS 3.5?
# If not, comment out this line.
OS35 = -DOS35

# Use PRC-Tools 2.0 instead of the 0.5.0 PRC-Tools?
# If not, comment out this line.
PRC2 = -DPRC2

# Create debugging code?
# If not, comment out this line.
DEBUG = -g

CC = $(CCBASE) $(OS35) $(DEBUG) $(PRC2)

OBJS =	yanoff.o network.o artdb.o subscrdb.o \
	msgiddb.o general.o ngroup.o prefs.o export.o \
	mainmenu.o frmsubs.o frmnglist.o frmartlist.o \
	frmart.o frmpost.o lang.o frmpass.o serverdb.o \
	frmprefs1.o frmprefs2.o frmprefs4.o frmprefsp.o \
	frmsrvsel.o scoring.o hardbtn.o
	


$(PRC): $(OBJS) *.bin
#ifuse PRC-Tools 0.5.0 uncomment the following lines
#	multilink -segmentmap yanoff.seg -basename yanoff -fid $(CID) $(OBJS)
#	$(CC) -o yanoff $(OBJS)
#	m68k-palmos-coff-obj-res yanoff
#	build-prc  $(PRC) "Yanoff" $(CID) *.grc *.bin
#	ls -l *.prc
#endif

#ifuse PRC-Tools 2.0 uncomment the following lines
	multigen yanoff.def
	m68k-palmos-gcc -c yanoff-sections.s
	m68k-palmos-gcc $(DEBUG) -O1 -Xlinker -XMap -Xlinker yanoff.map -o yanoff yanoff-sections.o $(OBJS) yanoff-sections.ld 
	build-prc yanoff.def *.bin yanoff
	mv -f yanoff.prc $(PRC)
	sync
	ls -l *.prc
#endif




*.bin: yanoff.rcp yanoff.h yanoff.bmp
	pilrc yanoff.rcp



.c.o: 
	$(CC) $(DEBUG) -c $<





clean:
	rm *.o -f
	rm *.bin -f
	rm *.grc -f
	rm *.map -f
	rm o00* -f
	rm yanoff -f
	rm yanoff-sections.s -f
	rm yanoff-sections.ld -f

tidy: clean
	rm *~ -f
	
fresh: tidy
	rm -f $(PRC)

install: $(PRC)
	( export PILOTRATE=57600 ; pilot-xfer -i $(PRC) )

check-ver:
	grep "[^.0-9]1\.[0-9]" Makefile *.c *.h *.rcp *.seg
	grep VERSION *.c *.h
#	echo general.h

#check-seg:
#	(
#	( for i in *.c ; do ;
#		bn=$$(/usr/bin/basename $$i .c) ; 
#		grep -l $$bn.h $$i ; 
#	done ) > out.grep
#	ls -1 *.c > out.ls
#	diff out.ls out.grep
#	rm out.ls out.grep -f
#	)
