RM_F = ${rm_f}
RM_RF = ${rm_rf}
PERL = ${perl}

myperl=$(PERL) -I../../lib
compile=$(myperl) prd-perl6.pl --batch --imc
parrot=..${slash}..${slash}parrot${exe}
asm=$(parrot) -a --output-pbc

all:  perl6-config

perl6-config: ../../Makefile pconfig.pl
	$(myperl) pconfig.pl ../../Makefile perl6-config

test:
	$(PERL) t/harness

test-fast:
	.${slash}perl6 --test


%.pasm: %.imc
	$(parrot) $< $@

%.imc: %.p6
	$(compile) < $< > $@

%.pbc: %.pasm
	$(asm) -o $@ $<

clean:
	$(RM_RF) t/*/*.p6 t/*/*.imc t/*/*.pasm t/*/*.err t/*/*.pbc t/*/*.out
	$(RM_RF) a.err a.imc a.output a.pasm a.pbc t/*/*.warn t/*/*.test
	$(RM_RF) core


distclean: clean
	$(RM_RF) Perl6grammar.pm

.PRECIOUS: %.imc %.pasm %.p6

.PHONY: all test clean distclean
