# $Id: json.in 17095 2007-02-20 20:11:27Z paultcochrane $

PERL     = @perl@
RM_RF    = @rm_rf@
PARROT   = ../../parrot@exe@

TOOL_DIR = ../..
PGE_DIR  = ../../compilers/pge
TGE_DIR  = ../../compilers/tge

# the default target
all: JSON.pbc

# This is a listing of all targets, that are meant to be called by users
help:
	@echo ""
	@echo "Following targets are available for the user:"
	@echo ""
	@echo "  all:               JSON.pbc"
	@echo "                     This is the default."
	@echo "Testing:"
	@echo "  test:              Run the test suite."
	@echo "  testclean:         Clean up test results and temporary files."
	@echo ""
	@echo "Cleaning:"
	@echo "  clean:             Basic cleaning up."
	@echo ""
	@echo "Misc:"
	@echo "  help:              Print this help message."
	@echo ""

test: all
	cd $(TOOL_DIR); prove -r t/compilers/json

testclean:
	$(RM_RF) "../../t/compilers/json/*.pir" \

JSON.pbc : JSON/grammar.pbc JSON/pge2pir.pbc JSON.pir
	$(PARROT) --output=JSON.pbc JSON.pir

JSON/grammar.pbc : JSON/grammar.pir
	$(PARROT) --output=JSON/grammar.pbc JSON/grammar.pir

JSON/grammar.pir : JSON/grammar.pg
	$(PARROT) $(PGE_DIR)/pgc.pir --output=JSON/grammar.pir JSON/grammar.pg

JSON/pge2pir.pbc : JSON/pge2pir.pir
	$(PARROT) --output=JSON/pge2pir.pbc JSON/pge2pir.pir

JSON/pge2pir.pir : JSON/pge2pir.tg
	$(PARROT) $(TGE_DIR)/tgc.pir --output=JSON/pge2pir.pir JSON/pge2pir.tg

clean : testclean
	@rm_f@ "JSON/*.pbc" "JSON/*.pir" JSON.pbc
