Skip to content

Commit

Permalink
Add dist targets to most implementations.
Browse files Browse the repository at this point in the history
TODO: factor groovy guile julia matlab miniMAL swift
  • Loading branch information
kanaka committed Feb 24, 2016
1 parent b6dc3e3 commit 5245b07
Show file tree
Hide file tree
Showing 34 changed files with 266 additions and 37 deletions.
29 changes: 22 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.bash_history
.cache
.mal-history
.crystal
.lein
.m2
.ivy2
.sbt
*/experiments
*/node_modules
*.o
Expand All @@ -13,13 +21,6 @@
*/step8_macros
*/step9_try
*/stepA_mal
.bash_history
.mal-history
.crystal
.lein
.m2
.ivy2
.sbt
awk/mal.awk
bash/mal.sh
c/mal
Expand All @@ -32,6 +33,7 @@ crystal/mal
cs/*.exe
cs/*.dll
cs/*.mdb
d/*.o
d/mal
elixir/_build
elixir/deps
Expand All @@ -44,6 +46,7 @@ erlang/.rebar
erlang/src/*.beam
es6/mal.js
es6/build
forth/mal.fs
fsharp/*.exe
fsharp/*.dll
fsharp/*.mdb
Expand All @@ -57,6 +60,7 @@ haxe/*.n
haxe/*.py
haxe/cpp/
haxe/*.js
java/mal.jar
java/target/
java/dependency-reduced-pom.xml
js/mal.js
Expand All @@ -66,6 +70,7 @@ kotlin/.idea
kotlin/*.iml
lua/lib
lua/linenoise.so
lua/mal.lua
make/mal.mk
mal/mal.mal
nim/mal
Expand All @@ -76,14 +81,24 @@ ocaml/*.swp
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
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ STEP5_EXCLUDES += crystal # test completes, even at 1,000,000

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
#
Expand Down Expand Up @@ -182,6 +186,8 @@ forth_RUNSTEP = gforth ../$(2) $(3)
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))
Expand Down Expand Up @@ -211,8 +217,6 @@ swift3_RUNSTEP = ../$(2) $(3)
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
Expand All @@ -233,7 +237,8 @@ ALL_TESTS = $(filter-out $(foreach impl,$(STEP5_EXCLUDES),test^$(impl)^step5),\
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))

Expand Down
4 changes: 3 additions & 1 deletion clojure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ SOURCES_BASE = src/readline.clj src/reader.clj src/printer.clj
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
Expand Down
3 changes: 2 additions & 1 deletion erlang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BINS = $(SRCS:%.erl=%)

#####################

.PHONY: all mal clean stats stats-lisp
.PHONY: all dist clean stats stats-lisp

all: $(BINS)

Expand All @@ -34,6 +34,7 @@ $(foreach b,$(BINS),$(eval $(call dep_template,$(b))))

clean:
rebar clean
rm -f mal

stats: $(SOURCES)
@wc $^
Expand Down
13 changes: 12 additions & 1 deletion forth/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
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)

Expand Down
5 changes: 5 additions & 0 deletions fsharp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ CSFLAGS = $(if $(strip $(DEBUG)),-debug+,)

all: $(patsubst %.fs,%.exe,$(SRCS))

dist: mal.exe

mal.exe: stepA_mal.exe
cp $< $@

Mono.Terminal.dll: $(TERMINAL_SOURCES)
mcs $(CSFLAGS) -target:library $+ -out:$@

Expand Down
4 changes: 3 additions & 1 deletion go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ BINS = $(SRCS:%.go=%)

#####################

all: $(BINS) mal
all: $(BINS)

dist: mal

mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
Expand Down
4 changes: 3 additions & 1 deletion haskell/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ BINS = $(SRCS:%.hs=%)

#####################

all: $(BINS) mal
all: $(BINS)

dist: mal

mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
Expand Down
15 changes: 15 additions & 0 deletions haxe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ all-cpp: $(foreach x,$(STEPS),cpp/$(x))

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)

Expand Down Expand Up @@ -65,4 +79,5 @@ node_modules:
###

clean:
rm -f mal.n mal.py cpp/mal mal.js
rm -r step*.py cpp/ step*.js step*.n
10 changes: 10 additions & 0 deletions java/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
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

Expand Down
13 changes: 13 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
</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>
6 changes: 4 additions & 2 deletions js/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

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
Expand Down
7 changes: 6 additions & 1 deletion kotlin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ JARS = $(SOURCES_LISP:%.kt=%.jar)

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 $@
Expand Down
19 changes: 17 additions & 2 deletions lua/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,27 @@ SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)

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]"
Expand Down
5 changes: 5 additions & 0 deletions make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ SOURCES_BASE = util.mk numbers.mk readline.mk gmsl.mk types.mk \
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 " >> $@
Expand Down
4 changes: 3 additions & 1 deletion nim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ BINS = $(SRCS:%.nim=%)

#####################

all: $(BINS) mal
all: $(BINS)

dist: mal

mal: $(word $(words $(BINS)),$(BINS))
cp $< $@
Expand Down
4 changes: 3 additions & 1 deletion ocaml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ MAL_LIB = mal_lib.cmxa
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 $< $@
Expand Down
2 changes: 1 addition & 1 deletion perl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ WORKDIR /mal
# Specific implementation requirements
##########################################################

RUN apt-get -y install perl
RUN apt-get -y install perl libapp-fatpacker-perl
11 changes: 10 additions & 1 deletion perl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ SOURCES_BASE = readline.pm types.pm reader.pm printer.pm \
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)

Expand Down
Loading

0 comments on commit 5245b07

Please sign in to comment.