@@@ version hash
[runlisp] / Makefile.am
... / ...
CommitLineData
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
29image_DATA =
30image_SCRIPTS =
31
32SUBDIRS += .
33
34ACLOCAL_AMFLAGS = -Im4
35
36###--------------------------------------------------------------------------
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
45librunlisp_a_SOURCES += sha256.c sha256.h
46
47###--------------------------------------------------------------------------
48### The main driver program.
49
50bin_PROGRAMS += runlisp
51runlisp_SOURCES = runlisp.c
52runlisp_LDADD = librunlisp.a
53man_MANS += runlisp.1
54doc_DATA += runlisp.pdf
55EXTRA_DIST += runlisp.1.in
56
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
69###--------------------------------------------------------------------------
70### Additional machinery.
71
72pkgdata_DATA += eval.lisp
73EXTRA_DIST += eval.lisp
74
75pkgdata_SCRIPTS += dump-ecl
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
83EXTRA_DIST += query-runlisp-config.1.in
84
85man_MANS += runlisp.conf.5
86doc_DATA += runlisp.conf.pdf
87EXTRA_DIST += runlisp.conf.5.in
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
106###--------------------------------------------------------------------------
107### Image dumping.
108
109bin_PROGRAMS += dump-runlisp-image
110dump_runlisp_image_SOURCES = dump-runlisp-image.c
111dump_runlisp_image_LDADD = librunlisp.a
112man_MANS += dump-runlisp-image.1
113doc_DATA += dump-runlisp-image.pdf
114EXTRA_DIST += dump-runlisp-image.1.in
115
116DUMP_RUNLISP_IMAGE = $(v_dump)./dump-runlisp-image \
117 -f -c$(srcdir)/runlisp-base.conf -O$@
118
119v_dump = $(v_dump_@AM_V@)
120v_dump_ = $(v_dump_@AM_DEFAULT_V@)
121v_dump_0 = @echo " DUMP $@";
122
123IMAGES =
124noinst_DATA += $(IMAGES)
125
126if DUMP_SBCL
127IMAGES += sbcl+asdf.core
128CLEANFILES += sbcl+asdf.core
129sbcl+asdf.core: dump-runlisp-image runlisp-base.conf
130 $(DUMP_RUNLISP_IMAGE) sbcl
131endif
132
133if DUMP_CCL
134IMAGES += ccl+asdf.image
135CLEANFILES += ccl+asdf.image
136ccl+asdf.image: dump-runlisp-image runlisp-base.conf
137 $(DUMP_RUNLISP_IMAGE) ccl
138endif
139
140if DUMP_CLISP
141IMAGES += clisp+asdf.mem
142CLEANFILES += clisp+asdf.mem
143clisp+asdf.mem: dump-runlisp-image runlisp-base.conf
144 $(DUMP_RUNLISP_IMAGE) clisp
145endif
146
147if DUMP_ECL
148IMAGES += ecl+asdf
149CLEANFILES += ecl+asdf
150ecl+asdf: dump-runlisp-image runlisp-base.conf dump-ecl
151 $(DUMP_RUNLISP_IMAGE) -odata-dir=$(srcdir) ecl
152endif
153
154if DUMP_CMUCL
155IMAGES += cmucl+asdf.core
156CLEANFILES += cmucl+asdf.core
157cmucl+asdf.core: dump-runlisp-image runlisp-base.conf
158 $(DUMP_RUNLISP_IMAGE) cmucl
159endif
160
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
182###--------------------------------------------------------------------------
183### Other subdirectories.
184
185## Documentation.
186SUBDIRS += doc
187
188## Testing.
189SUBDIRS += t
190
191## Benchmarking.
192if BENCHMARK
193SUBDIRS += bench
194endif
195
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 --------------------------------------------------