+.bash_history
+.cache
+.mal-history
+.crystal
+.lein
+.m2
+.ivy2
+.sbt
*/experiments
*/node_modules
*.o
*/step8_macros
*/step9_try
*/stepA_mal
-.bash_history
-.mal-history
-.crystal
-.lein
-.m2
-.ivy2
-.sbt
awk/mal.awk
bash/mal.sh
c/mal
cs/*.exe
cs/*.dll
cs/*.mdb
+d/*.o
d/mal
elixir/_build
elixir/deps
erlang/src/*.beam
es6/mal.js
es6/build
+forth/mal.fs
fsharp/*.exe
fsharp/*.dll
fsharp/*.mdb
haxe/*.py
haxe/cpp/
haxe/*.js
+java/mal.jar
java/target/
java/dependency-reduced-pom.xml
js/mal.js
kotlin/*.iml
lua/lib
lua/linenoise.so
+lua/mal.lua
make/mal.mk
mal/mal.mal
nim/mal
ocaml/*.cmx
ocaml/*.o
ocaml/mal_lib.*
+ocaml/mal
+perl/mal.pl
php/mal.php
+ps/mal.ps
python/mal.pyz
+r/mal.r
+racket/mal
+rpython/mal
+ruby/mal.rb
rust/target/
rust/mal
rust/Cargo.lock
rust/.cargo
r/lib
+scala/mal.jar
scala/target
scala/project
+tcl/mal.tcl
vb/*.exe
vb/*.dll
+vimscript/mal.vim
PERF_EXCLUDES = mal # TODO: fix this
+DIST_EXCLUDES += mal
+# TODO: still need to implement dist
+DIST_EXCLUDES += factor groovy guile io julia matlab miniMAL swift
+
#
# Utility functions
#
fsharp_RUNSTEP = mono ../$(2) --raw $(3)
go_RUNSTEP = ../$(2) $(3)
groovy_RUNSTEP = groovy ../$(2) $(3)
+# needs TERM=dumb to work with readline
+guile_RUNSTEP = guile --no-auto-compile -L ../guile ../$(2) $(3)
haskell_RUNSTEP = ../$(2) $(3)
haxe_RUNSTEP = python3 ../$(2) $(3)
haxe_RUNSTEP = $(haxe_RUNSTEP_$(HAXE_MODE))
tcl_RUNSTEP = tclsh ../$(2) --raw $(3)
vb_RUNSTEP = mono ../$(2) --raw $(3)
vimscript_RUNSTEP = ./run_vimscript.sh ../$(2) $(3)
-# needs TERM=dumb to work with readline
-guile_RUNSTEP = guile --no-auto-compile -L ../guile ../$(2) $(3)
vimscript_TEST_OPTS = --test-timeout 30
IMPL_STATS = $(foreach impl,$(DO_IMPLS),stats^$(impl))
IMPL_STATS_LISP = $(foreach impl,$(DO_IMPLS),stats-lisp^$(impl))
-IMPL_DIST = $(foreach impl,$(DO_IMPLS),dist^$(impl))
+IMPL_DIST = $(filter-out $(foreach impl,$(DIST_EXCLUDES),dist^$(impl)),\
+ $(foreach impl,$(DO_IMPLS),dist^$(impl)))
DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl))
SOURCES_LISP = src/env.clj src/core.clj src/stepA_mal.clj
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
-all dist: deps mal.jar
+all: deps
+
+dist: mal.jar
deps:
lein deps
#####################
-.PHONY: all mal clean stats stats-lisp
+.PHONY: all dist clean stats stats-lisp
all: $(BINS)
clean:
rebar clean
+ rm -f mal
stats: $(SOURCES)
@wc $^
-SOURCES_BASE = types.fs str.fs reader.fs printer.fs
+SOURCES_BASE = str.fs types.fs reader.fs printer.fs
SOURCES_LISP = env.fs core.fs stepA_mal.fs
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
all:
+ true
+
+dist: mal.fs
+
+mal.fs: $(SOURCES)
+ echo "#! /usr/bin/env gforth" > $@
+ cat $+ | egrep -v "^require |^droprequire " >> $@
+ chmod +x $@
+
+clean:
+ rm -f mal.fs
.PHONY: stats tests $(TESTS)
all: $(patsubst %.fs,%.exe,$(SRCS))
+dist: mal.exe
+
+mal.exe: stepA_mal.exe
+ cp $< $@
+
Mono.Terminal.dll: $(TERMINAL_SOURCES)
mcs $(CSFLAGS) -target:library $+ -out:$@
#####################
-all: $(BINS) mal
+all: $(BINS)
+
+dist: mal
mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
#####################
-all: $(BINS) mal
+all: $(BINS)
+
+dist: mal
mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
all-js: $(foreach x,$(STEPS),$(x).js)
+dist: mal.n mal.py cpp/mal mal.js
+
+mal.n: stepA_mal.n
+ cp $< $@
+
+mal.py: stepA_mal.py
+ cp $< $@
+
+cpp/mal: cpp/stepA_mal
+ cp $< $@
+
+mal.js: stepA_mal.js
+ cp $< $@
+
# Neko target (neko)
###
clean:
+ rm -f mal.n mal.py cpp/mal mal.js
rm -r step*.py cpp/ step*.js step*.n
all:
mvn install
+dist: mal.jar
+
+mal.jar: target/classes/mal/stepA_mal.class
+ mvn assembly:assembly
+ cp target/mal-0.0.1.jar $@
+
src/main/mal/%.java:
mvn install
target/classes/mal/step%.class: src/main/mal/step%.java ${SOURCES}
mvn install
+clean:
+ mvn clean
+ rm -f mal.jar
+
#.PHONY: stats tests $(TESTS)
.PHONY: stats
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>mal.stepA_mal</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
TESTS = tests/types.js tests/reader.js
-SOURCES_BASE = node_readline.js types.js reader.js printer.js
+SOURCES_BASE = node_readline.js types.js reader.js printer.js interop.js
SOURCES_LISP = env.js core.js stepA_mal.js
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
WEB_SOURCES = $(SOURCES:node_readline.js=jq_readline.js)
-all: node_modules mal.js web/mal.js
+all: node_modules
+
+dist: mal.js web/mal.js
node_modules:
npm install
all: $(JARS)
+dist: mal.jar
+
+mal.jar: stepA_mal.jar
+ cp $< $@
+
clean:
- rm -vf $(JARS)
+ rm -vf $(JARS) mal.jar
$(JARS): %.jar: src/mal/%.kt $(SOURCES_BASE:%.kt=src/mal/%.kt)
kotlinc src/mal/$(@:%.jar=%.kt) $(SOURCES_BASE:%.kt=src/mal/%.kt) -include-runtime -d $@
all: libs
-.PHONY: stats tests $(TESTS)
+dist: mal.lua
+
+SOURCE_NAMES = $(patsubst %.lua,%,$(SOURCES))
+mal.lua: $(SOURCES)
+ echo "#!/usr/bin/env lua" > $@
+ echo "local $(foreach n,$(SOURCE_NAMES),$(n),) M" >> $@
+ echo "M={} $(foreach n,$(SOURCE_NAMES),$(n)=M);" >> $@
+ cat $+ | grep -v -e "return M$$" \
+ -e "return Env" \
+ -e "local M =" \
+ -e "^#!" \
+ $(foreach n,$(SOURCE_NAMES),-e "require('$(n)')") >> $@
+ chmod +x $@
+
clean:
- rm -f linenoise.so
+ rm -f linenoise.so mal.lua
rm -rf lib/lua/5.1
+.PHONY: stats tests $(TESTS)
+
stats: $(SOURCES)
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*--|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
SOURCES_LISP = env.mk core.mk stepA_mal.mk
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
+all:
+ true
+
+dist: mal.mk
+
mal.mk: $(SOURCES)
echo "#!/usr/bin/make -f" > $@
cat $+ | grep -v "^include " >> $@
#####################
-all: $(BINS) mal
+all: $(BINS)
+
+dist: mal
mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
STEP_BINS = $(STEPS:%.ml=%)
LAST_STEP_BIN = $(word $(words $(STEP_BINS)),$(STEP_BINS))
-all: $(STEP_BINS) mal
+all: $(STEP_BINS)
+
+dist: mal
mal: $(LAST_STEP_BIN)
cp $< $@
# Specific implementation requirements
##########################################################
-RUN apt-get -y install perl
+RUN apt-get -y install perl libapp-fatpacker-perl
SOURCES_LISP = env.pm core.pm stepA_mal.pl
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
-#all: mal.pl
+all:
+
+dist: mal.pl
+
+mal.pl: $(SOURCES)
+ echo "#!/usr/bin/env perl" > $@
+ fatpack pack stepA_mal.pl >> $@
+
+clean:
+ rm -f mal.pl
.PHONY: stats tests $(TESTS)
all:
+dist: mal.php
+
+mal.php: $(SOURCES)
+ echo "#!/usr/bin/env php" > $@
+ cat $+ | grep -v "^require_once" >> $@
+ chmod +x $@
+
+clean:
+ rm mal.php
+
.PHONY: stats tests $(TESTS)
stats: $(SOURCES)
SOURCES_LISP = env.ps core.ps stepA_mal.ps
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
+all:
+ true
+
+dist: mal.ps
+
+mal.ps: $(SOURCES)
+ echo "#!/bin/sh" > $@
+ echo "\":\" pop pop pop pop %#; exec gs -d'#!'=null -d'\":\"'=null -q -dNODISPLAY -- \"\$$0\" \"\$$@\"" >> $@
+ cat $+ | grep -v "runlibfile$$" >> $@
+ chmod +x $@
+
+clean:
+ rm -f mal.ps
+
+
.PHONY: stats tests $(TESTS)
stats: $(SOURCES)
SOURCES_LISP = env.py core.py stepA_mal.py
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
-all: mal.py
+all:
true
-mal.py: stepA_mal.py
- echo "#!/usr/bin/env python" > $@
- cat $+ >> $@
+dist: mal.pyz
+
+SHELL := bash
+mal.pyz: $(SOURCES)
+ cp stepA_mal.py __main__.py
+ cat <(echo '#!/usr/bin/env python') <(zip -q - __main__.py $+) > $@
+ rm __main__.py
chmod +x $@
clean:
- rm -f mal.py
+ rm -f mal.pyz
.PHONY: stats tests $(TESTS)
all: libs
+dist: mal.r
+
+mal.r: $(SOURCES)
+ echo "#!/usr/bin/env Rscript" > $@
+ cat $+ | grep -v " source(" >> $@
+ chmod +x $@
+
+clean:
+ rm -f mal.r
+
.PHONY: stats tests $(TESTS)
stats: $(SOURCES)
all:
+dist: mal
+
+mal: $(SOURCES)
+ raco exe stepA_mal.rkt
+ mv stepA_mal $@
+
+clean:
+ mal
+
.PHONY: stats
stats: $(SOURCES)
all: $(STEPS)
+dist: mal
+
+mal: stepA_mal
+ cp $< $@
+
%: %.py
$(RPYTHON) --output=$@ $<
.PHONY: clean stats stats-lisp
clean:
- rm -f $(STEPS) *.pyc
+ rm -f mal $(STEPS) *.pyc
rm -rf __pycache__
stats: $(SOURCES)
SOURCES_LISP = env.rb core.rb stepA_mal.rb
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
-#all: mal.rb
+all:
+ true
+
+dist: mal.rb
+
+mal.rb: $(SOURCES)
+ echo "#!/usr/bin/env ruby" > $@
+ cat $+ | grep -v "^require_relative" >> $@
+ chmod +x $@
+
+clean:
+ rm -f mal.rb
.PHONY: stats tests $(TESTS)
all: mal
-mal: ${SOURCES_BASE} $(word $(words ${SOURCES_LISP}),${SOURCES_LISP})
- cargo build --release
- cp $(word $(words ${BINS}),${BINS}) $@
+dist: mal
+
+mal: target/release/stepA_mal
+ cp $< $@
# TODO: would be nice to build just the step requested
$(BINS): target/release/%: src/bin/%.rs $(wildcard src/*.rs)
SOURCES_LISP = env.scala core.scala stepA_mal.scala
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
-all:
+all: build
+
+build:
sbt 'run-main stepA_mal ../tests/incA.mal'
+dist: mal.jar
+
+mal.jar: $(SOURCES)
+ sbt assembly
+ cp target/scala-*/mal-assembly*.jar $@
+
+clean:
+ rm -f mal.jar
+
.PHONY: stats tests $(TESTS)
stats: $(SOURCES)
--- /dev/null
+import AssemblyKeys._ // put this at the top of the file
+
+assemblySettings
logLevel in runMain := Level.Warn
+mainClass in Compile := Some("stepA_mal")
--- /dev/null
+addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
.PHONY: stats stats-lisp
+all:
+ true
+
+dist: mal.tcl
+
+mal.tcl: $(SOURCES)
+ echo "#!/usr/bin/env tclsh" > $@
+ cat $+ | grep -v "^source " >> $@
+ chmod +x $@
+
+clean:
+ rm -f mal.tcl
+
+
stats: $(SOURCES)
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*\"|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
#####################
-all: mal.exe $(patsubst %.vb,%.exe,$(SRCS))
+all: $(patsubst %.vb,%.exe,$(SRCS))
+
+dist: mal.exe
mal.exe: $(patsubst %.vb,%.exe,$(word $(words $(SOURCES)),$(SOURCES)))
cp $< $@
all: libvimreadline.so
+dist: mal.vim
+
+mal.vim: $(SOURCES)
+ echo "#!/bin/sh" > $@
+ echo "\":\" ; rundir=\`dirname \$$0\`" >> $@
+ echo "\":\" ; export LD_LIBRARY_PATH=\`readlink -f \$$rundir\`" >> $@
+ echo "\":\" ; exec vim -i NONE -V1 -nNesS \"\$$0\" -- \"\$$@\"" >> $@
+ cat $+ | grep -v "^source " >> $@
+ chmod +x $@
+
+
libvimreadline.so: vimreadline.o
$(CC) -g -shared -o $@ $< -lreadline
$(CC) -g -fPIC -c $< -o $@
clean:
- rm -f vimreadline.o libvimreadline.so
+ rm -f vimreadline.o libvimreadline.so mal.vim
stats: $(SOURCES)
@wc $^