-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathMakefile
53 lines (48 loc) · 1.03 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
COLOR_GREEN := \033[1;32m
COLOR_WHITE := \033[1;37m
COLOR_NONE := \033[0m
LANGS = \
ada \
c\# \
c++ \
clojure \
crystal \
d \
fsharp \
go \
haskell \
java \
javascript \
kotlin \
lua \
nim \
ocaml \
pascal \
php \
python \
ruby \
rust \
swift \
#\
modula2 \
modula3 \
oberon07 \
.PHONY: compile run $(LANGS)
compile: $(LANGS)
$(LANGS):
$(MAKE) --directory ./$@
# This Makefile magic is nicely described here:
# http://stackoverflow.com/a/12110773/1178806
#
RUNS = $(addprefix run-,$(LANGS))
.PHONY: run $(RUNS)
run: $(RUNS)
$(RUNS): run-%: %
@echo
@echo -e "$(COLOR_GREEN)Running an implementation in $(COLOR_WHITE)$*$(COLOR_NONE)"
@echo "===================================="
sh -ec 'cd "./$*" && RUN_CMDS=$$($(MAKE) --silent --dry-run run) && \
OLD_IFS="$$IFS" && IFS="'$$'\n''" && for run_cmd in $$RUN_CMDS; do \
echo -e "Executing $(COLOR_WHITE)$$run_cmd$(COLOR_NONE) 20 times:" && \
IFS="$$OLD_IFS" && for _ in `seq 20`; do ../cgmemtime -t $$run_cmd 2>&1 | cut -d ";" -f4,5,6 | tr ";" "\t" ; done \
done'