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

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

TOOL_DIR = ../..
PGE_DIR  = ../../compilers/pge
TEST_DIR = ../../t/compilers/pct

# Where to put things
PARROT_LIBRARY    = ../../runtime/parrot/library

PCT_TARGETS = \
  $(PARROT_LIBRARY)/PCT.pbc \
  $(PARROT_LIBRARY)/PCT/PAST.pbc \
  $(PARROT_LIBRARY)/PCT/Grammar.pbc \
  $(PARROT_LIBRARY)/PCT/HLLCompiler.pbc

PCT_SOURCES = \
  PCT.pir \
  src/PCT/Grammar.pir \
  src/PCT/HLLCompiler.pir \
  src/PCT/Node.pir \
  src/PAST/Compiler.pir \
  src/PAST/Node.pir \
  src/POST/Compiler.pir \
  src/POST/Node.pir

# the default target
all: $(PARROT_LIBRARY)/PCT.pbc

$(PARROT_LIBRARY)/PCT.pbc: $(PARROT) $(PCT_SOURCES)
	$(PARROT) -o $(PARROT_LIBRARY)/PCT.pbc --output-pbc PCT.pir
	$(PARROT) -o $(PARROT_LIBRARY)/PCT/PAST.pbc --output-pbc src/PAST.pir
	$(PARROT) -o $(PARROT_LIBRARY)/PCT/Grammar.pbc --output-pbc src/PCT/Grammar.pir
	$(PARROT) -o $(PARROT_LIBRARY)/PCT/HLLCompiler.pbc --output-pbc src/PCT/HLLCompiler.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:               all PCT libraries"
	@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
	cd $(TOOL_DIR) && prove -r t/compilers/pct

testclean:
	$(RM_F) $(TEST_DIR)/*.pir \
	    $(TEST_DIR)/*.pbc

clean: testclean
	$(RM_F) $(PCT_TARGETS)

realclean: clean
	$(RM_F) Makefile

distclean: realclean
