Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Started creating a script to generate the Makefile for the js backend.
  • Loading branch information
pmurias committed Jul 25, 2014
1 parent 78be7f1 commit bca9dec
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tools/build/gen-js-makefile.nqp
@@ -0,0 +1,64 @@
sub comment($comment) {
say("# $comment");
}
sub constant($name, $value) {
say("$name = $value");
}

sub stage_path($stage) {
'$(JS_STAGE' ~ $stage ~ ')/';
}

sub make_parents($path) {
my $parts := nqp::split("/",$path);
nqp::pop($parts);
'mkdir -p ' ~ nqp::join('/',$parts);
}

sub rule($target, $source, *@actions) {
my $rule := "$target: $source\n";
for @actions -> $action {
$rule := $rule ~ "\t$action\n";
}
say($rule);
$target;
}

sub nqp($prefix, $file, $stage) {
my $source := $prefix ~ '/' ~ $file ~ '.nqp';
my $pbc := stage_path($stage) ~ $file ~ '.pbc';
my $pir := stage_path($stage) ~ $file ~ '.pir';
rule($pbc, $source,
make_parents($pbc),
"\$(JS_NQP) --target=pir --output=$pir --encoding=utf8 $source",
"\$(JS_PARROT) -o $pbc $pir"
);
}


comment("This is the JS Makefile - autogenerated by gen-makefile.nqp");

constant('JS_BUILD_DIR','gen/js');
constant('JS_STAGE1','$(JS_BUILD_DIR)/stage1');
constant('JS_STAGE2','$(JS_BUILD_DIR)/stage2');
constant('JS_NQP','nqp-p');
constant('JS_PARROT','parrot');

# HACK
say('js-runner-default: js-all');

my $stage1-qast-compiler-pbc := nqp('src/vm/js','QAST/Compiler',1);

say("js-all: $stage1-qast-compiler-pbc");

#
#
#JS_NQPCORE_PBC = NQPCORE.setting.pbc
#
#$(JS_STAGE1)/$(QASTNODE_COMBINED): $(QASTNODE_SOURCES)
# $(MKPATH) $(JS_STAGE1)/gen
# $(PERL) tools/build/gen-cat.pl js $(QASTNODE_SOURCES) > $(JS_STAGE1)/$(QASTNODE_COMBINED)
#
#js-all: $(JS_STAGE1)/$(QASTNODE_COMBINED) js-cross_compiler js-install-modules
#
#js-runner-default: js-all

0 comments on commit bca9dec

Please sign in to comment.