environment: For --ad-hoc, allow users to specify an output.
[guix.git] / Makefile.am
blobcc0b135de6af93792cf2a74b2bc76c1e883c1156
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
5 # This file is part of GNU Guix.
7 # GNU Guix is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or (at
10 # your option) any later version.
12 # GNU Guix is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
20 bin_SCRIPTS =                                   \
21   scripts/guix
23 nodist_noinst_SCRIPTS =                         \
24   pre-inst-env                                  \
25   test-env
27 include gnu-system.am
29 MODULES =                                       \
30   guix/base32.scm                               \
31   guix/base64.scm                               \
32   guix/cpio.scm                                 \
33   guix/records.scm                              \
34   guix/gcrypt.scm                               \
35   guix/hash.scm                                 \
36   guix/pk-crypto.scm                            \
37   guix/pki.scm                                  \
38   guix/utils.scm                                \
39   guix/sets.scm                                 \
40   guix/download.scm                             \
41   guix/git-download.scm                         \
42   guix/monads.scm                               \
43   guix/monad-repl.scm                           \
44   guix/gexp.scm                                 \
45   guix/profiles.scm                             \
46   guix/serialization.scm                        \
47   guix/nar.scm                                  \
48   guix/derivations.scm                          \
49   guix/gnu-maintenance.scm                      \
50   guix/licenses.scm                             \
51   guix/build-system.scm                         \
52   guix/build-system/cmake.scm                   \
53   guix/build-system/glib-or-gtk.scm             \
54   guix/build-system/gnu.scm                     \
55   guix/build-system/haskell.scm                 \
56   guix/build-system/perl.scm                    \
57   guix/build-system/python.scm                  \
58   guix/build-system/waf.scm                     \
59   guix/build-system/ruby.scm                    \
60   guix/build-system/trivial.scm                 \
61   guix/ftp-client.scm                           \
62   guix/http-client.scm                          \
63   guix/gnupg.scm                                \
64   guix/elf.scm                                  \
65   guix/store.scm                                \
66   guix/cvs-download.scm                         \
67   guix/svn-download.scm                         \
68   guix/ui.scm                                   \
69   guix/build/download.scm                       \
70   guix/build/cmake-build-system.scm             \
71   guix/build/git.scm                            \
72   guix/build/glib-or-gtk-build-system.scm       \
73   guix/build/gnu-build-system.scm               \
74   guix/build/gnu-dist.scm                       \
75   guix/build/perl-build-system.scm              \
76   guix/build/python-build-system.scm            \
77   guix/build/ruby-build-system.scm              \
78   guix/build/waf-build-system.scm               \
79   guix/build/haskell-build-system.scm           \
80   guix/build/store-copy.scm                     \
81   guix/build/utils.scm                          \
82   guix/build/union.scm                          \
83   guix/build/profiles.scm                       \
84   guix/build/pull.scm                           \
85   guix/build/rpath.scm                          \
86   guix/build/cvs.scm                            \
87   guix/build/svn.scm                            \
88   guix/build/syscalls.scm                       \
89   guix/build/gremlin.scm                        \
90   guix/build/emacs-utils.scm                    \
91   guix/build/graft.scm                          \
92   guix/search-paths.scm                         \
93   guix/packages.scm                             \
94   guix/import/utils.scm                         \
95   guix/import/gnu.scm                           \
96   guix/import/snix.scm                          \
97   guix/import/cabal.scm                         \
98   guix/import/hackage.scm                       \
99   guix/scripts/download.scm                     \
100   guix/scripts/build.scm                        \
101   guix/scripts/archive.scm                      \
102   guix/scripts/import.scm                       \
103   guix/scripts/package.scm                      \
104   guix/scripts/gc.scm                           \
105   guix/scripts/hash.scm                         \
106   guix/scripts/pull.scm                         \
107   guix/scripts/substitute.scm                   \
108   guix/scripts/authenticate.scm                 \
109   guix/scripts/refresh.scm                      \
110   guix/scripts/system.scm                       \
111   guix/scripts/lint.scm                         \
112   guix/scripts/import/gnu.scm                   \
113   guix/scripts/import/nix.scm                   \
114   guix/scripts/import/hackage.scm               \
115   guix/scripts/environment.scm                  \
116   guix/scripts/publish.scm                      \
117   guix/scripts/edit.scm                         \
118   guix/scripts/size.scm                         \
119   guix.scm                                      \
120   $(GNU_SYSTEM_MODULES)
122 if BUILD_DAEMON_OFFLOAD
124 MODULES +=                                      \
125   guix/scripts/offload.scm
127 endif BUILD_DAEMON_OFFLOAD
129 # Internal module with test suite support.
130 dist_noinst_DATA = guix/tests.scm
132 # Because of the autoload hack in (guix build download), we must build it
133 # first to avoid errors on systems where (gnutls) is unavailable.
134 guix/scripts/download.go: guix/build/download.go
135 guix/download.go: guix/build/download.go
137 # Linux-Libre configurations.
138 KCONFIGS =                                      \
139   gnu/packages/linux-libre-i686.conf            \
140   gnu/packages/linux-libre-x86_64.conf
142 # Templates, examples.
143 EXAMPLES =                                      \
144   gnu/system/examples/bare-bones.tmpl           \
145   gnu/system/examples/desktop.tmpl
147 GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go guix/tests.go
149 nobase_dist_guilemodule_DATA =                  \
150   $(MODULES) $(KCONFIGS) $(EXAMPLES)            \
151   $(MISC_DISTRO_FILES)
152 nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm
154 # Do we need to provide our own non-broken (srfi srfi-37) module?
155 if INSTALL_SRFI_37
157 nobase_nodist_guilemodule_DATA += srfi/srfi-37.scm
158 GOBJECTS += srfi/srfi-37.go
160 srfi/srfi-37.scm: srfi/srfi-37.scm.in
161         $(MKDIR_P) srfi
162         cp "$<" "$@"
164 endif INSTALL_SRFI_37
166 # Handy way to remove the .go files without removing all the rest.
167 clean-go:
168         -$(RM) -f $(GOBJECTS)
171 SCM_TESTS =                                     \
172   tests/base32.scm                              \
173   tests/base64.scm                              \
174   tests/cpio.scm                                \
175   tests/hash.scm                                \
176   tests/pk-crypto.scm                           \
177   tests/pki.scm                                 \
178   tests/sets.scm                                \
179   tests/substitute.scm                          \
180   tests/builders.scm                            \
181   tests/derivations.scm                         \
182   tests/ui.scm                                  \
183   tests/records.scm                             \
184   tests/utils.scm                               \
185   tests/build-utils.scm                         \
186   tests/packages.scm                            \
187   tests/snix.scm                                \
188   tests/hackage.scm                             \
189   tests/store.scm                               \
190   tests/monads.scm                              \
191   tests/gexp.scm                                \
192   tests/nar.scm                                 \
193   tests/union.scm                               \
194   tests/profiles.scm                            \
195   tests/syscalls.scm                            \
196   tests/gremlin.scm                             \
197   tests/lint.scm                                \
198   tests/publish.scm                             \
199   tests/size.scm
201 if HAVE_GUILE_JSON
203 MODULES +=                                      \
204   guix/import/json.scm                          \
205   guix/import/pypi.scm                          \
206   guix/scripts/import/pypi.scm                  \
207   guix/import/cpan.scm                          \
208   guix/scripts/import/cpan.scm
210 SCM_TESTS +=                                    \
211   tests/pypi.scm                                \
212   tests/cpan.scm
214 endif
216 SH_TESTS =                                      \
217   tests/guix-build.sh                           \
218   tests/guix-download.sh                        \
219   tests/guix-gc.sh                              \
220   tests/guix-hash.sh                            \
221   tests/guix-package.sh                         \
222   tests/guix-package-net.sh                     \
223   tests/guix-system.sh                          \
224   tests/guix-archive.sh                         \
225   tests/guix-authenticate.sh                    \
226   tests/guix-environment.sh                     \
227   tests/guix-lint.sh
229 if BUILD_DAEMON
231 SH_TESTS += tests/guix-register.sh
233 endif BUILD_DAEMON
236 TESTS = $(SCM_TESTS) $(SH_TESTS)
238 TEST_EXTENSIONS = .scm .sh
240 AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)"
242 SCM_LOG_COMPILER = $(top_builddir)/test-env $(GUILE)
243 AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)"
245 SH_LOG_COMPILER = $(top_builddir)/test-env $(SHELL)
246 AM_SH_LOG_FLAGS = -x -e
248 # Make sure `tests/guix-gc.sh' runs last, after all the others.  Otherwise it
249 # could end up removing files from the store while they are being used by
250 # other instances of the daemon.
251 tests/guix-gc.log:                                                      \
252   $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS)))     \
253   $(SCM_TESTS:%.scm=%.log)
255 # Public key used to sign substitutes from hydra.gnu.org.
256 dist_pkgdata_DATA = hydra.gnu.org.pub
258 # Bash completion file.
259 dist_bashcompletion_DATA = etc/completion/bash/guix
261 EXTRA_DIST =                                            \
262   HACKING                                               \
263   ROADMAP                                               \
264   TODO                                                  \
265   .dir-locals.el                                        \
266   build-aux/build-self.scm                              \
267   build-aux/hydra/gnu-system.scm                        \
268   build-aux/hydra/demo-os.scm                           \
269   build-aux/hydra/guix.scm                              \
270   build-aux/check-available-binaries.scm                \
271   build-aux/check-final-inputs-self-contained.scm       \
272   build-aux/download.scm                                \
273   build-aux/make-binary-tarball.scm                     \
274   srfi/srfi-37.scm.in                                   \
275   srfi/srfi-64.scm                                      \
276   srfi/srfi-64.upstream.scm                             \
277   tests/test.drv                                        \
278   tests/signing-key.pub                                 \
279   tests/signing-key.sec                                 \
280   build-aux/config.rpath                                \
281   bootstrap                                             \
282   release.nix                                           \
283   $(TESTS)
285 if !BUILD_DAEMON_OFFLOAD
287 EXTRA_DIST +=                                   \
288   guix/scripts/offload.scm
290 endif !BUILD_DAEMON_OFFLOAD
293 CLEANFILES =                                    \
294   $(GOBJECTS)                                   \
295   $(SCM_TESTS:tests/%.scm=%.log)
297 AM_V_GUILEC = $(AM_V_GUILEC_$(V))
298 AM_V_GUILEC_ = $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY))
299 AM_V_GUILEC_0 = @echo "  GUILEC" $@;
301 # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling.  Otherwise, if
302 # $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files in
303 # there that are newer than the local .scm files (for instance because the
304 # user ran 'make install' recently).  When that happens, we end up loading
305 # those previously-installed .go files, which may be stale, thereby breaking
306 # the whole thing.
308 # XXX: Use the C locale for when Guile lacks
309 # <http://git.sv.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=e2c6bf3866d1186c60bacfbd4fe5037087ee5e3f>.
310 .scm.go:
311         $(AM_V_GUILEC)$(MKDIR_P) `dirname "$@"` ;                       \
312         unset GUILE_LOAD_COMPILED_PATH ;                                \
313         LC_ALL=C                                                        \
314         $(top_builddir)/pre-inst-env                                    \
315         $(GUILD) compile -L "$(top_builddir)" -L "$(top_srcdir)"        \
316           -Wformat -Wunbound-variable -Warity-mismatch                  \
317           --target="$(host)"                                            \
318           -o "$@" "$<"
320 SUFFIXES = .go
322 # Make sure source files are installed first, so that the mtime of
323 # installed compiled files is greater than that of installed source
324 # files.  See
325 # <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
326 # for details.
327 guix_install_go_files = install-nobase_nodist_guilemoduleDATA
328 $(guix_install_go_files): install-nobase_dist_guilemoduleDATA
330 # The above trick doesn't work for 'config.go' because both 'config.scm' and
331 # 'config.go' are listed in $(nobase_nodist_guilemodule_DATA).  Thus, give it
332 # special treatment.
333 install-data-hook: set-bootstrap-executable-permissions
334         touch "$(DESTDIR)$(guilemoduledir)/guix/config.go"
337 SUBDIRS = po/guix po/packages
338 BUILT_SOURCES =
340 include doc.am
342 if BUILD_DAEMON
344 include daemon.am
346 endif BUILD_DAEMON
348 ACLOCAL_AMFLAGS = -I m4
349 AM_DISTCHECK_CONFIGURE_FLAGS =                  \
350   --with-libgcrypt-prefix="$(LIBGCRYPT_PREFIX)" \
351   --with-libgcrypt-libdir="$(LIBGCRYPT_LIBDIR)" \
352   --with-nix-prefix="$(NIX_PREFIX)"             \
353   --enable-daemon
355 dist_emacsui_DATA = emacs/guix-main.scm
356 nodist_emacsui_DATA = emacs/guix-helper.scm
357 include emacs.am
359 # The self-contained tarball.
360 guix-binary.%.tar.xz:
361         -GUIX_PACKAGE_PATH= \
362         $(top_builddir)/pre-inst-env "$(GUILE)"                 \
363           "$(top_srcdir)/build-aux/make-binary-tarball.scm" "$*" "$@"
366 dist-hook: sync-descriptions gen-ChangeLog assert-no-store-file-names
367 distcheck-hook: assert-binaries-available assert-final-inputs-self-contained
369 sync-descriptions:
370         -GUIX_PACKAGE_PATH= \
371          $(top_builddir)/pre-inst-env guix lint --checkers=gnu-description
373 gen-ChangeLog:
374         if test -d .git; then                           \
375           $(top_srcdir)/build-aux/gitlog-to-changelog   \
376             > $(distdir)/cl-t;                          \
377           rm -f $(distdir)/ChangeLog;                   \
378           mv $(distdir)/cl-t $(distdir)/ChangeLog;      \
379         fi
381 # Make sure we're not shipping a file that embeds a local /gnu/store file name.
382 assert-no-store-file-names:
383         if grep -r --exclude=*.texi --exclude=*.info                            \
384              "$(storedir)/[a-z0-9]{32}-" $(distdir) ;                           \
385         then                                                                    \
386           echo "error: store file names embedded in the distribution" >&2 ;     \
387           exit 1 ;                                                              \
388         fi
390 # Make sure hydra.gnu.org has the important binaries.
391 assert-binaries-available:
392         $(top_builddir)/pre-inst-env "$(GUILE)"                         \
393           "$(top_srcdir)/build-aux/check-available-binaries.scm"
395 # Make sure the final inputs don't refer to bootstrap tools.
396 assert-final-inputs-self-contained:
397         $(top_builddir)/pre-inst-env "$(GUILE)"                         \
398           "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
400 .PHONY: sync-descriptions gen-ChangeLog clean-go
401 .PHONY: assert-no-store-file-names assert-binaries-available
402 .PHONY: assert-final-inputs-self-contained