# $Id: /mirror/trunk/languages/pheme/config/makefiles/root.in 35431 2009-01-11T09:26:22.891948Z fperrad  $

# configuration settings
BUILD_DIR     = @build_dir@

# Setup some commands
PERL          = @perl@
RM_F          = @rm_f@
PARROT        = ../../parrot@exe@
TGE_DIR       = ../../compilers/tge
PGE_LIBRARY   = $(BUILD_DIR)/runtime/parrot/library/PGE
PERL6GRAMMAR  = $(PGE_LIBRARY)/Perl6Grammar.pbc
RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
#CONDITIONED_LINE(darwin):
#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@

# the default target
all: pheme.pbc

lib/pheme_grammar_gen.pir: lib/pheme.g
	$(PARROT) $(PERL6GRAMMAR) \
	 --output=lib/pheme_grammar_gen.pir lib/pheme.g

lib/ASTGrammar.pir: lib/pge2past.tg
	$(PARROT) $(TGE_DIR)/tgc.pir --output=lib/ASTGrammar.pir lib/pge2past.tg

pheme.pbc: pheme.pir lib/PhemeSymbols.pir lib/PhemeObjects.pir lib/ASTGrammar.pir lib/pheme_grammar_gen.pir
	$(PARROT) -o pheme.pbc pheme.pir

# regenerate the Makefile
Makefile: config/makefiles/root.in
	cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=pheme

# This is a listing of all targets that users can call
help:
	@echo ""
	@echo "Following targets are available for the user:"
	@echo ""
	@echo "  all:               pheme.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: all
	$(PERL) -Ilib t/harness

testclean:

clean: testclean
	$(RM_F) pheme.pbc
	$(RM_F) lib/pheme_grammar_gen.pir
	$(RM_F) lib/ASTGrammar.pir

realclean: clean
	$(RM_F) Makefile

distclean: realclean
