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