# $Id: root.in 17096 2007-02-20 20:20:48Z paultcochrane $

# Setup some commands
LN_S     = @lns@
PERL     = @perl@
RM_RF    = @rm_rf@
PARROT   = ../../parrot@exe@
BUILD    = $(PERL) @build_dir@/tools/build/dynpmc.pl
TOOL_DIR = ../..
PGE_DIR  = ../../compilers/pge
TGE_DIR  = ../../compilers/tge
CAT      = $(PERL) -MExtUtils::Command -e cat
CP       = @cp@
O        = @o@
LOAD_EXT = @load_ext@
PARROT_DYNEXT = @build_dir@/runtime/parrot/dynext

PMCDIR   = src/pmc

all: abc.pbc 

SOURCES = abc.pir \
  src/abc.pg \
  src/builtins.pir \
  src/PASTGrammar.tg

# the default target
abc.pbc: $(PARROT) $(PGE_DIR)/pgc.pir $(SOURCES)
	$(PARROT) $(PGE_DIR)/pgc.pir --output=src/abc_gen.pir src/abc.pg
	$(PARROT) $(TGE_DIR)/tgc.pir --output=src/PASTGrammar_gen.pir src/PASTGrammar.tg
	$(PARROT) -o abc.pbc abc.pir

# 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:               perl6.pbc"
	@echo "                     This is the default."
	@echo "Testing:"
	@echo "  test:              Run the test suite."
	@echo "  testclean:         Clean up test results."
	@echo ""
	@echo "Cleaning:"
	@echo "  clean:             Basic cleaning up."
	@echo "  realclean:         Removes also files generated by 'Configure.pl'"
	@echo "  distclean:         Removes also anything built, in theory"
	@echo ""
	@echo "Misc:"
	@echo "  help:              Print this help message."
	@echo ""

test: abc.pbc
	prove -r t

# this target has nothing to do
testclean:
	$(RM_RF) "t/*.pir" "t/*.out"

CLEANUPS = \
  abc.pbc \
  src/abc_gen.pir \
  src/PASTGrammar_gen.pir

clean: testclean
	$(RM_RF) $(CLEANUPS)

realclean: clean
	$(RM_RF) Makefile

distclean: realclean
