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