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