@@@ version hash
[runlisp] / Makefile.am
CommitLineData
e29834b8
MW
1### -*-makefile-*-
2###
3### Build script for `runlisp'
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
27SUBDIRS =
28
e29834b8
MW
29image_DATA =
30image_SCRIPTS =
31
32SUBDIRS += .
33
34ACLOCAL_AMFLAGS = -Im4
35
36###--------------------------------------------------------------------------
8996f767
MW
37### A library of common code.
38
39noinst_LIBRARIES += librunlisp.a
40librunlisp_a_SOURCES =
41
42librunlisp_a_SOURCES += common.c common.h
43librunlisp_a_SOURCES += lib.c lib.h
44librunlisp_a_SOURCES += mdwopt.c mdwopt.h
10427eb2 45librunlisp_a_SOURCES += sha256.c sha256.h
8996f767
MW
46
47###--------------------------------------------------------------------------
e29834b8
MW
48### The main driver program.
49
50bin_PROGRAMS += runlisp
51runlisp_SOURCES = runlisp.c
8996f767 52runlisp_LDADD = librunlisp.a
e29834b8 53man_MANS += runlisp.1
8996f767 54doc_DATA += runlisp.pdf
10427eb2 55EXTRA_DIST += runlisp.1.in
7b8ff279 56
6c39ec6d
MW
57noinst_PROGRAMS += old-runlisp
58old_runlisp_SOURCES = old-runlisp.c
59old_runlisp_LDADD = librunlisp.a
60
61noinst_PROGRAMS += toy
62toy_SOURCES = toy.c
63toy_LDADD = librunlisp.a
64
65noinst_PROGRAMS += hash
66hash_SOURCES = hash.c
67hash_LDADD = librunlisp.a
68
e29834b8
MW
69###--------------------------------------------------------------------------
70### Additional machinery.
71
72pkgdata_DATA += eval.lisp
73EXTRA_DIST += eval.lisp
74
10427eb2 75pkgdata_SCRIPTS += dump-ecl
8996f767
MW
76EXTRA_DIST += dump-ecl
77
78bin_PROGRAMS += query-runlisp-config
79query_runlisp_config_SOURCES = query-runlisp-config.c
80query_runlisp_config_LDADD = librunlisp.a
81man_MANS += query-runlisp-config.1
82doc_DATA += query-runlisp-config.pdf
10427eb2 83EXTRA_DIST += query-runlisp-config.1.in
8996f767
MW
84
85man_MANS += runlisp.conf.5
86doc_DATA += runlisp.conf.pdf
10427eb2 87EXTRA_DIST += runlisp.conf.5.in
8996f767
MW
88
89EXTRA_DIST += runlisp-base.conf
90install-data-hook::
91 $(MKDIR_P) $(DESTDIR)$(pkgconfdir)/runlisp.d
92 cp $(srcdir)/runlisp-base.conf \
93 $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
94uninstall-hook::
95 rm -f $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
96
97EXTRA_DIST += runlisp.conf
98install-data-hook::
99 $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
100 if ! [ -f $(DESTDIR)$(pkgconfdir)/runlisp.conf ]; then \
101 cp $(srcdir)/runlisp.conf $(DESTDIR)$(pkgconfdir)/; \
102 fi
103uninstall-hook::
104 rm -f $(DESTDIR)$(pkgconfdir)/runlisp.conf
105
e29834b8
MW
106###--------------------------------------------------------------------------
107### Image dumping.
108
7b8ff279
MW
109bin_PROGRAMS += dump-runlisp-image
110dump_runlisp_image_SOURCES = dump-runlisp-image.c
8996f767 111dump_runlisp_image_LDADD = librunlisp.a
e29834b8 112man_MANS += dump-runlisp-image.1
8996f767 113doc_DATA += dump-runlisp-image.pdf
10427eb2 114EXTRA_DIST += dump-runlisp-image.1.in
e29834b8 115
7b8ff279 116DUMP_RUNLISP_IMAGE = $(v_dump)./dump-runlisp-image \
8996f767 117 -f -c$(srcdir)/runlisp-base.conf -O$@
7b8ff279 118
e29834b8
MW
119v_dump = $(v_dump_@AM_V@)
120v_dump_ = $(v_dump_@AM_DEFAULT_V@)
121v_dump_0 = @echo " DUMP $@";
122
6c39ec6d
MW
123IMAGES =
124noinst_DATA += $(IMAGES)
125
e29834b8 126if DUMP_SBCL
6c39ec6d 127IMAGES += sbcl+asdf.core
e29834b8 128CLEANFILES += sbcl+asdf.core
8996f767 129sbcl+asdf.core: dump-runlisp-image runlisp-base.conf
7b8ff279 130 $(DUMP_RUNLISP_IMAGE) sbcl
e29834b8
MW
131endif
132
133if DUMP_CCL
6c39ec6d 134IMAGES += ccl+asdf.image
e29834b8 135CLEANFILES += ccl+asdf.image
8996f767 136ccl+asdf.image: dump-runlisp-image runlisp-base.conf
7b8ff279 137 $(DUMP_RUNLISP_IMAGE) ccl
e29834b8
MW
138endif
139
140if DUMP_CLISP
6c39ec6d 141IMAGES += clisp+asdf.mem
e29834b8 142CLEANFILES += clisp+asdf.mem
8996f767 143clisp+asdf.mem: dump-runlisp-image runlisp-base.conf
7b8ff279 144 $(DUMP_RUNLISP_IMAGE) clisp
e29834b8
MW
145endif
146
147if DUMP_ECL
6c39ec6d 148IMAGES += ecl+asdf
e29834b8 149CLEANFILES += ecl+asdf
8996f767 150ecl+asdf: dump-runlisp-image runlisp-base.conf dump-ecl
7b8ff279 151 $(DUMP_RUNLISP_IMAGE) -odata-dir=$(srcdir) ecl
e29834b8
MW
152endif
153
154if DUMP_CMUCL
6c39ec6d 155IMAGES += cmucl+asdf.core
e29834b8 156CLEANFILES += cmucl+asdf.core
8996f767 157cmucl+asdf.core: dump-runlisp-image runlisp-base.conf
7b8ff279 158 $(DUMP_RUNLISP_IMAGE) cmucl
e29834b8
MW
159endif
160
6c39ec6d
MW
161install-data-hook::
162 mkdir -p $(DESTDIR)$(imagedir)
163 set -e; for i in $(IMAGES); do \
164 j=$$(readlink $$i); \
165 cp $$j $(DESTDIR)$(imagedir)/$$j.new && \
166 mv $(DESTDIR)$(imagedir)/$$j.new \
167 $(DESTDIR)$(imagedir)/$$j; \
168 ln -sf $$j $(DESTDIR)$(imagedir)/$$i; \
169 done
170
171uninstall-hook::
172 set -e; for i in $(IMAGES); do \
173 if j=$$(readlink $(DESTDIR)$(imagedir)/$$i); then \
174 case $$j in \
175 $$i-*[!0-9a-f]) ;; \
176 $$i-*) rm -f $(DESTDIR)$(imagedir)/$$j ;; \
177 esac; \
178 fi; \
179 rm -f $(DESTDIR)$(imagedir)/$$i; \
180 done
181
e29834b8 182###--------------------------------------------------------------------------
8996f767 183### Other subdirectories.
e29834b8 184
8996f767
MW
185## Documentation.
186SUBDIRS += doc
187
188## Testing.
189SUBDIRS += t
190
191## Benchmarking.
e29834b8
MW
192if BENCHMARK
193SUBDIRS += bench
194endif
195
e29834b8
MW
196###--------------------------------------------------------------------------
197### Distribution.
198
199## Release number.
200dist-hook::
201 echo $(VERSION) >$(distdir)/RELEASE
202
203## Additional build tools.
204EXTRA_DIST += config/auto-version
205
206###----- That's all, folks --------------------------------------------------