# $Id: /mirror/trunk/languages/punie/config/makefiles/root.in 28688 2008-06-23T00:33:41.905243Z coke  $

# Setup some commands
LN_S     = @lns@
PERL     = @perl@
RM_F     = @rm_f@
PARROT   = ../../parrot@exe@
BUILD_DIR     = @build_dir@
RECONFIGURE   = $(PERL) @build_dir@/tools/dev/reconfigure.pl
PGE_DIR       = ../../compilers/pge
NQP_DIR       = ../../compilers/nqp
CP       = @cp@
#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@

PARROT_LIBRARY = ../../runtime/parrot/library
PGE_LIBRARY   = ../../runtime/parrot/library/PGE

# the default target
all: punie.pbc

SOURCES = punie.pir \
  src/parser/grammar.pg \
  src/parser/actions.pm \
  src/builtins/builtins.pir \

# the default target
punie.pbc: $(PARROT) $(NQP_DIR)/nqp.pbc $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
	$(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir --output=src/gen_punie.pir src/parser/grammar.pg
	$(PARROT) $(NQP_DIR)/nqp.pbc --target=pir --output=src/gen_punie-actions.pir src/parser/actions.pm
	$(PARROT) -o punie.pbc punie.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:               punie.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 -I../../lib t/harness

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

testclean:
	$(RM_F) "t/*.p1" "t/*.out" "t/*.pir"

CLEANUPS = \
  punie.pbc \
  src/gen_punie.pir \
  src/gen_punie-actions.pir \

clean: testclean
	$(RM_F) $(CLEANUPS)

realclean: clean
	$(RM_F) Makefile

distclean: realclean
