New version.
[runlisp] / bench / Makefile.am
CommitLineData
e29834b8
MW
1### -*-makefile-*-
2###
3### Build script for start-up benchmarks
4###
5### (c) 2020 Mark Wooding
6###
7
8###----- Licensing notice ---------------------------------------------------
9###
10### This file is part of Runlisp, a tool for invoking Common Lisp scripts.
11###
12### Runlisp is free software: you can redistribute it and/or modify it
13### under the terms of the GNU General Public License as published by the
14### Free Software Foundation; either version 3 of the License, or (at your
15### option) any later version.
16###
17### Runlisp is distributed in the hope that it will be useful, but WITHOUT
18### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20### for more details.
21###
22### You should have received a copy of the GNU General Public License
23### along with Runlisp. If not, see <https://www.gnu.org/licenses/>.
24
25include $(top_srcdir)/vars.am
26
27GNUPLOT = gnuplot
28
29FORCE =
30FORCE:
31.PHONY: FORCE
32
33###--------------------------------------------------------------------------
34### Preliminaries.
35
36v_bench = $(v_bench_@AM_V@)
37v_bench_ = $(v_bench_@AM_DEFAULT_V@)
38v_bench_0 = @echo " BENCH $@";
39
40BENCHES =
41bench: $(BENCHES)
42
43noinst_PROGRAMS += timeit
44timeit_SOURCES = timeit.c
45
46CLEANFILES += *.out *.bench
47
48###--------------------------------------------------------------------------
49### Lisp systems using `runlisp'.
50
51RUNLISP = $(top_builddir)/runlisp -I$(top_builddir)/
52EXTRA_DIST += t.lisp
53
54RUNLISP_BENCHES = $(foreach l,$(LISPS), runlisp.$l.bench)
55BENCHES += $(RUNLISP_BENCHES)
56$(RUNLISP_BENCHES): runlisp.%.bench: timeit $(FORCE)
57 $(v_bench)./timeit $(RUNLISP) -L$* -- $(srcdir)/t.lisp a b c >runlisp.$*.out 2>$@
58
59RUNLISP_NOIMAGE_BENCHES = $(foreach l,$(LISPS), runlisp-noimage.$l.bench)
60BENCHES += $(RUNLISP_NOIMAGE_BENCHES)
61$(RUNLISP_NOIMAGE_BENCHES): runlisp-noimage.%.bench: timeit $(FORCE)
62 $(v_bench)./timeit $(RUNLISP) -D -L$* -- $(srcdir)/t.lisp a b c >runlisp-noimage.$*.out 2>$@
63
64###--------------------------------------------------------------------------
65### Lisp systems using `cl-launch'.
66
67CL_LAUNCH_BENCHES = $(foreach l,$(LISPS), cl-launch.$l.bench)
68BENCHES += $(CL_LAUNCH_BENCHES)
69$(CL_LAUNCH_BENCHES): cl-launch.%.bench: timeit $(FORCE)
70 $(v_bench)./timeit cl-launch -X -l $* -- $(srcdir)/t.lisp a b c >cl-launch.$*.out 2>$@
71
72###--------------------------------------------------------------------------
73### C programs (as a baseline).
74
75BENCHES += c.tcc.bench
76c.tcc.bench: timeit $(FORCE)
77 $(v_bench)./timeit tcc -run $(srcdir)/t.c a b c >c.tcc.out 2>$@
78
79BENCHES += c.gcc.bench
80noinst_PROGRAMS += t.c.gcc
81t_c_gcc_SOURCES = t.c
82c.gcc.bench: t.c.gcc timeit $(FORCE)
83 $(v_bench)./timeit ./t.c.gcc a b c >c.gcc.out 2>$@
84
85###--------------------------------------------------------------------------
86### Other scripting languages.
87
88BENCHES += perl.bench
89EXTRA_DIST += t.pl
90perl.bench: timeit $(FORCE)
91 $(v_bench)./timeit perl -- $(srcdir)/t.pl a b c >perl.out 2>$@
92
93BENCHES += python.bench
94EXTRA_DIST += t.py
95python.bench: timeit $(FORCE)
96 $(v_bench)./timeit python -- $(srcdir)/t.py a b c >python.out 2>$@
97
98SHELLS = dash bash zsh
99EXTRA_DIST += t.sh
100SHELL_BENCHES = $(foreach s,$(SHELLS), shell.$s.bench)
101BENCHES += $(SHELL_BENCHES)
102$(SHELL_BENCHES): shell.%.bench: timeit $(FORCE)
103 $(v_bench)TEST_SHELL=$* ./timeit $* -- $(srcdir)/t.sh a b c >shell.$*.out 2>$@
104
105###--------------------------------------------------------------------------
106### Reporting.
107
108GRAPHS =
109noinst_DATA += $(GRAPHS)
110CLEANFILES += $(GRAPHS)
111
112v_massage = $(v_massage_@AM_V@)
113v_massage_ = $(v_massage_@AM_DEFAULT_V@)
114v_massage_0 = @echo " MASSAGE $@";
115
116v_gnuplot = $(v_gnuplot_@AM_V@)
117v_gnuplot_ = $(v_gnuplot_@AM_DEFAULT_V@)
118v_gnuplot_0 = @echo " GNUPLOT $@";
119
120CLEANFILES += bench.data
121bench.data: $(BENCHES) massage-benchmarks
122 $(v_massage)$(srcdir)/massage-benchmarks >$@.new && mv $@.new $@
123
124GRAPHS += lisp-graph.tikz
125lisp-graph.tikz: lisp-graph.gp bench.data
126 $(v_gnuplot)$(GNUPLOT) $< >$@.new && mv $@.new $@
127
128GRAPHS += interp-graph.tikz
129interp-graph.tikz: interp-graph.gp bench.data
130 $(v_gnuplot)$(GNUPLOT) $< >$@.new && mv $@.new $@
131
132graphs: $(GRAPHS)
133.PHONY: graphs
134
135###----- That's all, folks --------------------------------------------------