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