# $Id: /mirror/trunk/config/gen/makefiles/nqp.in 35450 2009-01-11T16:06:27.204688Z fperrad  $

# Setup some commands
PERL     = @perl@
RM_F     = @rm_f@
PARROT   = ../../parrot@exe@

PARROT_LIBRARY = @build_dir@/runtime/parrot/library
PGE_LIBRARY  = @build_dir@/runtime/parrot/library/PGE

all: nqp.pbc

SOURCES = \
  nqp.pir \
  src/Grammar.pg \
  src/Grammar/Actions.pir \
  src/builtins.pir

BOOTSRC = \
  bootstrap/nqp.pir \
  bootstrap/actions.pm

# the default target
nqp.pbc: $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
	$(PARROT) $(PARROT_ARGS) $(PGE_LIBRARY)/Perl6Grammar.pir \
	    --output=src/Grammar_gen.pir src/Grammar.pg
	$(PARROT) -o nqp.pbc nqp.pir

boot: $(BOOTSRC)
	$(PARROT) nqp.pbc \
	    --output=bootstrap/gen_actions.pir \
	    --target=pir \
	    bootstrap/actions.pm
	$(PARROT) --output-pbc -o bootstrap/nqp.pbc bootstrap/nqp.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:               nqp.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) t/harness t

# this target has nothing to do
testclean:

CLEANUPS = \
  nqp.pbc \
  src/Grammar_gen.pir \
  bootstrap/gen_actions.pir \
  bootstrap/nqp.pbc


clean:
	$(RM_F) $(CLEANUPS)

realclean: clean
	$(RM_F) Makefile

distclean: realclean
