guix build: Transformations operate on single objects.
[jackhill/guix/guix.git] / Makefile.am
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 # Copyright © 2015 Alex Kost <alezost@gmail.com>
5 # Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
6 #
7 # This file is part of GNU Guix.
8 #
9 # GNU Guix is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or (at
12 # your option) any later version.
13 #
14 # GNU Guix is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 bin_SCRIPTS = \
23 scripts/guix
24
25 nodist_noinst_SCRIPTS = \
26 pre-inst-env \
27 test-env
28
29 include gnu-system.am
30
31 MODULES = \
32 guix/base32.scm \
33 guix/base64.scm \
34 guix/cpio.scm \
35 guix/records.scm \
36 guix/gcrypt.scm \
37 guix/hash.scm \
38 guix/pk-crypto.scm \
39 guix/pki.scm \
40 guix/utils.scm \
41 guix/sets.scm \
42 guix/download.scm \
43 guix/git-download.scm \
44 guix/monads.scm \
45 guix/monad-repl.scm \
46 guix/gexp.scm \
47 guix/profiles.scm \
48 guix/serialization.scm \
49 guix/nar.scm \
50 guix/derivations.scm \
51 guix/gnu-maintenance.scm \
52 guix/upstream.scm \
53 guix/licenses.scm \
54 guix/graph.scm \
55 guix/cve.scm \
56 guix/build-system.scm \
57 guix/build-system/cmake.scm \
58 guix/build-system/emacs.scm \
59 guix/build-system/glib-or-gtk.scm \
60 guix/build-system/gnu.scm \
61 guix/build-system/haskell.scm \
62 guix/build-system/perl.scm \
63 guix/build-system/python.scm \
64 guix/build-system/waf.scm \
65 guix/build-system/r.scm \
66 guix/build-system/ruby.scm \
67 guix/build-system/trivial.scm \
68 guix/ftp-client.scm \
69 guix/http-client.scm \
70 guix/gnupg.scm \
71 guix/elf.scm \
72 guix/store.scm \
73 guix/cvs-download.scm \
74 guix/svn-download.scm \
75 guix/ui.scm \
76 guix/build/download.scm \
77 guix/build/cmake-build-system.scm \
78 guix/build/emacs-build-system.scm \
79 guix/build/git.scm \
80 guix/build/glib-or-gtk-build-system.scm \
81 guix/build/gnu-build-system.scm \
82 guix/build/gnu-dist.scm \
83 guix/build/perl-build-system.scm \
84 guix/build/python-build-system.scm \
85 guix/build/r-build-system.scm \
86 guix/build/ruby-build-system.scm \
87 guix/build/waf-build-system.scm \
88 guix/build/haskell-build-system.scm \
89 guix/build/store-copy.scm \
90 guix/build/utils.scm \
91 guix/build/union.scm \
92 guix/build/profiles.scm \
93 guix/build/pull.scm \
94 guix/build/rpath.scm \
95 guix/build/cvs.scm \
96 guix/build/svn.scm \
97 guix/build/gremlin.scm \
98 guix/build/emacs-utils.scm \
99 guix/build/graft.scm \
100 guix/search-paths.scm \
101 guix/packages.scm \
102 guix/import/utils.scm \
103 guix/import/gnu.scm \
104 guix/import/snix.scm \
105 guix/import/cabal.scm \
106 guix/import/cran.scm \
107 guix/import/hackage.scm \
108 guix/import/elpa.scm \
109 guix/scripts.scm \
110 guix/scripts/download.scm \
111 guix/scripts/build.scm \
112 guix/scripts/archive.scm \
113 guix/scripts/import.scm \
114 guix/scripts/package.scm \
115 guix/scripts/gc.scm \
116 guix/scripts/hash.scm \
117 guix/scripts/pull.scm \
118 guix/scripts/substitute.scm \
119 guix/scripts/authenticate.scm \
120 guix/scripts/refresh.scm \
121 guix/scripts/system.scm \
122 guix/scripts/lint.scm \
123 guix/scripts/challenge.scm \
124 guix/scripts/import/cran.scm \
125 guix/scripts/import/gnu.scm \
126 guix/scripts/import/nix.scm \
127 guix/scripts/import/hackage.scm \
128 guix/scripts/import/elpa.scm \
129 guix/scripts/environment.scm \
130 guix/scripts/publish.scm \
131 guix/scripts/edit.scm \
132 guix/scripts/size.scm \
133 guix/scripts/graph.scm \
134 guix/scripts/container.scm \
135 guix/scripts/container/exec.scm \
136 guix.scm \
137 $(GNU_SYSTEM_MODULES)
138
139 if HAVE_GUILE_JSON
140
141 MODULES += \
142 guix/import/json.scm \
143 guix/import/pypi.scm \
144 guix/scripts/import/pypi.scm \
145 guix/import/cpan.scm \
146 guix/scripts/import/gem.scm \
147 guix/import/gem.scm
148
149 endif
150
151 if BUILD_SYSCALLS_MODULE
152
153 MODULES += \
154 guix/build/syscalls.scm
155
156 endif
157
158 if BUILD_DAEMON_OFFLOAD
159
160 MODULES += \
161 guix/scripts/offload.scm
162
163 endif BUILD_DAEMON_OFFLOAD
164
165 # Internal module with test suite support.
166 dist_noinst_DATA = guix/tests.scm
167
168 # Linux-Libre configurations.
169 KCONFIGS = \
170 gnu/packages/linux-libre-i686.conf \
171 gnu/packages/linux-libre-x86_64.conf
172
173 # Templates, examples.
174 EXAMPLES = \
175 gnu/system/examples/bare-bones.tmpl \
176 gnu/system/examples/desktop.tmpl
177
178 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go guix/tests.go
179
180 nobase_dist_guilemodule_DATA = \
181 $(MODULES) $(KCONFIGS) $(EXAMPLES) \
182 $(MISC_DISTRO_FILES)
183 nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
184
185 # Do we need to provide our own non-broken (srfi srfi-37) module?
186 if INSTALL_SRFI_37
187
188 nobase_nodist_guilemodule_DATA += srfi/srfi-37.scm
189 GOBJECTS += srfi/srfi-37.go
190
191 srfi/srfi-37.scm: srfi/srfi-37.scm.in
192 $(MKDIR_P) srfi
193 cp "$<" "$@"
194
195 endif INSTALL_SRFI_37
196
197 # Handy way to remove the .go files without removing all the rest.
198 clean-go:
199 -$(RM) -f $(GOBJECTS)
200
201
202 # Test extensions; has to be unconditional.
203 TEST_EXTENSIONS = .scm .sh
204
205 if CAN_RUN_TESTS
206
207 SCM_TESTS = \
208 tests/base32.scm \
209 tests/base64.scm \
210 tests/cpio.scm \
211 tests/hash.scm \
212 tests/pk-crypto.scm \
213 tests/pki.scm \
214 tests/sets.scm \
215 tests/gnu-maintenance.scm \
216 tests/substitute.scm \
217 tests/builders.scm \
218 tests/derivations.scm \
219 tests/ui.scm \
220 tests/records.scm \
221 tests/utils.scm \
222 tests/build-utils.scm \
223 tests/packages.scm \
224 tests/snix.scm \
225 tests/hackage.scm \
226 tests/cran.scm \
227 tests/elpa.scm \
228 tests/store.scm \
229 tests/monads.scm \
230 tests/gexp.scm \
231 tests/nar.scm \
232 tests/union.scm \
233 tests/profiles.scm \
234 tests/syscalls.scm \
235 tests/gremlin.scm \
236 tests/lint.scm \
237 tests/publish.scm \
238 tests/scripts.scm \
239 tests/size.scm \
240 tests/graph.scm \
241 tests/challenge.scm \
242 tests/cve.scm \
243 tests/file-systems.scm \
244 tests/system.scm \
245 tests/services.scm \
246 tests/scripts-build.scm \
247 tests/containers.scm \
248 tests/import-utils.scm
249
250 if HAVE_GUILE_JSON
251
252 SCM_TESTS += \
253 tests/pypi.scm \
254 tests/cpan.scm \
255 tests/gem.scm
256
257 endif
258
259 SH_TESTS = \
260 tests/guix-build.sh \
261 tests/guix-download.sh \
262 tests/guix-gc.sh \
263 tests/guix-hash.sh \
264 tests/guix-package.sh \
265 tests/guix-package-net.sh \
266 tests/guix-system.sh \
267 tests/guix-archive.sh \
268 tests/guix-authenticate.sh \
269 tests/guix-environment.sh \
270 tests/guix-environment-container.sh \
271 tests/guix-graph.sh \
272 tests/guix-lint.sh
273
274 if BUILD_DAEMON
275
276 SH_TESTS += tests/guix-register.sh
277
278 endif BUILD_DAEMON
279
280
281 TESTS = $(SCM_TESTS) $(SH_TESTS)
282
283 AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)"
284
285 SCM_LOG_COMPILER = $(top_builddir)/test-env $(GUILE)
286 AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)"
287
288 SH_LOG_COMPILER = $(top_builddir)/test-env $(SHELL)
289 AM_SH_LOG_FLAGS = -x -e
290
291 # Make sure `tests/guix-gc.sh' runs last, after all the others. Otherwise it
292 # could end up removing files from the store while they are being used by
293 # other instances of the daemon.
294 tests/guix-gc.log: \
295 $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS))) \
296 $(SCM_TESTS:%.scm=%.log)
297
298 else !CAN_RUN_TESTS
299
300 TESTS =
301 SH_TESTS =
302 SCM_TESTS =
303
304 # Automake always generates a 'check' target, so better not override it.
305 check-local:
306 @echo
307 @echo "Cannot run tests because file name limits would be exceeded." >&2
308 @echo "Look for 'length' in the 'config.log' file for details." >&2
309 @echo
310 @exit 1
311
312 endif !CAN_RUN_TESTS
313
314 # Public key used to sign substitutes from hydra.gnu.org.
315 dist_pkgdata_DATA = hydra.gnu.org.pub
316
317 # Bash completion file.
318 dist_bashcompletion_DATA = etc/completion/bash/guix
319
320 EXTRA_DIST = \
321 HACKING \
322 ROADMAP \
323 TODO \
324 CODE-OF-CONDUCT \
325 .dir-locals.el \
326 build-aux/build-self.scm \
327 build-aux/compile-all.scm \
328 build-aux/hydra/gnu-system.scm \
329 build-aux/hydra/demo-os.scm \
330 build-aux/hydra/guix.scm \
331 build-aux/check-available-binaries.scm \
332 build-aux/check-final-inputs-self-contained.scm \
333 build-aux/download.scm \
334 build-aux/make-binary-tarball.scm \
335 build-aux/generate-authors.scm \
336 srfi/srfi-37.scm.in \
337 srfi/srfi-64.scm \
338 srfi/srfi-64.upstream.scm \
339 tests/test.drv \
340 tests/signing-key.pub \
341 tests/signing-key.sec \
342 tests/cve-sample.xml \
343 build-aux/config.rpath \
344 bootstrap \
345 release.nix \
346 $(TESTS)
347
348 if !BUILD_DAEMON_OFFLOAD
349
350 EXTRA_DIST += \
351 guix/scripts/offload.scm
352
353 endif !BUILD_DAEMON_OFFLOAD
354
355 if !BUILD_SYSCALLS_MODULE
356
357 EXTRA_DIST += \
358 guix/build/syscalls.scm
359
360 endif !BUILD_SYSCALLS_MODULE
361
362
363 CLEANFILES = \
364 $(GOBJECTS) \
365 $(SCM_TESTS:tests/%.scm=%.log)
366
367 # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if
368 # $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
369 # there that are newer than the local .scm files (for instance because the
370 # user ran 'make install' recently). When that happens, we end up loading
371 # those previously-installed .go files, which may be stale, thereby breaking
372 # the whole thing.
373 %.go: make-go ; @:
374 make-go: $(MODULES) guix/config.scm guix/tests.scm
375 $(AM_V_at)echo "Compiling Scheme modules..." ; \
376 unset GUILE_LOAD_COMPILED_PATH ; \
377 host=$(host) srcdir="$(top_srcdir)" \
378 $(top_builddir)/pre-inst-env \
379 $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \
380 --no-auto-compile \
381 -s "$(top_srcdir)"/build-aux/compile-all.scm $^
382
383 SUFFIXES = .go
384
385 # Make sure source files are installed first, so that the mtime of
386 # installed compiled files is greater than that of installed source
387 # files. See
388 # <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
389 # for details.
390 guix_install_go_files = install-nobase_nodist_guilemoduleDATA
391 $(guix_install_go_files): install-nobase_dist_guilemoduleDATA
392
393 # The above trick doesn't work for 'config.go' because both 'config.scm' and
394 # 'config.go' are listed in $(nobase_nodist_guilemodule_DATA). Thus, give it
395 # special treatment.
396 install-data-hook: set-bootstrap-executable-permissions
397 touch "$(DESTDIR)$(guilemoduledir)/guix/config.go"
398
399
400 SUBDIRS = po/guix po/packages
401 BUILT_SOURCES =
402
403 include doc.am
404
405 if BUILD_DAEMON
406
407 include daemon.am
408
409 endif BUILD_DAEMON
410
411 ACLOCAL_AMFLAGS = -I m4
412 AM_DISTCHECK_CONFIGURE_FLAGS = \
413 --with-libgcrypt-prefix="$(LIBGCRYPT_PREFIX)" \
414 --with-libgcrypt-libdir="$(LIBGCRYPT_LIBDIR)" \
415 --with-nix-prefix="$(NIX_PREFIX)" \
416 --enable-daemon
417
418 dist_emacsui_DATA = emacs/guix-main.scm
419 nodist_emacsui_DATA = emacs/guix-helper.scm
420 include emacs.am
421
422 # The self-contained tarball.
423 guix-binary.%.tar.xz:
424 $(AM_V_GEN)GUIX_PACKAGE_PATH= \
425 $(top_builddir)/pre-inst-env "$(GUILE)" \
426 "$(top_srcdir)/build-aux/make-binary-tarball.scm" "$*" "$@"
427
428
429 dist-hook: sync-descriptions gen-ChangeLog gen-AUTHORS
430 dist-hook: assert-no-store-file-names
431
432 distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
433
434 sync-descriptions:
435 $(AM_V_at)GUIX_PACKAGE_PATH= \
436 $(top_builddir)/pre-inst-env guix lint --checkers=gnu-description
437
438 gen-ChangeLog:
439 $(AM_V_GEN)if test -d .git; then \
440 $(top_srcdir)/build-aux/gitlog-to-changelog \
441 > $(distdir)/cl-t; \
442 rm -f $(distdir)/ChangeLog; \
443 mv $(distdir)/cl-t $(distdir)/ChangeLog; \
444 fi
445
446 gen-AUTHORS:
447 $(AM_V_GEN)if test -d .git; then \
448 rm -f "$(distdir)/AUTHORS"; \
449 $(top_builddir)/pre-inst-env "$(GUILE)" \
450 "$(top_srcdir)/build-aux/generate-authors.scm" \
451 "$(top_srcdir)" "$(distdir)/AUTHORS"; \
452 fi
453
454 # Make sure we're not shipping a file that embeds a local /gnu/store file name.
455 assert-no-store-file-names:
456 $(AM_V_at)if grep -r --exclude=*.texi --exclude=*.info \
457 "$(storedir)/[a-z0-9]{32}-" $(distdir) ; \
458 then \
459 echo "error: store file names embedded in the distribution" >&2 ; \
460 exit 1 ; \
461 fi
462
463 # Make sure hydra.gnu.org has the important binaries.
464 assert-binaries-available:
465 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
466 "$(top_srcdir)/build-aux/check-available-binaries.scm"
467
468 # Make sure the final inputs don't refer to bootstrap tools.
469 assert-final-inputs-self-contained:
470 $(AM_V_at)$(top_builddir)/pre-inst-env "$(GUILE)" \
471 "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
472
473 .PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go make-go
474 .PHONY: assert-no-store-file-names assert-binaries-available
475 .PHONY: assert-final-inputs-self-contained
476
477 ## -------------- ##
478 ## Silent rules. ##
479 ## -------------- ##
480
481 AM_V_DL = $(AM_V_DL_$(V))
482 AM_V_DL_ = $(AM_V_DL_$(AM_DEFAULT_VERBOSITY))
483 AM_V_DL_0 = @echo " DL " $@;
484
485 AM_V_DOT = $(AM_V_DOT_$(V))
486 AM_V_DOT_ = $(AM_V_DOT_$(AM_DEFAULT_VERBOSITY))
487 AM_V_DOT_0 = @echo " DOT " $@;
488
489 AM_V_EMACS = $(AM_V_EMACS_$(V))
490 AM_V_EMACS_ = $(AM_V_EMACS_$(AM_DEFAULT_VERBOSITY))
491 AM_V_EMACS_0 = @echo " EMACS " $@;
492
493 AM_V_HELP2MAN = $(AM_V_HELP2MAN_$(V))
494 AM_V_HELP2MAN_ = $(AM_V_HELP2MAN_$(AM_DEFAULT_VERBOSITY))
495 AM_V_HELP2MAN_0 = @echo " HELP2MAN" $@;