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

AS         = m68k-palmos-gcc
ASFLAGS    = -c

CC         = m68k-palmos-gcc
CFLAGS     = -Os -Wall
# CFLAGS     = -g -Wall

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

OBJS       = hexmines.o hscore.o

all: hexmines.prc

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

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

res:
	mkdir res

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

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

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

$(OBJS): Makefile

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

distclean realclean: clean
	rm -fr *.prc res

dist:
	sh dist.sh
