#
# Select LANGUAGE you want to compile the program with
#
LANGUAGE ?= DEUTSCH
# LANGUAGE = ENGLISH

AS         = m68k-palmos-gcc
ASFLAGS    = -c

CC         = m68k-palmos-gcc
CFLAGS     = -Os -Wall -palmos3.5
# CFLAGS     = -g -Wall -palmos3.5

BUILDPRC   = build-prc
MULTIGEN   = multigen
PILRC      = pilrc
PRCFLAGS   = -q -L $(LANGUAGE)

OBJS       = mine.o hscore.o

mine.prc: mine bin.res
	$(BUILDPRC) mine.def mine res/*.bin
	ls -l mine.prc

all-lang:
	rm -f bin.res && make LANGUAGE=DEUTSCH && mv mine.prc mine-de.prc
	rm -f bin.res && make LANGUAGE=ENGLISH && mv mine.prc mine-en.prc

res:
	mkdir res

bin.res: mine.rcp res
	rm -f *.bin bin.res
	$(PILRC) $(PRCFLAGS) mine.rcp res
	touch bin.res

mine-sections.o: mine-sections.s
mine-sections.s mine-sections.ld: mine.def
	$(MULTIGEN) mine.def

mine: $(OBJS) mine-sections.o mine-sections.ld
	$(CC) $(CFLAGS) $(OBJS) mine-sections.o mine-sections.ld -o $@

$(OBJS): Makefile

clean:
	rm -f $(OBJS) mine mine-sections.* res/*.bin bin.res *.bak *~ *.log

distclean realclean: clean
	rm -fr *.prc res

dist:
	sh dist.sh
