Permalink
Fetching contributors…
Cannot retrieve contributors at this time
305 lines (248 sloc) 8.93 KB
# Copyright (C) 2006-2009, The Perl Foundation.
#
PARROT_ARGS =
# values from parrot_config
PARROT_BIN_DIR = @bindir@
PARROT_VERSION = @versiondir@
PARROT_INCLUDE_DIR = @includedir@$(PARROT_VERSION)
PARROT_LIB_DIR = @libdir@$(PARROT_VERSION)
PARROT_SRC_DIR = @srcdir@$(PARROT_VERSION)
PARROT_LIBRARY_DIR = $(PARROT_LIB_DIR)/library
HAS_ICU = @has_icu@
CC = @cc@
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @gc_flag@
EXE = @exe@
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@
LD_LOAD_FLAGS = @ld_load_flags@
LIBPARROT = @inst_libparrot_ldflags@
O = @o@
LOAD_EXT = @load_ext@
PERL = @perl@
CP = @cp@
MV = @mv@
RM_F = @rm_f@
MKPATH = $(PERL) -MExtUtils::Command -e mkpath
CHMOD = $(PERL) -MExtUtils::Command -e chmod
# locations of parrot resources
PARROT = $(PARROT_BIN_DIR)/parrot$(EXE)
PARROT_NQP = $(PARROT_BIN_DIR)/parrot_nqp$(EXE)
PBC_TO_EXE = $(PARROT_BIN_DIR)/pbc_to_exe$(EXE)
PARROT_TOOLS_DIR = $(PARROT_LIB_DIR)/tools
PARROT_PERL_LIB = $(PARROT_TOOLS_DIR)/lib
NQP_LANG_DIR = $(PARROT_LIB_DIR)/languages/nqp
REGEX_SOURCES = \
src/Regex.pir \
src/Regex/constants.pir \
src/Regex/Cursor.pir \
src/Regex/Cursor-builtins.pir \
src/Regex/Cursor-protoregex-peek.pir \
src/Regex/Match.pir \
src/Regex/Method.pir \
src/Regex/Dumper.pir \
src/PAST/Regex.pir \
src/PAST/Compiler-Regex.pir \
HLL_SOURCES = \
src/HLL.pir \
src/cheats/hll-compiler.pir \
src/cheats/hll-grammar.pir \
src/cheats/parrot-callcontext.pir \
src/HLL/Grammar.pm \
src/HLL/Actions.pm \
src/HLL/Compiler.pm \
P6REGEX_SOURCES = \
src/Regex/P6Regex.pir \
src/Regex/P6Regex/Grammar.pm \
src/Regex/P6Regex/Actions.pm \
HLLGRAMMAR_SOURCES = \
src/HLL/Grammar.pm \
src/HLL/Actions.pm \
src/cheats/hll-grammar.pir \
NQP_SOURCES = \
src/NQP/Grammar.pm \
src/NQP/Actions.pm \
src/NQP/Compiler.pir \
SETTING_SOURCES = \
src/setting/ResizablePMCArray.pm \
src/setting/Hash.pm \
src/setting/Regex.pm \
src/setting/IO.pm \
SETTING_NQP = src/gen/nqp-setting.nqp
SETTING_PIR = src/gen/nqp-setting.pir
SETTING_PBC = nqp-setting.pbc
STAGE0_SOURCES = \
src/stage0/Regex-s0.pir \
src/stage0/HLL-s0.pir \
src/stage0/P6Regex-s0.pir \
src/stage0/NQP-s0.pir
STAGE0 = src/stage0
STAGE1 = src/stage1
STAGE2 = src/stage2
REGEX_PBC = Regex.pbc
HLL_PBC = HLL.pbc
HLLGRAMMAR_G = gen/hllgrammar-grammar.pir
HLLGRAMMAR_A = gen/hllgrammar-actions.pir
HLLCOMPILER_PIR = gen/hllcompiler.pir
P6REGEX_PBC = P6Regex.pbc
P6REGEX_G = gen/p6regex-grammar.pir
P6REGEX_A = gen/p6regex-actions.pir
P6GRAMMAR_PBC = P6Grammar.pbc
P6GRAMMAR_G = gen/p6grammar-grammar.pir
P6GRAMMAR_A = gen/p6grammar-actions.pir
NQP_PBC = nqp.pbc
NQP_G = gen/nqp-grammar.pir
NQP_A = gen/nqp-actions.pir
NQP_EXE = nqp$(EXE)
STAGE0_PBCS = $(STAGE0)/$(HLL_PBC) $(STAGE0)/$(P6REGEX_PBC) $(STAGE0)/$(NQP_PBC) $(STAGE0)/$(REGEX_PBC)
STAGE1_PBCS = $(STAGE1)/$(HLL_PBC) $(STAGE1)/$(P6REGEX_PBC) $(STAGE1)/$(NQP_PBC) $(REGEX_PBC)
STAGE2_PBCS = $(STAGE2)/$(HLL_PBC) $(STAGE2)/$(P6REGEX_PBC) $(STAGE2)/$(NQP_PBC) $(REGEX_PBC)
ALL_PBCS = $(HLL_PBC) $(P6REGEX_PBC) $(NQP_PBC)
CLEANUPS = \
*.manifest \
*.pdb \
$(REGEX_PBC) \
$(HLL_PBC) \
$(P6REGEX_PBC) \
P6Regex$(EXE) \
$(P6GRAMMAR_PBC) \
P6Grammar$(EXE) \
nqp.pbc \
nqp$(EXE) \
*.c\
*.o\
src/stage0/*.pbc \
src/stage1/gen/* \
src/stage1/*.pbc \
src/stage2/gen/* \
src/stage2/*.pbc \
src/gen/*.pir \
src/gen/*.nqp \
all: $(NQP_EXE) $(SETTING_PBC)
install: all
$(MKPATH) $(DESTDIR)$(NQP_LANG_DIR)
$(CP) nqp.pbc $(DESTDIR)$(NQP_LANG_DIR)/nqprx.pbc
$(CP) $(P6REGEX_PBC) $(DESTDIR)$(PARROT_LIBRARY_DIR)/$(P6REGEX_PBC)
$(CP) $(REGEX_PBC) $(DESTDIR)$(PARROT_LIBRARY_DIR)/$(REGEX_PBC)
$(CP) $(HLL_PBC) $(DESTDIR)$(PARROT_LIBRARY_DIR)/$(HLL_PBC)
$(MKPATH) $(DESTDIR)$(PARROT_BIN_DIR)
$(CP) $(NQP_EXE) $(DESTDIR)$(PARROT_BIN_DIR)/nqp$(EXE)
$(CHMOD) 755 $(DESTDIR)$(PARROT_BIN_DIR)/nqp$(EXE)
stage0: $(STAGE0)
stage1: $(STAGE1)
stage2: $(STAGE2)
$(REGEX_PBC): $(REGEX_SOURCES)
$(PARROT) -o $(REGEX_PBC) $(REGEX_SOURCES)
$(STAGE0): $(STAGE0_PBCS)
$(STAGE0_PBCS): $(STAGE0_SOURCES)
$(PARROT) -o $(STAGE0)/$(REGEX_PBC) src/stage0/Regex-s0.pir
$(PARROT) -o $(STAGE0)/$(HLL_PBC) src/stage0/HLL-s0.pir
$(PARROT) -o $(STAGE0)/$(P6REGEX_PBC) src/stage0/P6Regex-s0.pir
$(PARROT) -o $(STAGE0)/$(NQP_PBC) src/stage0/NQP-s0.pir
$(STAGE1): $(STAGE1_PBCS)
$(STAGE1)/$(HLL_PBC): $(STAGE0_PBCS) $(HLL_SOURCES)
$(MKPATH) $(STAGE1)/gen
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(HLLGRAMMAR_G) \
src/HLL/Grammar.pm
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(HLLGRAMMAR_A) \
src/HLL/Actions.pm
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(HLLCOMPILER_PIR) \
src/HLL/Compiler.pm
$(PARROT) --include=$(STAGE1) -o $(STAGE1)/$(HLL_PBC) \
src/HLL.pir
$(STAGE1)/$(P6REGEX_PBC): $(STAGE0_PBCS) $(P6REGEX_SOURCES)
$(MKPATH) $(STAGE1)/gen
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(P6REGEX_G) \
src/Regex/P6Regex/Grammar.pm
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(P6REGEX_A) \
src/Regex/P6Regex/Actions.pm
$(PARROT) --include=$(STAGE1) -o $(STAGE1)/$(P6REGEX_PBC) \
src/Regex/P6Regex.pir
$(STAGE1)/$(NQP_PBC): $(STAGE0_PBCS) $(NQP_SOURCES)
$(MKPATH) $(STAGE1)/gen
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(NQP_G) \
src/NQP/Grammar.pm
$(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \
--target=pir --output=$(STAGE1)/$(NQP_A) \
src/NQP/Actions.pm
$(PARROT) --include=$(STAGE1) -o $(STAGE1)/$(NQP_PBC) \
src/NQP/Compiler.pir
$(STAGE2): $(STAGE2_PBCS)
$(STAGE2)/$(HLL_PBC): $(STAGE1_PBCS) $(HLL_SOURCES)
$(MKPATH) $(STAGE2)/gen
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(HLLGRAMMAR_G) \
src/HLL/Grammar.pm
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(HLLGRAMMAR_A) \
src/HLL/Actions.pm
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(HLLCOMPILER_PIR) \
src/HLL/Compiler.pm
$(PARROT) --include=$(STAGE2) -o $(STAGE2)/$(HLL_PBC) \
src/HLL.pir
$(STAGE2)/$(P6REGEX_PBC): $(STAGE1_PBCS) $(P6REGEX_SOURCES)
$(MKPATH) $(STAGE2)/gen
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(P6REGEX_G) \
src/Regex/P6Regex/Grammar.pm
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(P6REGEX_A) \
src/Regex/P6Regex/Actions.pm
$(PARROT) --include=$(STAGE2) -o $(STAGE2)/$(P6REGEX_PBC) \
src/Regex/P6Regex.pir
$(STAGE2)/$(NQP_PBC): $(STAGE1_PBCS) $(NQP_SOURCES)
$(MKPATH) $(STAGE2)/gen
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(NQP_G) \
src/NQP/Grammar.pm
$(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \
--target=pir --output=$(STAGE2)/$(NQP_A) \
src/NQP/Actions.pm
$(PARROT) --include=$(STAGE2) -o $(STAGE2)/$(NQP_PBC) \
src/NQP/Compiler.pir
$(ALL_PBCS): $(REGEX_PBC) $(STAGE2_PBCS)
$(CP) $(STAGE2)/$(HLL_PBC) .
$(CP) $(STAGE2)/$(P6REGEX_PBC) .
$(CP) $(STAGE2)/$(NQP_PBC) .
$(NQP_EXE): $(NQP_PBC)
$(PBC_TO_EXE) $(NQP_PBC)
$(SETTING_NQP): $(SETTING_SOURCES)
$(PERL) build/gen_setting.pl $(SETTING_SOURCES) > $(SETTING_NQP)
$(SETTING_PIR): $(SETTING_NQP) $(NQP_PBC)
$(PARROT) $(NQP_PBC) --target=pir -o $(SETTING_PIR) $(SETTING_NQP)
$(SETTING_PBC): $(SETTING_PIR)
$(PARROT) -o $(SETTING_PBC) $(SETTING_PIR)
bootstrap-files: $(STAGE2_PBCS) $(SETTING_NQP)
$(PERL) build/gen_bootstrap.pl src/Regex.pir >src/stage0/Regex-s0.pir
$(PERL) build/gen_bootstrap.pl src/HLL.pir >src/stage0/HLL-s0.pir
$(PERL) build/gen_bootstrap.pl src/Regex/P6Regex.pir >src/stage0/P6Regex-s0.pir
$(PERL) build/gen_bootstrap.pl src/NQP/Compiler.pir >src/stage0/NQP-s0.pir
$(PERL) build/gen_bootstrap.pl $(SETTING_NQP) >src/stage0/nqp-setting.nqp
## testing
test: all core-test setting-test p6regex-test
test-loud: all core-test-loud setting-test-loud p6regex-test-loud
core-test: $(NQP_EXE)
prove -r --exec ./$(NQP_EXE) t/nqp t/hll
core-test-loud: $(NQP_EXE)
prove -r -v --exec ./$(NQP_EXE) t/nqp t/hll
p6regex-test: $(P6REGEX_PBC)
prove -r --exec $(PARROT) t/p6regex
p6regex-test-loud: $(P6REGEX_PBC)
prove -r -v --exec $(PARROT) t/p6regex
setting-test: $(NQP_EXE) $(SETTING_PBC)
prove -r --exec ./$(NQP_EXE) t/setting
setting-test-loud: $(NQP_EXE) $(SETTING_PBC)
prove -r -v --exec ./$(NQP_EXE) t/setting
## cleaning
clean:
$(RM_F) $(CLEANUPS)
distclean: realclean
realclean: clean
$(RM_F) Makefile
testclean: