| 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 | |
| 25 | include $(top_srcdir)/vars.am |
| 26 | |
| 27 | GNUPLOT = gnuplot |
| 28 | |
| 29 | FORCE = |
| 30 | FORCE: |
| 31 | .PHONY: FORCE |
| 32 | |
| 33 | ###-------------------------------------------------------------------------- |
| 34 | ### Preliminaries. |
| 35 | |
| 36 | v_bench = $(v_bench_@AM_V@) |
| 37 | v_bench_ = $(v_bench_@AM_DEFAULT_V@) |
| 38 | v_bench_0 = @echo " BENCH $@"; |
| 39 | |
| 40 | BENCHES = |
| 41 | bench: $(BENCHES) |
| 42 | |
| 43 | noinst_PROGRAMS += timeit |
| 44 | timeit_SOURCES = timeit.c |
| 45 | |
| 46 | CLEANFILES += *.out *.bench |
| 47 | |
| 48 | ###-------------------------------------------------------------------------- |
| 49 | ### Lisp systems using `runlisp'. |
| 50 | |
| 51 | RUNLISP = $(top_builddir)/runlisp \ |
| 52 | -c$(top_srcdir)/runlisp.conf \ |
| 53 | -oimage-dir=$(top_builddir) |
| 54 | EXTRA_DIST += t.lisp |
| 55 | |
| 56 | RUNLISP_BENCHES = $(foreach l,$(LISPS), runlisp.$l.bench) |
| 57 | BENCHES += $(RUNLISP_BENCHES) |
| 58 | $(RUNLISP_BENCHES): runlisp.%.bench: timeit $(FORCE) |
| 59 | $(v_bench)./timeit $(RUNLISP) -L$* -- \ |
| 60 | $(srcdir)/t.lisp a b c >runlisp.$*.out 2>$@ |
| 61 | |
| 62 | RUNLISP_NOIMAGE_BENCHES = $(foreach l,$(LISPS), runlisp-noimage.$l.bench) |
| 63 | BENCHES += $(RUNLISP_NOIMAGE_BENCHES) |
| 64 | $(RUNLISP_NOIMAGE_BENCHES): runlisp-noimage.%.bench: timeit $(FORCE) |
| 65 | $(v_bench)./timeit $(RUNLISP) -D -L$* -- \ |
| 66 | $(srcdir)/t.lisp a b c >runlisp-noimage.$*.out 2>$@ |
| 67 | |
| 68 | ###-------------------------------------------------------------------------- |
| 69 | ### Lisp systems using `cl-launch'. |
| 70 | |
| 71 | CL_LAUNCH_BENCHES = $(foreach l,$(LISPS), cl-launch.$l.bench) |
| 72 | BENCHES += $(CL_LAUNCH_BENCHES) |
| 73 | $(CL_LAUNCH_BENCHES): cl-launch.%.bench: timeit $(FORCE) |
| 74 | $(v_bench)./timeit cl-launch -X -l $* -- $(srcdir)/t.lisp a b c >cl-launch.$*.out 2>$@ |
| 75 | |
| 76 | ###-------------------------------------------------------------------------- |
| 77 | ### C programs (as a baseline). |
| 78 | |
| 79 | BENCHES += c.tcc.bench |
| 80 | c.tcc.bench: timeit $(FORCE) |
| 81 | $(v_bench)./timeit tcc -run $(srcdir)/t.c a b c >c.tcc.out 2>$@ |
| 82 | |
| 83 | BENCHES += c.gcc.bench |
| 84 | noinst_PROGRAMS += t.c.gcc |
| 85 | t_c_gcc_SOURCES = t.c |
| 86 | c.gcc.bench: t.c.gcc timeit $(FORCE) |
| 87 | $(v_bench)./timeit ./t.c.gcc a b c >c.gcc.out 2>$@ |
| 88 | |
| 89 | ###-------------------------------------------------------------------------- |
| 90 | ### Other scripting languages. |
| 91 | |
| 92 | BENCHES += perl.bench |
| 93 | EXTRA_DIST += t.pl |
| 94 | perl.bench: timeit $(FORCE) |
| 95 | $(v_bench)./timeit perl -- $(srcdir)/t.pl a b c >perl.out 2>$@ |
| 96 | |
| 97 | BENCHES += python.bench |
| 98 | EXTRA_DIST += t.py |
| 99 | python.bench: timeit $(FORCE) |
| 100 | $(v_bench)./timeit python -- $(srcdir)/t.py a b c >python.out 2>$@ |
| 101 | |
| 102 | SHELLS = dash bash zsh |
| 103 | EXTRA_DIST += t.sh |
| 104 | SHELL_BENCHES = $(foreach s,$(SHELLS), shell.$s.bench) |
| 105 | BENCHES += $(SHELL_BENCHES) |
| 106 | $(SHELL_BENCHES): shell.%.bench: timeit $(FORCE) |
| 107 | $(v_bench)TEST_SHELL=$* ./timeit $* -- $(srcdir)/t.sh a b c >shell.$*.out 2>$@ |
| 108 | |
| 109 | ###-------------------------------------------------------------------------- |
| 110 | ### Reporting. |
| 111 | |
| 112 | GRAPHS = |
| 113 | noinst_DATA += $(GRAPHS) |
| 114 | CLEANFILES += $(GRAPHS) |
| 115 | |
| 116 | v_massage = $(v_massage_@AM_V@) |
| 117 | v_massage_ = $(v_massage_@AM_DEFAULT_V@) |
| 118 | v_massage_0 = @echo " MASSAGE $@"; |
| 119 | |
| 120 | v_gnuplot = $(v_gnuplot_@AM_V@) |
| 121 | v_gnuplot_ = $(v_gnuplot_@AM_DEFAULT_V@) |
| 122 | v_gnuplot_0 = @echo " GNUPLOT $@"; |
| 123 | |
| 124 | CLEANFILES += bench.data |
| 125 | bench.data: $(BENCHES) massage-benchmarks |
| 126 | $(v_massage)$(srcdir)/massage-benchmarks >$@.new && mv $@.new $@ |
| 127 | |
| 128 | GRAPHS += lisp-graph.tikz |
| 129 | lisp-graph.tikz: lisp-graph.gp bench.data |
| 130 | $(v_gnuplot)$(GNUPLOT) $< >$@.new && mv $@.new $@ |
| 131 | |
| 132 | GRAPHS += interp-graph.tikz |
| 133 | interp-graph.tikz: interp-graph.gp bench.data |
| 134 | $(v_gnuplot)$(GNUPLOT) $< >$@.new && mv $@.new $@ |
| 135 | |
| 136 | graphs: $(GRAPHS) |
| 137 | .PHONY: graphs |
| 138 | |
| 139 | ###----- That's all, folks -------------------------------------------------- |