#
# Makefile for Hello World application
#

include ../makeinclude

all: startclean finclean

startclean:
	-rm *.bin *.grc resource.h hello.exe

finclean: calc.prc
	-rm *.bin *.grc resource.h

# ============================================================================

calc.prc: calc.exe ../calc.def resource.h
	   obj-res calc.exe
	   build-prc -o $@ ../calc.def *.grc *.bin

calc.exe: calc.o parse.o number.o grammar.o MathLib.o
	   $(LINK) $(LDFLAGS) $^ -o $@
	   chmod -x $@

calc.o: resource.h grammar.h
grammar.o: grammar.h
parse.o: grammar.h

grammar.c grammar.h: ../grammar.y
	bison -b grammar -d -p CP -o grammar.c $^

resource.h: ../calc.rcp
	pilrc -H resource.h ../calc.rcp

clean:
	-rm calc.exe
	-rm calc.prc
	-rm *.bin *.grc *.o
	-rm resource.h
