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