Make SetupToolsLogging use tools logfile
[ganeti-github.git] / Makefile.am
1 # Ganeti makefile
2 # - Indent with tabs only.
3 # - Keep files sorted; one line per file.
4 # - Directories in lib/ must have their own *dir variable (see hypervisor).
5 # - All directories must be listed DIRS.
6 # - Use autogen.sh to generate Makefile.in and configure script.
7
8 # For distcheck we need the haskell tests to be enabled. Note:
9 # The "correct" way would be to define AM_DISTCHECK_CONFIGURE_FLAGS.
10 # However, we still have to support older versions of autotools,
11 # so we cannot use that yet, hence we fall back to..
12 DISTCHECK_CONFIGURE_FLAGS = --enable-haskell-tests
13
14 # Automake doesn't export these variables before version 1.10.
15 abs_top_builddir = @abs_top_builddir@
16 abs_top_srcdir = @abs_top_srcdir@
17
18 # Helper values for calling builtin functions
19 empty :=
20 space := $(empty) $(empty)
21 comma := ,
22
23 # Helper function to strip src/ and test/hs/ from a list
24 strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))
25
26 # Use bash in order to be able to use pipefail
27 SHELL=/bin/bash
28
29 EXTRA_DIST=
30
31 # Enable colors in shelltest
32 SHELLTESTARGS = "-c"
33
34 ACLOCAL_AMFLAGS = -I autotools
35 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
36 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
37 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
38 CHECK_HEADER = $(top_srcdir)/autotools/check-header
39 CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
40 CHECK_MAN_REFERENCES = $(top_srcdir)/autotools/check-man-references
41 CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
42 CHECK_VERSION = $(top_srcdir)/autotools/check-version
43 CHECK_NEWS = $(top_srcdir)/autotools/check-news
44 CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
45 DOCPP = $(top_srcdir)/autotools/docpp
46 REPLACE_VARS_SED = autotools/replace_vars.sed
47 PRINT_PY_CONSTANTS = $(top_srcdir)/autotools/print-py-constants
48 BUILD_RPC = $(top_srcdir)/autotools/build-rpc
49 SHELL_ENV_INIT = autotools/shell-env-init
50
51 # starting as of Ganeti 2.10, all files are stored in two directories,
52 # with only symbolic links added at other places.
53 #
54 # $(versiondir) contains most of Ganeti and all architecture-dependent files
55 # $(versionedsharedir) contains only architecture-independent files; all python
56 # executables need to go directly to $(versionedsharedir), as all ganeti python
57 # mdules are installed outside the usual python path, i.e., as private modules.
58 #
59 # $(defaultversiondir) and $(defaultversionedsharedir) are the corresponding
60 # directories for "the currently running" version of Ganeti. We never install
61 # there, but all symbolic links go there, rather than directory to $(versiondir)
62 # or $(versionedsharedir). Note that all links to $(default*dir) need to be stable;
63 # so, if some currently architecture-independent executable is replaced by an
64 # architecture-dependent one (and hence has to go under $(versiondir)), add a link
65 # under $(versionedsharedir) but do not change the external links.
66 if USE_VERSION_FULL
67 DIRVERSION=$(VERSION_FULL)
68 else
69 DIRVERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
70 endif
71 versiondir = $(libdir)/ganeti/$(DIRVERSION)
72 defaultversiondir = $(libdir)/ganeti/default
73 versionedsharedir = $(prefix)/share/ganeti/$(DIRVERSION)
74 defaultversionedsharedir = $(prefix)/share/ganeti/default
75
76 # Note: these are automake-specific variables, and must be named after
77 # the directory + 'dir' suffix
78 pkglibdir = $(versiondir)$(libdir)/ganeti
79 myexeclibdir = $(pkglibdir)
80 bindir = $(versiondir)/$(BINDIR)
81 sbindir = $(versiondir)$(SBINDIR)
82 mandir = $(versionedsharedir)/root$(MANDIR)
83 pkgpythondir = $(versionedsharedir)/ganeti
84 pkgpython_rpc_stubdir = $(versionedsharedir)/ganeti/rpc/stub
85 gntpythondir = $(versionedsharedir)
86 pkgpython_bindir = $(versionedsharedir)
87 gnt_python_sbindir = $(versionedsharedir)
88 tools_pythondir = $(versionedsharedir)
89
90 clientdir = $(pkgpythondir)/client
91 cmdlibdir = $(pkgpythondir)/cmdlib
92 cmdlib_clusterdir = $(pkgpythondir)/cmdlib/cluster
93 configdir = $(pkgpythondir)/config
94 hypervisordir = $(pkgpythondir)/hypervisor
95 hypervisor_hv_kvmdir = $(pkgpythondir)/hypervisor/hv_kvm
96 jqueuedir = $(pkgpythondir)/jqueue
97 storagedir = $(pkgpythondir)/storage
98 httpdir = $(pkgpythondir)/http
99 masterddir = $(pkgpythondir)/masterd
100 confddir = $(pkgpythondir)/confd
101 rapidir = $(pkgpythondir)/rapi
102 rpcdir = $(pkgpythondir)/rpc
103 rpc_stubdir = $(pkgpythondir)/rpc/stub
104 serverdir = $(pkgpythondir)/server
105 watcherdir = $(pkgpythondir)/watcher
106 impexpddir = $(pkgpythondir)/impexpd
107 utilsdir = $(pkgpythondir)/utils
108 toolsdir = $(pkglibdir)/tools
109 iallocatorsdir = $(pkglibdir)/iallocators
110 pytoolsdir = $(pkgpythondir)/tools
111 docdir = $(versiondir)$(datadir)/doc/$(PACKAGE)
112 ifupdir = $(sysconfdir)/ganeti
113
114 if USE_BACKUP_DIR
115 backup_dir = $(BACKUP_DIR)
116 else
117 backup_dir = $(localstatedir)/lib
118 endif
119
120 SYMLINK_TARGET_DIRS = \
121         $(sysconfdir)/ganeti \
122         $(libdir)/ganeti/iallocators \
123         $(libdir)/ganeti/tools \
124         $(prefix)/share/ganeti \
125         $(BINDIR) \
126         $(SBINDIR) \
127         $(MANDIR)/man1 \
128         $(MANDIR)/man7 \
129         $(MANDIR)/man8
130
131 # Delete output file if an error occurred while building it
132 .DELETE_ON_ERROR:
133
134 HS_DIRS = \
135         src \
136         src/Ganeti \
137         src/Ganeti/Confd \
138         src/Ganeti/Curl \
139         src/Ganeti/Cpu \
140         src/Ganeti/DataCollectors \
141         src/Ganeti/Daemon \
142         src/Ganeti/Hs2Py \
143         src/Ganeti/HTools \
144         src/Ganeti/HTools/Backend \
145         src/Ganeti/HTools/Cluster \
146         src/Ganeti/HTools/Program \
147         src/Ganeti/HTools/Tags \
148         src/Ganeti/Hypervisor \
149         src/Ganeti/Hypervisor/Xen \
150         src/Ganeti/JQScheduler \
151         src/Ganeti/JQueue \
152         src/Ganeti/Locking \
153         src/Ganeti/Logging \
154         src/Ganeti/MaintD \
155         src/Ganeti/Monitoring \
156         src/Ganeti/Metad \
157         src/Ganeti/Objects \
158         src/Ganeti/OpCodes \
159         src/Ganeti/Query \
160         src/Ganeti/Storage \
161         src/Ganeti/Storage/Diskstats \
162         src/Ganeti/Storage/Drbd \
163         src/Ganeti/Storage/Lvm \
164         src/Ganeti/THH \
165         src/Ganeti/Utils \
166         src/Ganeti/WConfd \
167         test/hs \
168         test/hs/Test \
169         test/hs/Test/Ganeti \
170         test/hs/Test/Ganeti/Storage \
171         test/hs/Test/Ganeti/Storage/Diskstats \
172         test/hs/Test/Ganeti/Storage/Drbd \
173         test/hs/Test/Ganeti/Storage/Lvm \
174         test/hs/Test/Ganeti/Confd \
175         test/hs/Test/Ganeti/HTools \
176         test/hs/Test/Ganeti/HTools/Backend \
177         test/hs/Test/Ganeti/Hypervisor \
178         test/hs/Test/Ganeti/Hypervisor/Xen \
179         test/hs/Test/Ganeti/JQueue \
180         test/hs/Test/Ganeti/Locking \
181         test/hs/Test/Ganeti/Objects \
182         test/hs/Test/Ganeti/Query \
183         test/hs/Test/Ganeti/THH \
184         test/hs/Test/Ganeti/Utils \
185         test/hs/Test/Ganeti/WConfd
186
187 # Haskell directories without the roots (src, test/hs)
188 HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))
189
190 DIRS = \
191         $(HS_DIRS) \
192         autotools \
193         cabal \
194         daemons \
195         devel \
196         devel/data \
197         doc \
198         doc/css \
199         doc/examples \
200         doc/examples/gnt-debug \
201         doc/examples/hooks \
202         doc/examples/systemd \
203         doc/users \
204         test/data/htools \
205         test/data/htools/rapi \
206         test/hs/shelltests \
207         test/autotools \
208         lib \
209         lib/build \
210         lib/client \
211         lib/cmdlib \
212         lib/cmdlib/cluster \
213         lib/confd \
214         lib/config \
215         lib/jqueue \
216         lib/http \
217         lib/hypervisor \
218         lib/hypervisor/hv_kvm \
219         lib/impexpd \
220         lib/masterd \
221         lib/rapi \
222         lib/rpc \
223         lib/rpc/stub \
224         lib/server \
225         lib/storage \
226         lib/tools \
227         lib/utils \
228         lib/watcher \
229         man \
230         qa \
231         qa/patch \
232         test \
233         test/data \
234         test/data/bdev-rbd \
235         test/data/ovfdata \
236         test/data/ovfdata/other \
237         test/data/cgroup_root \
238         test/data/cgroup_root/memory \
239         test/data/cgroup_root/memory/lxc \
240         test/data/cgroup_root/memory/lxc/instance1 \
241         test/data/cgroup_root/cpuset \
242         test/data/cgroup_root/cpuset/some_group \
243         test/data/cgroup_root/cpuset/some_group/lxc \
244         test/data/cgroup_root/cpuset/some_group/lxc/instance1 \
245         test/data/cgroup_root/devices \
246         test/data/cgroup_root/devices/some_group \
247         test/data/cgroup_root/devices/some_group/lxc \
248         test/data/cgroup_root/devices/some_group/lxc/instance1 \
249         test/py \
250         test/py/testutils \
251         test/py/cmdlib \
252         test/py/cmdlib/testsupport \
253         tools
254
255 ALL_APIDOC_HS_DIRS = \
256         $(APIDOC_HS_DIR) \
257         $(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
258
259 BUILDTIME_DIR_AUTOCREATE = \
260         scripts \
261         $(APIDOC_DIR) \
262         $(ALL_APIDOC_HS_DIRS) \
263         $(APIDOC_PY_DIR) \
264         $(COVERAGE_DIR) \
265         $(COVERAGE_HS_DIR) \
266         $(COVERAGE_PY_DIR) \
267         .hpc
268
269 BUILDTIME_DIRS = \
270         $(BUILDTIME_DIR_AUTOCREATE) \
271         apps \
272         dist \
273         doc/html \
274         doc/man-html
275
276 DIRCHECK_EXCLUDE = \
277         $(BUILDTIME_DIRS) \
278         ganeti-[0-9]*.[0-9]*.[0-9]* \
279         doc/html/_* \
280         doc/man-html/_* \
281         tools/shebang \
282         autom4te.cache
283
284 # some helper vars
285 COVERAGE_DIR = doc/coverage
286 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
287 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
288 APIDOC_DIR = doc/api
289 APIDOC_PY_DIR = $(APIDOC_DIR)/py
290 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
291
292 MAINTAINERCLEANFILES = \
293         $(maninput) \
294         doc/install-quick.rst \
295         doc/news.rst \
296         doc/upgrade.rst \
297         vcs-version
298
299 maintainer-clean-local:
300         rm -rf $(BUILDTIME_DIRS)
301
302 CLEANFILES = \
303         $(addsuffix /*.py[co],$(DIRS)) \
304         $(addsuffix /*.hi,$(HS_DIRS)) \
305         $(addsuffix /*.o,$(HS_DIRS)) \
306         $(addsuffix /*.dyn_hi,$(HS_DIRS)) \
307         $(addsuffix /*.dyn_o,$(HS_DIRS)) \
308         $(addsuffix /*.$(HTEST_SUFFIX)_hi,$(HS_DIRS)) \
309         $(addsuffix /*.$(HTEST_SUFFIX)_o,$(HS_DIRS)) \
310         $(HASKELL_PACKAGE_VERSIONS_FILE) \
311         $(CABAL_EXECUTABLES_APPS_STAMPS) \
312         empty-cabal-config \
313         ganeti.cabal \
314         $(HASKELL_PACKAGE_IDS_FILE) \
315         $(HASKELL_PACKAGE_VERSIONS_FILE) \
316         Makefile.ghc \
317         Makefile.ghc.bak \
318         $(PYTHON_BOOTSTRAP) \
319         $(gnt_python_sbin_SCRIPTS) \
320         epydoc.conf \
321         $(REPLACE_VARS_SED) \
322         $(SHELL_ENV_INIT) \
323         daemons/daemon-util \
324         daemons/ganeti-cleaner \
325         devel/squeeze-amd64.tar.gz \
326         devel/squeeze-amd64.conf \
327         $(mandocrst) \
328         doc/manpages-enabled.rst \
329         $(BUILT_EXAMPLES) \
330         doc/examples/bash_completion \
331         doc/examples/bash_completion-debug \
332         $(userspecs) \
333         lib/_generated_rpc.py \
334         $(man_MANS) \
335         $(manhtml) \
336         tools/kvm-ifup \
337         tools/kvm-ifup-os \
338         tools/xen-ifup-os \
339         tools/vif-ganeti \
340         tools/vif-ganeti-metad \
341         tools/net-common \
342         tools/users-setup \
343         tools/ssl-update \
344         tools/vcluster-setup \
345         tools/prepare-node-join \
346         tools/ssh-update \
347         $(python_scripts_shebang) \
348         stamp-directories \
349         stamp-srclinks \
350         $(nodist_pkgpython_PYTHON) \
351         $(nodist_pkgpython_rpc_stub_PYTHON) \
352         $(gnt_scripts) \
353         $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
354         $(HS_BUILT_TEST_HELPERS) \
355         src/ganeti-confd \
356         src/ganeti-wconfd \
357         src/ganeti-luxid \
358         src/ganeti-maintd \
359         src/ganeti-metad \
360         src/ganeti-mond \
361         .hpc/*.mix src/*.tix test/hs/*.tix *.tix \
362         doc/hs-lint.html
363
364 GENERATED_FILES = \
365         $(built_base_sources) \
366         $(built_python_sources) \
367         $(PYTHON_BOOTSTRAP) \
368         $(gnt_python_sbin_SCRIPTS)
369
370 clean-local:
371         rm -rf tools/shebang
372         rm -rf apps
373         rm -rf dist
374
375 HS_GENERATED_FILES = $(HS_PROGS) src/hluxid src/ganeti-luxid \
376         src/hconfd src/ganeti-confd
377 if ENABLE_MOND
378 HS_GENERATED_FILES += src/ganeti-mond src/ganeti-maintd
379 endif
380 if ENABLE_METADATA
381 HS_GENERATED_FILES += src/ganeti-metad
382 endif
383
384 built_base_sources = \
385         stamp-directories \
386         stamp-srclinks
387
388 built_python_base_sources = \
389         lib/_constants.py \
390         lib/_vcsversion.py \
391         lib/opcodes.py \
392         lib/rpc/stub/wconfd.py
393
394 if ENABLE_METADATA
395 built_python_base_sources += lib/rpc/stub/metad.py
396 endif
397
398 built_python_sources = \
399         $(nodist_pkgpython_PYTHON) \
400         $(nodist_pkgpython_rpc_stub_PYTHON)
401
402 # these are all built from the underlying %.in sources
403 BUILT_EXAMPLES = \
404         doc/examples/ganeti-kvm-poweroff.initd \
405         doc/examples/ganeti.cron \
406         doc/examples/ganeti.initd \
407         doc/examples/ganeti.logrotate \
408         doc/examples/ganeti-master-role.ocf \
409         doc/examples/ganeti-node-role.ocf \
410         doc/examples/gnt-config-backup \
411         doc/examples/hooks/ipsec \
412         doc/examples/systemd/ganeti-common.service \
413         doc/examples/systemd/ganeti-confd.service \
414         doc/examples/systemd/ganeti-kvmd.service \
415         doc/examples/systemd/ganeti-luxid.service \
416         doc/examples/systemd/ganeti-metad.service \
417         doc/examples/systemd/ganeti-maintd.service \
418         doc/examples/systemd/ganeti-mond.service \
419         doc/examples/systemd/ganeti-noded.service \
420         doc/examples/systemd/ganeti-rapi.service \
421         doc/examples/systemd/ganeti-wconfd.service
422
423 nodist_ifup_SCRIPTS = \
424         tools/kvm-ifup-os \
425         tools/xen-ifup-os
426
427 nodist_pkgpython_PYTHON = \
428         $(built_python_base_sources) \
429         lib/_generated_rpc.py
430
431 nodist_pkgpython_rpc_stub_PYTHON = \
432         lib/rpc/stub/wconfd.py
433
434 if ENABLE_METADATA
435 nodist_pkgpython_rpc_stub_PYTHON += lib/rpc/stub/metad.py
436 endif
437
438 nodist_pkgpython_bin_SCRIPTS = \
439         $(nodist_pkglib_python_scripts)
440
441 pkgpython_bin_SCRIPTS = \
442         $(pkglib_python_scripts)
443
444 noinst_PYTHON = \
445         lib/build/__init__.py \
446         lib/build/shell_example_lexer.py \
447         lib/build/sphinx_ext.py
448
449 pkgpython_PYTHON = \
450         lib/__init__.py \
451         lib/asyncnotifier.py \
452         lib/backend.py \
453         lib/bootstrap.py \
454         lib/cli.py \
455         lib/cli_opts.py \
456         lib/compat.py \
457         lib/constants.py \
458         lib/daemon.py \
459         lib/errors.py \
460         lib/hooksmaster.py \
461         lib/ht.py \
462         lib/jstore.py \
463         lib/locking.py \
464         lib/luxi.py \
465         lib/mcpu.py \
466         lib/metad.py \
467         lib/netutils.py \
468         lib/objects.py \
469         lib/opcodes_base.py \
470         lib/outils.py \
471         lib/ovf.py \
472         lib/pathutils.py \
473         lib/qlang.py \
474         lib/query.py \
475         lib/rpc_defs.py \
476         lib/runtime.py \
477         lib/serializer.py \
478         lib/ssconf.py \
479         lib/ssh.py \
480         lib/uidpool.py \
481         lib/vcluster.py \
482         lib/network.py \
483         lib/wconfd.py \
484         lib/workerpool.py
485
486 client_PYTHON = \
487         lib/client/__init__.py \
488         lib/client/base.py \
489         lib/client/gnt_backup.py \
490         lib/client/gnt_cluster.py \
491         lib/client/gnt_debug.py \
492         lib/client/gnt_group.py \
493         lib/client/gnt_instance.py \
494         lib/client/gnt_job.py \
495         lib/client/gnt_node.py \
496         lib/client/gnt_network.py \
497         lib/client/gnt_os.py \
498         lib/client/gnt_storage.py \
499         lib/client/gnt_filter.py
500
501 cmdlib_PYTHON = \
502         lib/cmdlib/__init__.py \
503         lib/cmdlib/backup.py \
504         lib/cmdlib/base.py \
505         lib/cmdlib/common.py \
506         lib/cmdlib/group.py \
507         lib/cmdlib/instance.py \
508         lib/cmdlib/instance_create.py \
509         lib/cmdlib/instance_helpervm.py \
510         lib/cmdlib/instance_migration.py \
511         lib/cmdlib/instance_operation.py \
512         lib/cmdlib/instance_query.py \
513         lib/cmdlib/instance_set_params.py \
514         lib/cmdlib/instance_storage.py \
515         lib/cmdlib/instance_utils.py \
516         lib/cmdlib/misc.py \
517         lib/cmdlib/network.py \
518         lib/cmdlib/node.py \
519         lib/cmdlib/operating_system.py \
520         lib/cmdlib/query.py \
521         lib/cmdlib/tags.py \
522         lib/cmdlib/test.py
523
524 cmdlib_cluster_PYTHON = \
525         lib/cmdlib/cluster/__init__.py \
526         lib/cmdlib/cluster/verify.py
527
528 config_PYTHON = \
529         lib/config/__init__.py \
530         lib/config/verify.py \
531         lib/config/temporary_reservations.py \
532         lib/config/utils.py
533
534 hypervisor_PYTHON = \
535         lib/hypervisor/__init__.py \
536         lib/hypervisor/hv_base.py \
537         lib/hypervisor/hv_chroot.py \
538         lib/hypervisor/hv_fake.py \
539         lib/hypervisor/hv_lxc.py \
540         lib/hypervisor/hv_xen.py
541
542 hypervisor_hv_kvm_PYTHON = \
543   lib/hypervisor/hv_kvm/__init__.py \
544   lib/hypervisor/hv_kvm/monitor.py \
545   lib/hypervisor/hv_kvm/netdev.py
546
547 jqueue_PYTHON = \
548         lib/jqueue/__init__.py \
549         lib/jqueue/exec.py
550
551 storage_PYTHON = \
552         lib/storage/__init__.py \
553         lib/storage/bdev.py \
554         lib/storage/base.py \
555         lib/storage/container.py \
556         lib/storage/drbd.py \
557         lib/storage/drbd_info.py \
558         lib/storage/drbd_cmdgen.py \
559         lib/storage/extstorage.py \
560         lib/storage/filestorage.py \
561         lib/storage/gluster.py
562
563 rapi_PYTHON = \
564         lib/rapi/__init__.py \
565         lib/rapi/baserlib.py \
566         lib/rapi/client.py \
567         lib/rapi/client_utils.py \
568         lib/rapi/connector.py \
569         lib/rapi/rlib2.py \
570         lib/rapi/testutils.py
571
572 http_PYTHON = \
573         lib/http/__init__.py \
574         lib/http/auth.py \
575         lib/http/client.py \
576         lib/http/server.py
577
578 confd_PYTHON = \
579         lib/confd/__init__.py \
580         lib/confd/client.py
581
582 masterd_PYTHON = \
583         lib/masterd/__init__.py \
584         lib/masterd/iallocator.py \
585         lib/masterd/instance.py
586
587 impexpd_PYTHON = \
588         lib/impexpd/__init__.py
589
590 watcher_PYTHON = \
591         lib/watcher/__init__.py \
592         lib/watcher/nodemaint.py \
593         lib/watcher/state.py
594
595 server_PYTHON = \
596         lib/server/__init__.py \
597         lib/server/masterd.py \
598         lib/server/noded.py \
599         lib/server/rapi.py
600
601 rpc_PYTHON = \
602         lib/rpc/__init__.py \
603         lib/rpc/client.py \
604         lib/rpc/errors.py \
605         lib/rpc/node.py \
606         lib/rpc/transport.py
607
608 rpc_stub_PYTHON = \
609         lib/rpc/stub/__init__.py
610
611 pytools_PYTHON = \
612         lib/tools/__init__.py \
613         lib/tools/burnin.py \
614         lib/tools/common.py \
615         lib/tools/ensure_dirs.py \
616         lib/tools/node_cleanup.py \
617         lib/tools/node_daemon_setup.py \
618         lib/tools/prepare_node_join.py \
619         lib/tools/ssh_update.py \
620         lib/tools/ssl_update.py \
621         lib/tools/cfgupgrade.py
622
623 utils_PYTHON = \
624         lib/utils/__init__.py \
625         lib/utils/algo.py \
626         lib/utils/filelock.py \
627         lib/utils/hash.py \
628         lib/utils/io.py \
629         lib/utils/livelock.py \
630         lib/utils/log.py \
631         lib/utils/lvm.py \
632         lib/utils/mlock.py \
633         lib/utils/nodesetup.py \
634         lib/utils/process.py \
635         lib/utils/retry.py \
636         lib/utils/security.py \
637         lib/utils/storage.py \
638         lib/utils/text.py \
639         lib/utils/tags.py \
640         lib/utils/version.py \
641         lib/utils/wrapper.py \
642         lib/utils/x509.py \
643         lib/utils/bitarrays.py
644
645 docinput = \
646         doc/admin.rst \
647         doc/cluster-keys-replacement.rst \
648         doc/cluster-merge.rst \
649         doc/conf.py \
650         doc/css/style.css \
651         doc/design-2.0.rst \
652         doc/design-2.1.rst \
653         doc/design-2.2.rst \
654         doc/design-2.3.rst \
655         doc/design-2.4.rst \
656         doc/design-2.5.rst \
657         doc/design-2.6.rst \
658         doc/design-2.7.rst \
659         doc/design-2.8.rst \
660         doc/design-2.9.rst \
661         doc/design-2.10.rst \
662         doc/design-2.11.rst \
663         doc/design-2.12.rst \
664         doc/design-2.13.rst \
665         doc/design-2.14.rst \
666         doc/design-2.15.rst \
667         doc/design-2.16.rst \
668         doc/design-2.17.rst \
669         doc/design-allocation-efficiency.rst \
670         doc/design-autorepair.rst \
671         doc/design-bulk-create.rst \
672         doc/design-ceph-ganeti-support.rst \
673         doc/design-configlock.rst \
674         doc/design-chained-jobs.rst \
675         doc/design-cmdlib-unittests.rst \
676         doc/design-cpu-pinning.rst \
677         doc/design-cpu-speed.rst \
678         doc/design-daemons.rst \
679         doc/design-dedicated-allocation.rst \
680         doc/design-device-uuid-name.rst \
681         doc/design-disk-conversion.rst \
682         doc/design-disks.rst \
683         doc/design-draft.rst \
684         doc/design-file-based-disks-ownership.rst \
685         doc/design-file-based-storage.rst \
686         doc/design-glusterfs-ganeti-support.rst \
687         doc/design-hotplug.rst \
688         doc/design-hroller.rst \
689         doc/design-hsqueeze.rst \
690         doc/design-htools-2.3.rst \
691         doc/design-http-server.rst \
692         doc/design-hugepages-support.rst \
693         doc/design-ifdown.rst \
694         doc/design-impexp2.rst \
695         doc/design-internal-shutdown.rst \
696         doc/design-kvmd.rst \
697         doc/design-location.rst \
698         doc/design-linuxha.rst \
699         doc/design-lu-generated-jobs.rst \
700         doc/design-macvtap.rst \
701         doc/design-memory-over-commitment.rst \
702         doc/design-migration-speed-hbal.rst \
703         doc/design-monitoring-agent.rst \
704         doc/design-move-instance-improvements.rst \
705         doc/design-multi-reloc.rst \
706         doc/design-multi-storage-htools.rst \
707         doc/design-multi-version-tests.rst \
708         doc/design-n-m-redundancy.rst \
709         doc/design-network.rst \
710         doc/design-network2.rst \
711         doc/design-node-add.rst \
712         doc/design-node-security.rst \
713         doc/design-oob.rst \
714         doc/design-openvswitch.rst \
715         doc/design-opportunistic-locking.rst \
716         doc/design-optables.rst \
717         doc/design-os.rst \
718         doc/design-ovf-support.rst \
719         doc/design-partitioned.rst \
720         doc/design-plain-redundancy.rst \
721         doc/design-performance-tests.rst \
722         doc/design-query-splitting.rst \
723         doc/design-query2.rst \
724         doc/design-query-splitting.rst \
725         doc/design-reason-trail.rst \
726         doc/design-repaird.rst \
727         doc/design-reservations.rst \
728         doc/design-resource-model.rst \
729         doc/design-restricted-commands.rst \
730         doc/design-scsi-kvm.rst \
731         doc/design-shared-storage.rst \
732         doc/design-shared-storage-redundancy.rst \
733         doc/design-ssh-ports.rst \
734         doc/design-storagetypes.rst \
735         doc/design-sync-rate-throttling.rst \
736         doc/design-systemd.rst \
737         doc/design-upgrade.rst \
738         doc/design-virtual-clusters.rst \
739         doc/design-x509-ca.rst \
740         doc/dev-codestyle.rst \
741         doc/devnotes.rst \
742         doc/glossary.rst \
743         doc/hooks.rst \
744         doc/iallocator.rst \
745         doc/index.rst \
746         doc/install-quick.rst \
747         doc/install.rst \
748         doc/locking.rst \
749         doc/manpages-disabled.rst \
750         doc/monitoring-query-format.rst \
751         doc/move-instance.rst \
752         doc/news.rst \
753         doc/ovfconverter.rst \
754         doc/rapi.rst \
755         doc/security.rst \
756         doc/upgrade.rst \
757         doc/virtual-cluster.rst \
758         doc/walkthrough.rst
759
760 # Generates file names such as "doc/man-gnt-instance.rst"
761 mandocrst = $(addprefix doc/man-,$(notdir $(manrst)))
762
763 # Haskell programs to be installed in $PREFIX/bin
764 HS_BIN_PROGS=src/htools
765
766 # Haskell programs to be installed in the MYEXECLIB dir
767 if ENABLE_MOND
768 HS_MYEXECLIB_PROGS=src/mon-collector
769 else
770 HS_MYEXECLIB_PROGS=
771 endif
772
773 # Haskell programs to be compiled by "make really-all"
774 HS_COMPILE_PROGS = \
775         src/ganeti-kvmd \
776         src/ganeti-wconfd \
777         src/hconfd \
778         src/hluxid \
779         src/hs2py \
780         src/rpc-test
781 if ENABLE_MOND
782 HS_COMPILE_PROGS += src/ganeti-mond src/ganeti-maintd
783 endif
784 if ENABLE_METADATA
785 HS_COMPILE_PROGS += src/ganeti-metad
786 endif
787
788 # All Haskell non-test programs to be compiled but not automatically installed
789 HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
790
791 HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller hsqueeze
792 HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
793
794 # Haskell programs that cannot be disabled at configure (e.g., unlike
795 # 'mon-collector')
796 HS_DEFAULT_PROGS = \
797         $(HS_BIN_PROGS) \
798         test/hs/hpc-htools \
799         test/hs/hpc-mon-collector \
800         $(HS_COMPILE_PROGS)
801
802 if HTEST
803 HS_DEFAULT_PROGS += test/hs/htest
804 else
805 EXTRA_DIST += test/hs/htest.hs
806 endif
807
808 HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
809
810 HS_TEST_PROGS = $(filter test/%,$(HS_ALL_PROGS))
811 HS_SRC_PROGS = $(filter-out test/%,$(HS_ALL_PROGS))
812
813 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
814 HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
815
816 HFLAGS = \
817         -O -Wall -isrc \
818         -fwarn-monomorphism-restriction \
819         -fwarn-tabs \
820         -optP-include -optP$(HASKELL_PACKAGE_VERSIONS_FILE) \
821         -hide-all-packages \
822         `cat $(HASKELL_PACKAGE_IDS_FILE)` \
823         $(GHC_BYVERSION_FLAGS)
824 if DEVELOPER_MODE
825 HFLAGS += -Werror
826 endif
827
828 HTEST_SUFFIX = hpc
829 HPROF_SUFFIX = prof
830
831 DEP_SUFFIXES =
832 if GHC_LE_76
833 DEP_SUFFIXES += -dep-suffix $(HPROF_SUFFIX) -dep-suffix $(HTEST_SUFFIX)
834 else
835 # GHC >= 7.8 stopped putting underscores into -dep-suffix by itself
836 # (https://ghc.haskell.org/trac/ghc/ticket/9749) so we have to put them.
837 # It also needs -dep-suffix "" for the .o file.
838 DEP_SUFFIXES += -dep-suffix $(HPROF_SUFFIX)_ -dep-suffix $(HTEST_SUFFIX)_ \
839         -dep-suffix ""
840 endif
841
842 # GHC > 7.6 needs -dynamic-too when using Template Haskell since its
843 # ghci is switched to loading dynamic libraries by default.
844 # It must only be used in non-profiling GHC invocations.
845 # We also don't use it in compilations that use HTEST_SUFFIX (which are
846 # compiled with -fhpc) because HPC coverage doesn't interact well with
847 # GHCI shared lib loading (https://ghc.haskell.org/trac/ghc/ticket/9762).
848 HFLAGS_DYNAMIC =
849 if !GHC_LE_76
850 HFLAGS_DYNAMIC += -dynamic-too
851 endif
852
853 if HPROFILE
854 HPROFFLAGS = -prof -fprof-auto-top -osuf $(HPROF_SUFFIX)_o \
855         -hisuf $(HPROF_SUFFIX)_hi -rtsopts
856 endif
857 if HCOVERAGE
858 HFLAGS += -fhpc
859 endif
860 if HTEST
861 HFLAGS += -DTEST
862 endif
863
864 HTEST_FLAGS = $(HFLAGS) -fhpc -itest/hs \
865         -osuf $(HTEST_SUFFIX)_o \
866         -hisuf $(HTEST_SUFFIX)_hi
867
868 # extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
869 HEXTRA =
870 # internal extra flags (used for test/hs/htest mainly)
871 HEXTRA_INT =
872 # combination of HEXTRA and HEXTRA_CONFIGURE
873 HEXTRA_COMBINED = $(HEXTRA) $(HEXTRA_CONFIGURE)
874 # exclude options for coverage reports
875 HPCEXCL = --exclude Main \
876         --exclude Ganeti.Constants \
877         --exclude Ganeti.HTools.QC \
878         --exclude Ganeti.THH \
879         --exclude Ganeti.Version \
880         --exclude Test.Ganeti.Attoparsec \
881         --exclude Test.Ganeti.TestCommon \
882         --exclude Test.Ganeti.TestHTools \
883         --exclude Test.Ganeti.TestHelper \
884         --exclude Test.Ganeti.TestImports \
885         $(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
886
887 HS_LIB_SRCS = \
888         src/Ganeti/Prelude.hs \
889         src/Ganeti/BasicTypes.hs \
890         src/Ganeti/Codec.hs \
891         src/Ganeti/Common.hs \
892         src/Ganeti/Compat.hs \
893         src/Ganeti/Confd/Client.hs \
894         src/Ganeti/Confd/ClientFunctions.hs \
895         src/Ganeti/Confd/Server.hs \
896         src/Ganeti/Confd/Types.hs \
897         src/Ganeti/Confd/Utils.hs \
898         src/Ganeti/Config.hs \
899         src/Ganeti/ConfigReader.hs \
900         src/Ganeti/Constants.hs \
901         src/Ganeti/ConstantUtils.hs \
902         src/Ganeti/Cpu/LoadParser.hs \
903         src/Ganeti/Cpu/Types.hs \
904         src/Ganeti/Curl/Multi.hs \
905         src/Ganeti/Daemon.hs \
906         src/Ganeti/Daemon/Utils.hs \
907         src/Ganeti/DataCollectors.hs \
908         src/Ganeti/DataCollectors/CLI.hs \
909         src/Ganeti/DataCollectors/CPUload.hs \
910         src/Ganeti/DataCollectors/Diagnose.hs \
911         src/Ganeti/DataCollectors/Diskstats.hs \
912         src/Ganeti/DataCollectors/Drbd.hs \
913         src/Ganeti/DataCollectors/InstStatus.hs \
914         src/Ganeti/DataCollectors/InstStatusTypes.hs \
915         src/Ganeti/DataCollectors/KvmRSS.hs \
916         src/Ganeti/DataCollectors/Lv.hs \
917         src/Ganeti/DataCollectors/Program.hs \
918         src/Ganeti/DataCollectors/Types.hs \
919         src/Ganeti/DataCollectors/XenCpuLoad.hs \
920         src/Ganeti/Errors.hs \
921         src/Ganeti/HTools/AlgorithmParams.hs \
922         src/Ganeti/HTools/Backend/IAlloc.hs \
923         src/Ganeti/HTools/Backend/Luxi.hs \
924         src/Ganeti/HTools/Backend/MonD.hs \
925         src/Ganeti/HTools/Backend/Rapi.hs \
926         src/Ganeti/HTools/Backend/Simu.hs \
927         src/Ganeti/HTools/Backend/Text.hs \
928         src/Ganeti/HTools/CLI.hs \
929         src/Ganeti/HTools/Cluster.hs \
930         src/Ganeti/HTools/Cluster/AllocatePrimitives.hs \
931         src/Ganeti/HTools/Cluster/AllocateSecondary.hs \
932         src/Ganeti/HTools/Cluster/AllocationSolution.hs \
933         src/Ganeti/HTools/Cluster/Evacuate.hs \
934         src/Ganeti/HTools/Cluster/Metrics.hs \
935         src/Ganeti/HTools/Cluster/MetricsComponents.hs \
936         src/Ganeti/HTools/Cluster/MetricsTH.hs \
937         src/Ganeti/HTools/Cluster/Moves.hs \
938         src/Ganeti/HTools/Cluster/Utils.hs \
939         src/Ganeti/HTools/Container.hs \
940         src/Ganeti/HTools/Dedicated.hs \
941         src/Ganeti/HTools/ExtLoader.hs \
942         src/Ganeti/HTools/GlobalN1.hs \
943         src/Ganeti/HTools/Graph.hs \
944         src/Ganeti/HTools/Group.hs \
945         src/Ganeti/HTools/Instance.hs \
946         src/Ganeti/HTools/Loader.hs \
947         src/Ganeti/HTools/Nic.hs \
948         src/Ganeti/HTools/Node.hs \
949         src/Ganeti/HTools/PeerMap.hs \
950         src/Ganeti/HTools/Program/Hail.hs \
951         src/Ganeti/HTools/Program/Harep.hs \
952         src/Ganeti/HTools/Program/Hbal.hs \
953         src/Ganeti/HTools/Program/Hcheck.hs \
954         src/Ganeti/HTools/Program/Hinfo.hs \
955         src/Ganeti/HTools/Program/Hscan.hs \
956         src/Ganeti/HTools/Program/Hspace.hs \
957         src/Ganeti/HTools/Program/Hsqueeze.hs \
958         src/Ganeti/HTools/Program/Hroller.hs \
959         src/Ganeti/HTools/Program/Main.hs \
960         src/Ganeti/HTools/RedundancyLevel.hs \
961         src/Ganeti/HTools/Repair.hs \
962         src/Ganeti/HTools/Tags.hs \
963         src/Ganeti/HTools/Tags/Constants.hs \
964         src/Ganeti/HTools/Types.hs \
965         src/Ganeti/Hypervisor/Xen.hs \
966         src/Ganeti/Hypervisor/Xen/XmParser.hs \
967         src/Ganeti/Hypervisor/Xen/Types.hs \
968         src/Ganeti/Hash.hs \
969         src/Ganeti/Hs2Py/GenConstants.hs \
970         src/Ganeti/Hs2Py/GenOpCodes.hs \
971         src/Ganeti/Hs2Py/OpDoc.hs \
972         src/Ganeti/JQScheduler.hs \
973         src/Ganeti/JQScheduler/Filtering.hs \
974         src/Ganeti/JQScheduler/ReasonRateLimiting.hs \
975         src/Ganeti/JQScheduler/Types.hs \
976         src/Ganeti/JQueue.hs \
977         src/Ganeti/JQueue/Lens.hs \
978         src/Ganeti/JQueue/Objects.hs \
979         src/Ganeti/JSON.hs \
980         src/Ganeti/Jobs.hs \
981         src/Ganeti/Kvmd.hs \
982         src/Ganeti/Lens.hs \
983         src/Ganeti/Locking/Allocation.hs \
984         src/Ganeti/Locking/Types.hs \
985         src/Ganeti/Locking/Locks.hs \
986         src/Ganeti/Locking/Waiting.hs \
987         src/Ganeti/Logging.hs \
988         src/Ganeti/Logging/Lifted.hs \
989         src/Ganeti/Logging/WriterLog.hs \
990         src/Ganeti/Luxi.hs \
991         src/Ganeti/MaintD/Autorepairs.hs \
992         src/Ganeti/MaintD/Balance.hs \
993         src/Ganeti/MaintD/CleanupIncidents.hs \
994         src/Ganeti/MaintD/CollectIncidents.hs \
995         src/Ganeti/MaintD/FailIncident.hs \
996         src/Ganeti/MaintD/HandleIncidents.hs \
997         src/Ganeti/MaintD/MemoryState.hs \
998         src/Ganeti/MaintD/Server.hs \
999         src/Ganeti/MaintD/Utils.hs \
1000         src/Ganeti/Network.hs \
1001         src/Ganeti/Objects.hs \
1002         src/Ganeti/Objects/BitArray.hs \
1003         src/Ganeti/Objects/Disk.hs \
1004         src/Ganeti/Objects/Instance.hs \
1005         src/Ganeti/Objects/HvState.hs \
1006         src/Ganeti/Objects/Lens.hs \
1007         src/Ganeti/Objects/Maintenance.hs \
1008         src/Ganeti/Objects/Nic.hs \
1009         src/Ganeti/OpCodes.hs \
1010         src/Ganeti/OpCodes/Lens.hs \
1011         src/Ganeti/OpParams.hs \
1012         src/Ganeti/Path.hs \
1013         src/Ganeti/Parsers.hs \
1014         src/Ganeti/PyValue.hs \
1015         src/Ganeti/Query/Cluster.hs \
1016         src/Ganeti/Query/Common.hs \
1017         src/Ganeti/Query/Exec.hs \
1018         src/Ganeti/Query/Export.hs \
1019         src/Ganeti/Query/Filter.hs \
1020         src/Ganeti/Query/FilterRules.hs \
1021         src/Ganeti/Query/Group.hs \
1022         src/Ganeti/Query/Instance.hs \
1023         src/Ganeti/Query/Job.hs \
1024         src/Ganeti/Query/Language.hs \
1025         src/Ganeti/Query/Locks.hs \
1026         src/Ganeti/Query/Network.hs \
1027         src/Ganeti/Query/Node.hs \
1028         src/Ganeti/Query/Query.hs \
1029         src/Ganeti/Query/Server.hs \
1030         src/Ganeti/Query/Types.hs \
1031         src/Ganeti/PartialParams.hs \
1032         src/Ganeti/Rpc.hs \
1033         src/Ganeti/Runtime.hs \
1034         src/Ganeti/SlotMap.hs \
1035         src/Ganeti/Ssconf.hs \
1036         src/Ganeti/Storage/Diskstats/Parser.hs \
1037         src/Ganeti/Storage/Diskstats/Types.hs \
1038         src/Ganeti/Storage/Drbd/Parser.hs \
1039         src/Ganeti/Storage/Drbd/Types.hs \
1040         src/Ganeti/Storage/Lvm/LVParser.hs \
1041         src/Ganeti/Storage/Lvm/Types.hs \
1042         src/Ganeti/Storage/Utils.hs \
1043         src/Ganeti/THH.hs \
1044         src/Ganeti/THH/Field.hs \
1045         src/Ganeti/THH/HsRPC.hs \
1046         src/Ganeti/THH/PyRPC.hs \
1047         src/Ganeti/THH/PyType.hs \
1048         src/Ganeti/THH/Types.hs \
1049         src/Ganeti/THH/RPC.hs \
1050         src/Ganeti/Types.hs \
1051         src/Ganeti/UDSServer.hs \
1052         src/Ganeti/Utils.hs \
1053         src/Ganeti/Utils/Atomic.hs \
1054         src/Ganeti/Utils/AsyncWorker.hs \
1055         src/Ganeti/Utils/Http.hs \
1056         src/Ganeti/Utils/IORef.hs \
1057         src/Ganeti/Utils/Livelock.hs \
1058         src/Ganeti/Utils/Monad.hs \
1059         src/Ganeti/Utils/MultiMap.hs \
1060         src/Ganeti/Utils/MVarLock.hs \
1061         src/Ganeti/Utils/Random.hs \
1062         src/Ganeti/Utils/Statistics.hs \
1063         src/Ganeti/Utils/UniStd.hs \
1064         src/Ganeti/Utils/Validate.hs \
1065         src/Ganeti/VCluster.hs \
1066         src/Ganeti/WConfd/ConfigState.hs \
1067         src/Ganeti/WConfd/ConfigModifications.hs \
1068         src/Ganeti/WConfd/ConfigVerify.hs \
1069         src/Ganeti/WConfd/ConfigWriter.hs \
1070         src/Ganeti/WConfd/Client.hs \
1071         src/Ganeti/WConfd/Core.hs \
1072         src/Ganeti/WConfd/DeathDetection.hs \
1073         src/Ganeti/WConfd/Language.hs \
1074         src/Ganeti/WConfd/Monad.hs \
1075         src/Ganeti/WConfd/Persistent.hs \
1076         src/Ganeti/WConfd/Server.hs \
1077         src/Ganeti/WConfd/Ssconf.hs \
1078         src/Ganeti/WConfd/TempRes.hs
1079
1080 if ENABLE_MOND
1081 HS_LIB_SRCS += src/Ganeti/Monitoring/Server.hs
1082 else
1083 EXTRA_DIST += src/Ganeti/Monitoring/Server.hs
1084 endif
1085
1086 if ENABLE_METADATA
1087 HS_LIB_SRCS += \
1088         src/Ganeti/Metad/Config.hs \
1089         src/Ganeti/Metad/ConfigCore.hs \
1090         src/Ganeti/Metad/ConfigServer.hs \
1091         src/Ganeti/Metad/Server.hs \
1092         src/Ganeti/Metad/Types.hs \
1093         src/Ganeti/Metad/WebServer.hs
1094 else
1095 EXTRA_DIST += \
1096         src/Ganeti/Metad/Config.hs \
1097         src/Ganeti/Metad/ConfigCore.hs \
1098         src/Ganeti/Metad/ConfigServer.hs \
1099         src/Ganeti/Metad/Server.hs \
1100         src/Ganeti/Metad/Types.hs \
1101         src/Ganeti/Metad/WebServer.hs
1102 endif
1103
1104 HS_TEST_SRCS = \
1105         test/hs/Test/AutoConf.hs \
1106         test/hs/Test/Ganeti/Attoparsec.hs \
1107         test/hs/Test/Ganeti/BasicTypes.hs \
1108         test/hs/Test/Ganeti/Common.hs \
1109         test/hs/Test/Ganeti/Confd/Types.hs \
1110         test/hs/Test/Ganeti/Confd/Utils.hs \
1111         test/hs/Test/Ganeti/Constants.hs \
1112         test/hs/Test/Ganeti/Daemon.hs \
1113         test/hs/Test/Ganeti/Errors.hs \
1114         test/hs/Test/Ganeti/HTools/Backend/MonD.hs \
1115         test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
1116         test/hs/Test/Ganeti/HTools/Backend/Text.hs \
1117         test/hs/Test/Ganeti/HTools/CLI.hs \
1118         test/hs/Test/Ganeti/HTools/Cluster.hs \
1119         test/hs/Test/Ganeti/HTools/Container.hs \
1120         test/hs/Test/Ganeti/HTools/Graph.hs \
1121         test/hs/Test/Ganeti/HTools/Instance.hs \
1122         test/hs/Test/Ganeti/HTools/Loader.hs \
1123         test/hs/Test/Ganeti/HTools/Node.hs \
1124         test/hs/Test/Ganeti/HTools/PeerMap.hs \
1125         test/hs/Test/Ganeti/HTools/Types.hs \
1126         test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
1127         test/hs/Test/Ganeti/JSON.hs \
1128         test/hs/Test/Ganeti/Jobs.hs \
1129         test/hs/Test/Ganeti/JQScheduler.hs \
1130         test/hs/Test/Ganeti/JQueue.hs \
1131         test/hs/Test/Ganeti/JQueue/Objects.hs \
1132         test/hs/Test/Ganeti/Kvmd.hs \
1133         test/hs/Test/Ganeti/Luxi.hs \
1134         test/hs/Test/Ganeti/Locking/Allocation.hs \
1135         test/hs/Test/Ganeti/Locking/Locks.hs \
1136         test/hs/Test/Ganeti/Locking/Waiting.hs \
1137         test/hs/Test/Ganeti/Network.hs \
1138         test/hs/Test/Ganeti/PartialParams.hs \
1139         test/hs/Test/Ganeti/Objects.hs \
1140         test/hs/Test/Ganeti/Objects/BitArray.hs \
1141         test/hs/Test/Ganeti/OpCodes.hs \
1142         test/hs/Test/Ganeti/Query/Aliases.hs \
1143         test/hs/Test/Ganeti/Query/Filter.hs \
1144         test/hs/Test/Ganeti/Query/Instance.hs \
1145         test/hs/Test/Ganeti/Query/Language.hs \
1146         test/hs/Test/Ganeti/Query/Network.hs \
1147         test/hs/Test/Ganeti/Query/Query.hs \
1148         test/hs/Test/Ganeti/Rpc.hs \
1149         test/hs/Test/Ganeti/Runtime.hs \
1150         test/hs/Test/Ganeti/SlotMap.hs \
1151         test/hs/Test/Ganeti/Ssconf.hs \
1152         test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
1153         test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
1154         test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
1155         test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
1156         test/hs/Test/Ganeti/THH.hs \
1157         test/hs/Test/Ganeti/THH/Types.hs \
1158         test/hs/Test/Ganeti/TestCommon.hs \
1159         test/hs/Test/Ganeti/TestHTools.hs \
1160         test/hs/Test/Ganeti/TestHelper.hs \
1161         test/hs/Test/Ganeti/Types.hs \
1162         test/hs/Test/Ganeti/Utils.hs \
1163         test/hs/Test/Ganeti/Utils/MultiMap.hs \
1164         test/hs/Test/Ganeti/Utils/Statistics.hs \
1165         test/hs/Test/Ganeti/WConfd/Ssconf.hs \
1166         test/hs/Test/Ganeti/WConfd/TempRes.hs
1167
1168
1169 HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
1170
1171 HS_BUILT_SRCS = \
1172         test/hs/Test/Ganeti/TestImports.hs \
1173         src/AutoConf.hs \
1174         src/Ganeti/Hs2Py/ListConstants.hs \
1175         src/Ganeti/Curl/Internal.hs \
1176         src/Ganeti/Version.hs
1177 HS_BUILT_SRCS_IN = \
1178         $(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
1179         src/Ganeti/Curl/Internal.hsc \
1180         lib/_constants.py.in \
1181         lib/opcodes.py.in_after \
1182         lib/opcodes.py.in_before
1183
1184 HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
1185
1186 $(RUN_IN_TEMPDIR): | stamp-directories
1187
1188 doc/html/index.html: ENABLE_MANPAGES =
1189 doc/man-html/index.html: ENABLE_MANPAGES = 1
1190 doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
1191
1192 if HAS_SPHINX_PRE13
1193         SPHINX_HTML_THEME=default
1194 else
1195         SPHINX_HTML_THEME=classic
1196 endif
1197 # Note: we use here an order-only prerequisite, as the contents of
1198 # _constants.py are not actually influencing the html build output: it
1199 # has to exist in order for the sphinx module to be loaded
1200 # successfully, but we certainly don't want the docs to be rebuilt if
1201 # it changes
1202 doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
1203         configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
1204         lib/build/shell_example_lexer.py lib/ht.py \
1205         doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
1206         autotools/sphinx-wrapper | $(built_python_sources)
1207         @test -n "$(SPHINX)" || \
1208             { echo 'sphinx-build' not found during configure; exit 1; }
1209 if !MANPAGES_IN_DOC
1210         if test -n '$(ENABLE_MANPAGES)'; then \
1211           echo 'Man pages in documentation were disabled at configure time' >&2; \
1212           exit 1; \
1213         fi
1214 endif
1215 ## Sphinx provides little control over what content should be included. Some
1216 ## mechanisms exist, but they all have drawbacks or actual issues. Since we
1217 ## build two different versions of the documentation--once without man pages and
1218 ## once, if enabled, with them--some control is necessary. xmpp-wrapper provides
1219 ## us with this, but requires running in a temporary directory. It moves the
1220 ## correct files into place depending on environment variables.
1221         dir=$(dir $@) && \
1222         @mkdir_p@ $$dir && \
1223         PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
1224         HTML_THEME=$(SPHINX_HTML_THEME) \
1225         $(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
1226             -d . \
1227             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
1228             -D release="$(PACKAGE_VERSION)" \
1229             -D graphviz_dot="$(DOT)" \
1230             doc $(CURDIR)/$$dir && \
1231         rm -f $$dir/.buildinfo $$dir/objects.inv
1232         touch $@
1233
1234 doc/html: doc/html/index.html
1235
1236 doc/man-html: doc/man-html/index.html
1237
1238 doc/install-quick.rst: INSTALL
1239 doc/news.rst: NEWS
1240 doc/upgrade.rst: UPGRADE
1241
1242 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
1243         set -e; \
1244         { echo '.. This file is automatically updated at build time from $<.'; \
1245           echo '.. Do not edit.'; \
1246           echo; \
1247           cat $<; \
1248         } > $@
1249
1250 doc/manpages-enabled.rst: Makefile | $(built_base_sources)
1251         { echo '.. This file is automatically generated, do not edit!'; \
1252           echo ''; \
1253           echo 'Man pages'; \
1254           echo '========='; \
1255           echo; \
1256           echo '.. toctree::'; \
1257           echo '   :maxdepth: 1'; \
1258           echo; \
1259           for i in $(notdir $(mandocrst)); do \
1260             echo "   $$i"; \
1261           done | LC_ALL=C sort; \
1262         } > $@
1263
1264 doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
1265 if MANPAGES_IN_DOC
1266         { echo '.. This file is automatically updated at build time from $<.'; \
1267           echo '.. Do not edit.'; \
1268           echo; \
1269           echo "$*"; \
1270           echo '=========================================='; \
1271           tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
1272         } > $@
1273 else
1274         echo 'Man pages in documentation were disabled at configure time' >&2; \
1275         exit 1;
1276 endif
1277
1278 doc/users/%: doc/users/%.in Makefile $(REPLACE_VARS_SED)
1279         cat $< | sed -f $(REPLACE_VARS_SED) | LC_ALL=C sort | uniq | (grep -v '^root' || true) > $@
1280
1281 userspecs = \
1282         doc/users/users \
1283         doc/users/groups \
1284         doc/users/groupmemberships
1285
1286 # Things to build but not to install (add it to EXTRA_DIST if it should be
1287 # distributed)
1288 noinst_DATA = \
1289         $(BUILT_EXAMPLES) \
1290         doc/examples/bash_completion \
1291         doc/examples/bash_completion-debug \
1292         $(userspecs) \
1293         $(manhtml)
1294
1295 if HAS_SPHINX
1296 if MANPAGES_IN_DOC
1297 noinst_DATA += doc/man-html
1298 else
1299 noinst_DATA += doc/html
1300 endif
1301 endif
1302
1303 gnt_scripts = \
1304         scripts/gnt-backup \
1305         scripts/gnt-cluster \
1306         scripts/gnt-debug \
1307         scripts/gnt-group \
1308         scripts/gnt-instance \
1309         scripts/gnt-job \
1310         scripts/gnt-network \
1311         scripts/gnt-node \
1312         scripts/gnt-os \
1313         scripts/gnt-storage \
1314         scripts/gnt-filter
1315
1316 gnt_scripts_basenames = \
1317         $(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
1318
1319 gnt_python_sbin_SCRIPTS = \
1320         $(PYTHON_BOOTSTRAP_SBIN)
1321
1322 gntpython_SCRIPTS = $(gnt_scripts)
1323
1324 PYTHON_BOOTSTRAP_SBIN = \
1325         daemons/ganeti-noded \
1326         daemons/ganeti-rapi \
1327         daemons/ganeti-watcher
1328
1329 PYTHON_BOOTSTRAP = \
1330         tools/burnin \
1331         tools/ensure-dirs \
1332         tools/node-cleanup \
1333         tools/node-daemon-setup \
1334         tools/prepare-node-join \
1335         tools/ssh-update \
1336         tools/ssl-update
1337
1338 qa_scripts = \
1339         qa/__init__.py \
1340         qa/ganeti-qa.py \
1341         qa/qa_cluster.py \
1342         qa/qa_config.py \
1343         qa/qa_daemon.py \
1344         qa/qa_env.py \
1345         qa/qa_error.py \
1346         qa/qa_filters.py \
1347         qa/qa_group.py \
1348         qa/qa_instance.py \
1349         qa/qa_instance_utils.py \
1350         qa/qa_iptables.py \
1351         qa/qa_job.py \
1352         qa/qa_job_utils.py \
1353         qa/qa_logging.py \
1354         qa/qa_monitoring.py \
1355         qa/qa_network.py \
1356         qa/qa_node.py \
1357         qa/qa_os.py \
1358         qa/qa_performance.py \
1359         qa/qa_rapi.py \
1360         qa/qa_tags.py \
1361         qa/qa_utils.py
1362
1363 bin_SCRIPTS = $(HS_BIN_PROGS)
1364 install-exec-hook:
1365         @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
1366 # FIXME: this is a hardcoded logic, instead of auto-resolving
1367         $(LN_S) -f ../../../bin/htools \
1368           $(DESTDIR)$(iallocatorsdir)/hail
1369         for role in $(HS_BIN_ROLES); do \
1370           $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1371         done
1372
1373 HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1374
1375 HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
1376 if WANT_HSTESTS
1377 HS_MAKEFILE_GHC_SRCS += $(HS_TEST_PROGS:%=%.hs)
1378 endif
1379 Makefile.ghc: $(HS_MAKEFILE_GHC_SRCS) Makefile $(HASKELL_PACKAGE_VERSIONS_FILE) \
1380               | $(built_base_sources) $(HS_BUILT_SRCS)
1381         $(GHC) -M -dep-makefile $@ $(DEP_SUFFIXES) $(HFLAGS) $(HFLAGS_DYNAMIC) \
1382                 -itest/hs \
1383                 $(HEXTRA_COMBINED) $(HS_MAKEFILE_GHC_SRCS)
1384 # Since ghc -M does not generate dependency line for object files, dependencies
1385 # from a target executable seed object (e.g. src/hluxid.o) to objects which
1386 # finally will be linked to the target object (e.g. src/Ganeti/Daemon.o) are
1387 # missing in Makefile.ghc.
1388 # see: https://www.haskell.org/ghc/docs/7.6.2/html/users_guide/separate-compilation.html#makefile-dependencies
1389 # Following substitutions will add dependencies between object files which
1390 # corresponds to the interface file already there as a dependency for each
1391 # object listed in Makefile.ghc.
1392 # e.g. src/hluxid.o : src/Ganeti/Daemon.hi
1393 #        => src/hluxid.o : src/Ganeti/Daemon.hi src/Ganeti/Daemon.o
1394         sed -i -r -e 's/([^ ]+)\.hi$$/\1.hi \1.o/' -e 's/([^ ]+)_hi$$/\1_hi \1_o/' $@
1395
1396 @include_makefile_ghc@
1397
1398 # Contains the package-id flags for the current build: "-package-id" followed
1399 # by the name and hash of the package, one for each dependency.
1400 # Obtained from the setup-config using the Cabal API
1401 # (CabalDependenciesMacros.hs) after `cabal configure`.
1402 # This file is created along with HASKELL_PACKAGE_VERSIONS_FILE; if you want
1403 # to depend on it in a rule, depend on HASKELL_PACKAGE_VERSIONS_FILE instead.
1404 HASKELL_PACKAGE_IDS_FILE = ganeti.depsflags
1405
1406 # Defines the MIN_VERSION_* macros for all Haskell packages used in this
1407 # compilation.
1408 # The versions are determined using `cabal configure`, which takes them from
1409 # the ghc-pkg database.
1410 # At the moment, we don't support cabal sandboxes, so we use cabal configure
1411 # with the --user flag.
1412 # Note: `cabal configure` and CabalDependenciesMacros.hs perform no
1413 # downloading (only `cabal install` can do that).
1414 HASKELL_PACKAGE_VERSIONS_FILE = cabal_macros.h
1415
1416 $(HASKELL_PACKAGE_VERSIONS_FILE): Makefile ganeti.cabal \
1417                                   cabal/CabalDependenciesMacros.hs
1418         touch empty-cabal-config
1419         $(CABAL) --config-file=empty-cabal-config configure --user \
1420           -f`test $(HTEST) == yes && echo "htest" || echo "-htest"` \
1421           -f`test $(ENABLE_MOND) == True && echo "mond" || echo "-mond"` \
1422           -f`test $(ENABLE_METADATA) == True && echo "metad" || echo "-metad"`
1423         runhaskell $(abs_top_srcdir)/cabal/CabalDependenciesMacros.hs \
1424           ganeti.cabal \
1425           $(HASKELL_PACKAGE_IDS_FILE) \
1426           $(HASKELL_PACKAGE_VERSIONS_FILE)
1427
1428 # Like the %.o rule, but allows access to the test/hs directory.
1429 # This uses HFLAGS instead of HTEST_FLAGS because it's only for generating
1430 # object files (.o for GHC <= 7.6, .o/.so for newer GHCs) that are loaded
1431 # in GHCI when evaluating TH. The actual test-with-coverage .hpc_o files
1432 # are created in the `%.$(HTEST_SUFFIX)_o` rule.
1433 test/hs/%.o: $(HASKELL_PACKAGE_VERSIONS_FILE)
1434         @echo '[GHC|test]: $@ <- test/hs/$^'
1435         @$(GHC) -c $(HFLAGS) -itest/hs $(HFLAGS_DYNAMIC) \
1436                 $(HEXTRA_COMBINED) $(@:%.o=%.hs)
1437
1438 %.o: $(HASKELL_PACKAGE_VERSIONS_FILE)
1439         @echo '[GHC]: $@ <- $^'
1440         @$(GHC) -c $(HFLAGS) $(HFLAGS_DYNAMIC) \
1441                 $(HEXTRA_COMBINED) $(@:%.o=%.hs)
1442
1443 # For TH+profiling we need to compile twice: Once without profiling,
1444 # and then once with profiling. See
1445 # http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/template-haskell.html#id636646
1446 if HPROFILE
1447 %.$(HPROF_SUFFIX)_o: %.o
1448         @echo '[GHC|prof]: $@ <- $^'
1449         @$(GHC) -c $(HFLAGS) \
1450           $(HPROFFLAGS) \
1451                 $(HEXTRA_COMBINED) \
1452                 $(@:%.$(HPROF_SUFFIX)_o=%.hs)
1453 endif
1454
1455 # We depend on the non-test .o file here because we need the corresponding .so
1456 # file for GHC > 7.6 ghci dynamic loading for TH, and creating the .o file
1457 # will create the .so file since we use -dynamic-too (using the `test/hs/%.o`
1458 # rule).
1459 %.$(HTEST_SUFFIX)_o: %.o
1460         @echo '[GHC|test]: $@ <- $^'
1461         @$(GHC) -c $(HTEST_FLAGS) \
1462                 $(HEXTRA_COMBINED) $(@:%.$(HTEST_SUFFIX)_o=%.hs)
1463
1464 %.hi: %.o ;
1465 %.$(HTEST_SUFFIX)_hi: %.$(HTEST_SUFFIX)_o ;
1466 %.$(HPROF_SUFFIX)_hi: %.$(HPROF_SUFFIX)_o ;
1467
1468 if HPROFILE
1469 $(HS_SRC_PROGS): %: %.$(HPROF_SUFFIX)_o | stamp-directories
1470         @echo '[GHC-link]: $@'
1471         $(GHC) $(HFLAGS) $(HPROFFLAGS) \
1472                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1473 else
1474 $(HS_SRC_PROGS): %: %.o | stamp-directories
1475         @echo '[GHC-link]: $@'
1476         $(GHC) $(HFLAGS) $(HFLAGS_DYNAMIC) \
1477                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1478 endif
1479         @rm -f $(notdir $@).tix
1480         @touch "$@"
1481
1482 $(HS_TEST_PROGS): %: %.$(HTEST_SUFFIX)_o \
1483                            | stamp-directories $(built_python_sources)
1484         @if [ "$(HS_NODEV)" ]; then \
1485           echo "Error: cannot run unittests without the development" \
1486                " libraries (see devnotes.rst)" 1>&2; \
1487           exit 1; \
1488         fi
1489         @echo '[GHC-link|test]: $@'
1490         $(GHC) $(HTEST_FLAGS) \
1491                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1492         @rm -f $(notdir $@).tix
1493         @touch "$@"
1494
1495 dist_sbin_SCRIPTS = \
1496         tools/ganeti-listrunner
1497
1498 nodist_sbin_SCRIPTS = \
1499         daemons/ganeti-cleaner \
1500   src/ganeti-kvmd \
1501   src/ganeti-luxid \
1502   src/ganeti-confd \
1503   src/ganeti-wconfd
1504
1505 src/ganeti-luxid: src/hluxid
1506         cp -f $< $@
1507
1508 # strip path prefixes off the sbin scripts
1509 all_sbin_scripts = \
1510         $(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1511         $(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1512
1513 src/ganeti-confd: src/hconfd
1514         cp -f $< $@
1515
1516 if ENABLE_MOND
1517 nodist_sbin_SCRIPTS += src/ganeti-mond src/ganeti-maintd
1518 endif
1519
1520 if ENABLE_METADATA
1521 nodist_sbin_SCRIPTS += src/ganeti-metad
1522 endif
1523
1524 python_scripts = \
1525         tools/cfgshell \
1526         tools/cfgupgrade \
1527         tools/cfgupgrade12 \
1528         tools/cluster-merge \
1529         tools/confd-client \
1530         tools/fmtjson \
1531         tools/lvmstrap \
1532         tools/move-instance \
1533         tools/ovfconverter \
1534         tools/post-upgrade \
1535         tools/sanitize-config \
1536         tools/query-config
1537
1538 python_scripts_shebang = \
1539         $(patsubst tools/%,tools/shebang/%, $(python_scripts))
1540
1541 tools/shebang/%: tools/%
1542         mkdir -p tools/shebang
1543         head -1 $< | sed 's|#!/usr/bin/python|#!$(PYTHON)|' > $@
1544         echo '# Generated file; do not edit.' >> $@
1545         tail -n +2 $< >> $@
1546
1547 dist_tools_SCRIPTS = \
1548         tools/kvm-console-wrapper \
1549         tools/master-ip-setup \
1550         tools/xen-console-wrapper
1551
1552 dist_tools_python_SCRIPTS = \
1553         tools/burnin
1554
1555 nodist_tools_python_SCRIPTS = \
1556         tools/node-cleanup \
1557         $(python_scripts_shebang)
1558
1559 tools_python_basenames = \
1560         $(patsubst shebang/%,%,\
1561         $(patsubst tools/%,%,\
1562         $(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS)))
1563
1564 nodist_tools_SCRIPTS = \
1565         tools/users-setup \
1566         tools/vcluster-setup
1567
1568 tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1569
1570 pkglib_python_scripts = \
1571         daemons/import-export \
1572         tools/check-cert-expired
1573
1574 nodist_pkglib_python_scripts = \
1575         tools/ensure-dirs \
1576         tools/node-daemon-setup \
1577         tools/prepare-node-join \
1578         tools/ssh-update \
1579         tools/ssl-update
1580
1581 pkglib_python_basenames = \
1582         $(patsubst daemons/%,%,$(patsubst tools/%,%,\
1583         $(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1584
1585 myexeclib_SCRIPTS = \
1586         daemons/daemon-util \
1587         tools/kvm-ifup \
1588         tools/kvm-ifup-os \
1589         tools/xen-ifup-os \
1590         tools/vif-ganeti \
1591         tools/vif-ganeti-metad \
1592         tools/net-common \
1593         $(HS_MYEXECLIB_PROGS)
1594
1595 # compute the basenames of the myexeclib_scripts
1596 myexeclib_scripts_basenames = \
1597         $(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1598
1599 EXTRA_DIST += \
1600         NEWS \
1601         UPGRADE \
1602         epydoc.conf.in \
1603         pylintrc \
1604         pylintrc-test \
1605         autotools/build-bash-completion \
1606         autotools/build-rpc \
1607         autotools/check-header \
1608         autotools/check-imports \
1609         autotools/check-man-dashes \
1610         autotools/check-man-references \
1611         autotools/check-man-warnings \
1612         autotools/check-news \
1613         autotools/check-python-code \
1614         autotools/check-tar \
1615         autotools/check-version \
1616         autotools/docpp \
1617         autotools/gen-py-coverage \
1618         autotools/print-py-constants \
1619         autotools/sphinx-wrapper \
1620         autotools/testrunner \
1621         autotools/wrong-hardcoded-paths \
1622         cabal/cabal-from-modules.py \
1623         $(RUN_IN_TEMPDIR) \
1624         daemons/daemon-util.in \
1625         daemons/ganeti-cleaner.in \
1626         $(pkglib_python_scripts) \
1627         devel/build_chroot \
1628         devel/cert_digest.py \
1629         devel/upload \
1630         devel/webserver \
1631         tools/kvm-ifup.in \
1632         tools/ifup-os.in \
1633         tools/vif-ganeti.in \
1634         tools/vif-ganeti-metad.in \
1635         tools/net-common.in \
1636         tools/vcluster-setup.in \
1637         $(python_scripts) \
1638         $(docinput) \
1639         doc/html \
1640         $(BUILT_EXAMPLES:%=%.in) \
1641         doc/examples/ganeti.default \
1642         doc/examples/ganeti.default-debug \
1643         doc/examples/hooks/ethers \
1644         doc/examples/gnt-debug/README \
1645         doc/examples/gnt-debug/delay0.json \
1646         doc/examples/gnt-debug/delay50.json \
1647         doc/examples/systemd/ganeti-master.target \
1648         doc/examples/systemd/ganeti-node.target \
1649         doc/examples/systemd/ganeti.service \
1650         doc/examples/systemd/ganeti.target \
1651         doc/users/groupmemberships.in \
1652         doc/users/groups.in \
1653         doc/users/users.in \
1654         ganeti.cabal \
1655         cabal/ganeti.template.cabal \
1656         cabal/CabalDependenciesMacros.hs \
1657         $(dist_TESTS) \
1658         $(TEST_FILES) \
1659         $(python_test_support) \
1660         $(python_test_utils) \
1661         man/footer.rst \
1662         $(manrst) \
1663         $(maninput) \
1664         qa/qa-sample.json \
1665         $(qa_scripts) \
1666         $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
1667         $(HS_PROG_SRCS) \
1668         src/lint-hints.hs \
1669         test/hs/cli-tests-defs.sh \
1670         test/hs/offline-test.sh \
1671         .ghci
1672
1673 man_MANS = \
1674         man/ganeti-cleaner.8 \
1675         man/ganeti-confd.8 \
1676         man/ganeti-luxid.8 \
1677         man/ganeti-listrunner.8 \
1678         man/ganeti-kvmd.8 \
1679         man/ganeti-mond.8 \
1680         man/ganeti-noded.8 \
1681         man/ganeti-os-interface.7 \
1682         man/ganeti-extstorage-interface.7 \
1683         man/ganeti-rapi.8 \
1684         man/ganeti-watcher.8 \
1685         man/ganeti-wconfd.8 \
1686         man/ganeti.7 \
1687         man/gnt-backup.8 \
1688         man/gnt-cluster.8 \
1689         man/gnt-debug.8 \
1690         man/gnt-group.8 \
1691         man/gnt-network.8 \
1692         man/gnt-instance.8 \
1693         man/gnt-job.8 \
1694         man/gnt-node.8 \
1695         man/gnt-os.8 \
1696         man/gnt-storage.8 \
1697         man/gnt-filter.8 \
1698         man/hail.1 \
1699         man/harep.1 \
1700         man/hbal.1 \
1701         man/hcheck.1 \
1702         man/hinfo.1 \
1703         man/hscan.1 \
1704         man/hspace.1 \
1705         man/hsqueeze.1 \
1706         man/hroller.1 \
1707         man/htools.1 \
1708         man/mon-collector.7
1709
1710 # Remove extensions from all filenames in man_MANS
1711 mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1712
1713 manrst = $(patsubst %,%.rst,$(mannoext))
1714 manhtml = $(patsubst %.rst,%.html,$(manrst))
1715 mangen = $(patsubst %.rst,%.gen,$(manrst))
1716 maninput = \
1717         $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1718         $(patsubst %.html,%.html.in,$(manhtml)) \
1719         $(mangen)
1720
1721 manfullpath = $(patsubst man/%.1,man1/%.1,\
1722         $(patsubst man/%.7,man7/%.7,\
1723         $(patsubst man/%.8,man8/%.8,$(man_MANS))))
1724
1725 TEST_FILES = \
1726         test/autotools/autotools-check-news.test \
1727         test/data/htools/clean-nonzero-score.data \
1728         test/data/htools/common-suffix.data \
1729         test/data/htools/dyn1.json \
1730         test/data/htools/dyn2.json \
1731         test/data/htools/dyn3.json \
1732         test/data/htools/empty-cluster.data \
1733         test/data/htools/hail-alloc-dedicated-1.json \
1734         test/data/htools/hail-alloc-desired-location.json \
1735         test/data/htools/hail-alloc-drbd.json \
1736         test/data/htools/hail-alloc-drbd-restricted.json \
1737         test/data/htools/hail-alloc-ext.json \
1738         test/data/htools/hail-alloc-invalid-network.json \
1739         test/data/htools/hail-alloc-invalid-twodisks.json \
1740         test/data/htools/hail-alloc-restricted-network.json \
1741         test/data/htools/hail-alloc-nlocation.json \
1742         test/data/htools/hail-alloc-plain-tags.json \
1743         test/data/htools/hail-alloc-secondary.json \
1744         test/data/htools/hail-alloc-spindles.json \
1745         test/data/htools/hail-alloc-twodisks.json \
1746         test/data/htools/hail-alloc-memory-over-commitment.json \
1747         test/data/htools/hail-change-group.json \
1748         test/data/htools/hail-invalid-reloc.json \
1749         test/data/htools/hail-node-evac.json \
1750         test/data/htools/hail-reloc-drbd.json \
1751         test/data/htools/hail-reloc-drbd-crowded.json \
1752         test/data/htools/hbal-avoid-disk-moves.data \
1753         test/data/htools/hbal-cpu-speed.data \
1754         test/data/htools/hbal-desiredlocation-1.data \
1755         test/data/htools/hbal-desiredlocation-2.data \
1756         test/data/htools/hbal-desiredlocation-3.data \
1757         test/data/htools/hbal-desiredlocation-4.data \
1758         test/data/htools/hbal-dyn.data \
1759         test/data/htools/hbal-dyn2.data \
1760         test/data/htools/hbal-evac.data \
1761         test/data/htools/hbal-excl-tags.data \
1762         test/data/htools/hbal-forth.data \
1763         test/data/htools/hbal-location-1.data \
1764         test/data/htools/hbal-location-exclusion.data \
1765         test/data/htools/hbal-location-2.data \
1766         test/data/htools/hbal-memory-over-commitment.data \
1767         test/data/htools/hbal-memory-over-commitment-2.data \
1768         test/data/htools/hbal-migration-1.data \
1769         test/data/htools/hbal-migration-2.data \
1770         test/data/htools/hbal-migration-3.data \
1771         test/data/htools/hail-multialloc-dedicated.json \
1772         test/data/htools/hbal-soft-errors.data \
1773         test/data/htools/hbal-soft-errors2.data \
1774         test/data/htools/hbal-split-insts.data \
1775         test/data/htools/hspace-bad-group.data \
1776         test/data/htools/hspace-existing.data \
1777         test/data/htools/hspace-groups-one.data \
1778         test/data/htools/hspace-groups-two.data \
1779         test/data/htools/hspace-tiered-dualspec-exclusive.data \
1780         test/data/htools/hspace-tiered-dualspec.data \
1781         test/data/htools/hspace-tiered-exclusive.data \
1782         test/data/htools/hspace-tiered-ipolicy.data \
1783         test/data/htools/hspace-tiered-mixed.data \
1784         test/data/htools/hspace-tiered-resourcetypes.data \
1785         test/data/htools/hspace-tiered-vcpu.data \
1786         test/data/htools/hspace-tiered.data \
1787         test/data/htools/invalid-node.data \
1788         test/data/htools/missing-resources.data \
1789         test/data/htools/multiple-master.data \
1790         test/data/htools/multiple-tags.data \
1791         test/data/htools/n1-failure.data \
1792         test/data/htools/partly-used.data \
1793         test/data/htools/rapi/groups.json \
1794         test/data/htools/rapi/info.json \
1795         test/data/htools/rapi/instances.json \
1796         test/data/htools/rapi/nodes.json \
1797         test/data/htools/hroller-full.data \
1798         test/data/htools/hroller-nodegroups.data \
1799         test/data/htools/hroller-nonredundant.data \
1800         test/data/htools/hroller-online.data \
1801         test/data/htools/hsqueeze-mixed-instances.data \
1802         test/data/htools/hsqueeze-overutilized.data \
1803         test/data/htools/hsqueeze-underutilized.data \
1804         test/data/htools/plain-n1-restriction.data \
1805         test/data/htools/shared-n1-failure.data \
1806         test/data/htools/shared-n1-restriction.data \
1807         test/data/htools/unique-reboot-order.data \
1808         test/data/mond-data.txt \
1809         test/hs/shelltests/htools-balancing.test \
1810         test/hs/shelltests/htools-basic.test \
1811         test/hs/shelltests/htools-dynutil.test \
1812         test/hs/shelltests/htools-excl.test \
1813         test/hs/shelltests/htools-hail.test \
1814         test/hs/shelltests/htools-hbal-evac.test \
1815         test/hs/shelltests/htools-hbal.test \
1816         test/hs/shelltests/htools-hcheck.test \
1817         test/hs/shelltests/htools-hroller.test \
1818         test/hs/shelltests/htools-hspace.test \
1819         test/hs/shelltests/htools-hsqueeze.test \
1820         test/hs/shelltests/htools-invalid.test \
1821         test/hs/shelltests/htools-multi-group.test \
1822         test/hs/shelltests/htools-no-backend.test \
1823         test/hs/shelltests/htools-rapi.test \
1824         test/hs/shelltests/htools-single-group.test \
1825         test/hs/shelltests/htools-text-backend.test \
1826         test/hs/shelltests/htools-mon-collector.test \
1827         test/data/bdev-drbd-8.0.txt \
1828         test/data/bdev-drbd-8.3.txt \
1829         test/data/bdev-drbd-8.4.txt \
1830         test/data/bdev-drbd-8.4-no-disk-params.txt \
1831         test/data/bdev-drbd-disk.txt \
1832         test/data/bdev-drbd-net-ip4.txt \
1833         test/data/bdev-drbd-net-ip6.txt \
1834         test/data/bdev-rbd/json_output_empty.txt \
1835         test/data/bdev-rbd/json_output_extra_matches.txt \
1836         test/data/bdev-rbd/json_output_no_matches.txt \
1837         test/data/bdev-rbd/json_output_ok.txt \
1838         test/data/bdev-rbd/plain_output_new_extra_matches.txt \
1839         test/data/bdev-rbd/plain_output_new_no_matches.txt \
1840         test/data/bdev-rbd/plain_output_new_ok.txt \
1841         test/data/bdev-rbd/plain_output_old_empty.txt \
1842         test/data/bdev-rbd/plain_output_old_extra_matches.txt \
1843         test/data/bdev-rbd/plain_output_old_no_matches.txt \
1844         test/data/bdev-rbd/plain_output_old_ok.txt \
1845         test/data/bdev-rbd/output_invalid.txt \
1846         test/data/cert1.pem \
1847         test/data/cert2.pem \
1848         test/data/cgroup_root/memory/lxc/instance1/memory.limit_in_bytes \
1849         test/data/cgroup_root/cpuset/some_group/lxc/instance1/cpuset.cpus \
1850         test/data/cgroup_root/devices/some_group/lxc/instance1/devices.list \
1851         test/data/cluster_config_2.7.json \
1852         test/data/cluster_config_2.8.json \
1853         test/data/cluster_config_2.9.json \
1854         test/data/cluster_config_2.10.json \
1855         test/data/cluster_config_2.11.json \
1856         test/data/cluster_config_2.12.json \
1857         test/data/cluster_config_2.13.json \
1858         test/data/cluster_config_2.14.json \
1859         test/data/cluster_config_2.15.json \
1860         test/data/cluster_config_2.16.json \
1861         test/data/cluster_config_2.17.json \
1862         test/data/instance-minor-pairing.txt \
1863         test/data/instance-disks.txt \
1864         test/data/ip-addr-show-dummy0.txt \
1865         test/data/ip-addr-show-lo-ipv4.txt \
1866         test/data/ip-addr-show-lo-ipv6.txt \
1867         test/data/ip-addr-show-lo-oneline-ipv4.txt \
1868         test/data/ip-addr-show-lo-oneline-ipv6.txt \
1869         test/data/ip-addr-show-lo-oneline.txt \
1870         test/data/ip-addr-show-lo.txt \
1871         test/data/kvm_0.12.5_help.txt \
1872         test/data/kvm_0.15.90_help.txt \
1873         test/data/kvm_0.9.1_help.txt \
1874         test/data/kvm_0.9.1_help_boot_test.txt \
1875         test/data/kvm_1.0_help.txt \
1876         test/data/kvm_1.1.2_help.txt \
1877         test/data/kvm_runtime.json \
1878         test/data/lvs_lv.txt \
1879         test/data/NEWS_OK.txt \
1880         test/data/NEWS_previous_unreleased.txt \
1881         test/data/ovfdata/compr_disk.vmdk.gz \
1882         test/data/ovfdata/config.ini \
1883         test/data/ovfdata/corrupted_resources.ovf \
1884         test/data/ovfdata/empty.ini \
1885         test/data/ovfdata/empty.ovf \
1886         test/data/ovfdata/ganeti.mf \
1887         test/data/ovfdata/ganeti.ovf \
1888         test/data/ovfdata/gzip_disk.ovf \
1889         test/data/ovfdata/new_disk.vmdk \
1890         test/data/ovfdata/no_disk.ini \
1891         test/data/ovfdata/no_disk_in_ref.ovf \
1892         test/data/ovfdata/no_os.ini \
1893         test/data/ovfdata/no_ovf.ova \
1894         test/data/ovfdata/other/rawdisk.raw \
1895         test/data/ovfdata/ova.ova \
1896         test/data/ovfdata/rawdisk.raw \
1897         test/data/ovfdata/second_disk.vmdk \
1898         test/data/ovfdata/unsafe_path.ini \
1899         test/data/ovfdata/virtualbox.ovf \
1900         test/data/ovfdata/wrong_config.ini \
1901         test/data/ovfdata/wrong_extension.ovd \
1902         test/data/ovfdata/wrong_manifest.mf \
1903         test/data/ovfdata/wrong_manifest.ovf \
1904         test/data/ovfdata/wrong_ova.ova \
1905         test/data/ovfdata/wrong_xml.ovf \
1906         test/data/proc_cgroup.txt \
1907         test/data/proc_diskstats.txt \
1908         test/data/proc_drbd8.txt \
1909         test/data/proc_drbd80-emptyline.txt \
1910         test/data/proc_drbd80-emptyversion.txt \
1911         test/data/proc_drbd83.txt \
1912         test/data/proc_drbd83_sync.txt \
1913         test/data/proc_drbd83_sync_want.txt \
1914         test/data/proc_drbd83_sync_krnl2.6.39.txt \
1915         test/data/proc_drbd84.txt \
1916         test/data/proc_drbd84_emptyfirst.txt \
1917         test/data/proc_drbd84_sync.txt \
1918         test/data/proc_meminfo.txt \
1919         test/data/proc_cpuinfo.txt \
1920         test/data/qa-minimal-nodes-instances-only.json \
1921         test/data/sys_drbd_usermode_helper.txt \
1922         test/data/vgreduce-removemissing-2.02.02.txt \
1923         test/data/vgreduce-removemissing-2.02.66-fail.txt \
1924         test/data/vgreduce-removemissing-2.02.66-ok.txt \
1925         test/data/vgs-missing-pvs-2.02.02.txt \
1926         test/data/vgs-missing-pvs-2.02.66.txt \
1927         test/data/xen-xl-list-4.4-crashed-instances.txt \
1928         test/data/xen-xm-info-4.0.1.txt \
1929         test/data/xen-xm-list-4.0.1-dom0-only.txt \
1930         test/data/xen-xm-list-4.0.1-four-instances.txt \
1931         test/data/xen-xm-list-long-4.0.1.txt \
1932         test/data/xen-xm-uptime-4.0.1.txt \
1933         test/py/ganeti-cli.test \
1934         test/py/gnt-cli.test \
1935         test/py/import-export_unittest-helper
1936
1937
1938 python_tests = \
1939         doc/examples/rapi_testutils.py \
1940         test/py/cmdlib/backup_unittest.py \
1941         test/py/cmdlib/cluster_unittest.py \
1942         test/py/cmdlib/cmdlib_unittest.py \
1943         test/py/cmdlib/group_unittest.py \
1944         test/py/cmdlib/instance_unittest.py \
1945         test/py/cmdlib/instance_migration_unittest.py \
1946         test/py/cmdlib/instance_query_unittest.py \
1947         test/py/cmdlib/instance_storage_unittest.py \
1948         test/py/cmdlib/node_unittest.py \
1949         test/py/cmdlib/test_unittest.py \
1950         test/py/cfgupgrade_unittest.py \
1951         test/py/docs_unittest.py \
1952         test/py/ganeti.asyncnotifier_unittest.py \
1953         test/py/ganeti.backend_unittest-runasroot.py \
1954         test/py/ganeti.backend_unittest.py \
1955         test/py/ganeti.bootstrap_unittest.py \
1956         test/py/ganeti.cli_unittest.py \
1957         test/py/ganeti.cli_opts_unittest.py \
1958         test/py/ganeti.client.gnt_cluster_unittest.py \
1959         test/py/ganeti.client.gnt_instance_unittest.py \
1960         test/py/ganeti.client.gnt_job_unittest.py \
1961         test/py/ganeti.compat_unittest.py \
1962         test/py/ganeti.confd.client_unittest.py \
1963         test/py/ganeti.config_unittest.py \
1964         test/py/ganeti.constants_unittest.py \
1965         test/py/ganeti.daemon_unittest.py \
1966         test/py/ganeti.errors_unittest.py \
1967         test/py/ganeti.hooks_unittest.py \
1968         test/py/ganeti.ht_unittest.py \
1969         test/py/ganeti.http_unittest.py \
1970         test/py/ganeti.hypervisor.hv_chroot_unittest.py \
1971         test/py/ganeti.hypervisor.hv_fake_unittest.py \
1972         test/py/ganeti.hypervisor.hv_kvm_unittest.py \
1973         test/py/ganeti.hypervisor.hv_lxc_unittest.py \
1974         test/py/ganeti.hypervisor.hv_xen_unittest.py \
1975         test/py/ganeti.hypervisor_unittest.py \
1976         test/py/ganeti.impexpd_unittest.py \
1977         test/py/ganeti.jqueue_unittest.py \
1978         test/py/ganeti.jstore_unittest.py \
1979         test/py/ganeti.locking_unittest.py \
1980         test/py/ganeti.luxi_unittest.py \
1981         test/py/ganeti.masterd.iallocator_unittest.py \
1982         test/py/ganeti.masterd.instance_unittest.py \
1983         test/py/ganeti.mcpu_unittest.py \
1984         test/py/ganeti.netutils_unittest.py \
1985         test/py/ganeti.objects_unittest.py \
1986         test/py/ganeti.opcodes_unittest.py \
1987         test/py/ganeti.outils_unittest.py \
1988         test/py/ganeti.ovf_unittest.py \
1989         test/py/ganeti.qlang_unittest.py \
1990         test/py/ganeti.query_unittest.py \
1991         test/py/ganeti.rapi.baserlib_unittest.py \
1992         test/py/ganeti.rapi.client_unittest.py \
1993         test/py/ganeti.rapi.resources_unittest.py \
1994         test/py/ganeti.rapi.rlib2_unittest.py \
1995         test/py/ganeti.rapi.testutils_unittest.py \
1996         test/py/ganeti.rpc_unittest.py \
1997         test/py/ganeti.rpc.client_unittest.py \
1998         test/py/ganeti.runtime_unittest.py \
1999         test/py/ganeti.serializer_unittest.py \
2000         test/py/ganeti.server.rapi_unittest.py \
2001         test/py/ganeti.ssconf_unittest.py \
2002         test/py/ganeti.ssh_unittest.py \
2003         test/py/ganeti.storage.bdev_unittest.py \
2004         test/py/ganeti.storage.container_unittest.py \
2005         test/py/ganeti.storage.drbd_unittest.py \
2006         test/py/ganeti.storage.filestorage_unittest.py \
2007         test/py/ganeti.storage.gluster_unittest.py \
2008         test/py/ganeti.tools.burnin_unittest.py \
2009         test/py/ganeti.tools.ensure_dirs_unittest.py \
2010         test/py/ganeti.tools.node_daemon_setup_unittest.py \
2011         test/py/ganeti.tools.prepare_node_join_unittest.py \
2012         test/py/ganeti.uidpool_unittest.py \
2013         test/py/ganeti.utils.algo_unittest.py \
2014         test/py/ganeti.utils.filelock_unittest.py \
2015         test/py/ganeti.utils.hash_unittest.py \
2016         test/py/ganeti.utils.io_unittest-runasroot.py \
2017         test/py/ganeti.utils.io_unittest.py \
2018         test/py/ganeti.utils.log_unittest.py \
2019         test/py/ganeti.utils.lvm_unittest.py \
2020         test/py/ganeti.utils.mlock_unittest.py \
2021         test/py/ganeti.utils.nodesetup_unittest.py \
2022         test/py/ganeti.utils.process_unittest.py \
2023         test/py/ganeti.utils.retry_unittest.py \
2024         test/py/ganeti.utils.security_unittest.py \
2025         test/py/ganeti.utils.storage_unittest.py \
2026         test/py/ganeti.utils.text_unittest.py \
2027         test/py/ganeti.utils.version_unittest.py \
2028         test/py/ganeti.utils.wrapper_unittest.py \
2029         test/py/ganeti.utils.x509_unittest.py \
2030         test/py/ganeti.utils.bitarrays_unittest.py \
2031         test/py/ganeti.utils_unittest.py \
2032         test/py/ganeti.vcluster_unittest.py \
2033         test/py/ganeti.workerpool_unittest.py \
2034         test/py/pycurl_reset_unittest.py \
2035         test/py/qa.qa_config_unittest.py \
2036         test/py/tempfile_fork_unittest.py
2037
2038 python_test_support = \
2039         test/py/__init__.py \
2040         test/py/lockperf.py \
2041         test/py/testutils_ssh.py \
2042         test/py/mocks.py \
2043         test/py/testutils/__init__.py \
2044         test/py/testutils/config_mock.py \
2045         test/py/cmdlib/__init__.py \
2046         test/py/cmdlib/testsupport/__init__.py \
2047         test/py/cmdlib/testsupport/cmdlib_testcase.py \
2048         test/py/cmdlib/testsupport/iallocator_mock.py \
2049         test/py/cmdlib/testsupport/livelock_mock.py \
2050         test/py/cmdlib/testsupport/netutils_mock.py \
2051         test/py/cmdlib/testsupport/pathutils_mock.py \
2052         test/py/cmdlib/testsupport/processor_mock.py \
2053         test/py/cmdlib/testsupport/rpc_runner_mock.py \
2054         test/py/cmdlib/testsupport/ssh_mock.py \
2055         test/py/cmdlib/testsupport/utils_mock.py \
2056         test/py/cmdlib/testsupport/util.py \
2057         test/py/cmdlib/testsupport/wconfd_mock.py
2058
2059 haskell_tests = test/hs/htest
2060
2061 dist_TESTS = \
2062         test/py/check-cert-expired_unittest.bash \
2063         test/py/daemon-util_unittest.bash \
2064         test/py/systemd_unittest.bash \
2065         test/py/ganeti-cleaner_unittest.bash \
2066         test/py/import-export_unittest.bash \
2067         test/py/cli-test.bash \
2068         test/py/bash_completion.bash
2069
2070 if PY_UNIT
2071 dist_TESTS += $(python_tests)
2072 endif
2073
2074 nodist_TESTS =
2075 check_SCRIPTS =
2076
2077 if WANT_HSTESTS
2078 nodist_TESTS += $(haskell_tests)
2079 # test dependency
2080 test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
2081 dist_TESTS += test/hs/offline-test.sh
2082 check_SCRIPTS += \
2083         test/hs/hpc-htools \
2084         test/hs/hpc-mon-collector \
2085         $(HS_BUILT_TEST_HELPERS)
2086 endif
2087
2088 TESTS = $(dist_TESTS) $(nodist_TESTS)
2089
2090 # Environment for all tests
2091 PLAIN_TESTS_ENVIRONMENT = \
2092         PYTHONPATH=.:./test/py \
2093         TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
2094         PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
2095         $(RUN_IN_TEMPDIR)
2096
2097 # Environment for tests run by automake
2098 TESTS_ENVIRONMENT = \
2099         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
2100
2101 all_python_code = \
2102         $(dist_sbin_SCRIPTS) \
2103         $(python_scripts) \
2104         $(pkglib_python_scripts) \
2105         $(nodist_pkglib_python_scripts) \
2106         $(nodist_tools_python_scripts) \
2107         $(pkgpython_PYTHON) \
2108         $(client_PYTHON) \
2109         $(cmdlib_PYTHON) \
2110         $(cmdlib_cluster_PYTHON) \
2111         $(config_PYTHON) \
2112         $(hypervisor_PYTHON) \
2113         $(hypervisor_hv_kvm_PYTHON) \
2114         $(jqueue_PYTHON) \
2115         $(storage_PYTHON) \
2116         $(rapi_PYTHON) \
2117         $(server_PYTHON) \
2118         $(rpc_PYTHON) \
2119         $(rpc_stub_PYTHON) \
2120         $(pytools_PYTHON) \
2121         $(http_PYTHON) \
2122         $(confd_PYTHON) \
2123         $(masterd_PYTHON) \
2124         $(impexpd_PYTHON) \
2125         $(utils_PYTHON) \
2126         $(watcher_PYTHON) \
2127         $(noinst_PYTHON) \
2128         $(qa_scripts)
2129
2130 if PY_UNIT
2131 all_python_code += $(python_tests)
2132 all_python_code += $(python_test_support)
2133 all_python_code += $(python_test_utils)
2134 endif
2135
2136 srclink_files = \
2137         man/footer.rst \
2138         test/py/check-cert-expired_unittest.bash \
2139         test/py/daemon-util_unittest.bash \
2140         test/py/systemd_unittest.bash \
2141         test/py/ganeti-cleaner_unittest.bash \
2142         test/py/import-export_unittest.bash \
2143         test/py/cli-test.bash \
2144         test/py/bash_completion.bash \
2145         test/hs/offline-test.sh \
2146         test/hs/cli-tests-defs.sh \
2147         $(all_python_code) \
2148         $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
2149         $(docinput)
2150
2151 check_python_code = \
2152         $(BUILD_BASH_COMPLETION) \
2153         $(CHECK_IMPORTS) \
2154         $(CHECK_HEADER) \
2155         $(DOCPP) \
2156         $(all_python_code)
2157
2158 lint_python_code = \
2159         ganeti \
2160         ganeti/http/server.py \
2161         $(dist_sbin_SCRIPTS) \
2162         $(python_scripts) \
2163         $(pkglib_python_scripts) \
2164         $(BUILD_BASH_COMPLETION) \
2165         $(CHECK_IMPORTS) \
2166         $(CHECK_HEADER) \
2167         $(DOCPP) \
2168         $(gnt_python_sbin_SCRIPTS) \
2169         $(PYTHON_BOOTSTRAP)
2170
2171 standalone_python_modules = \
2172         lib/rapi/client.py \
2173         tools/ganeti-listrunner
2174
2175 pep8_python_code = \
2176         ganeti \
2177         ganeti/http/server.py \
2178         $(dist_sbin_SCRIPTS) \
2179         $(python_scripts) \
2180         $(pkglib_python_scripts) \
2181         $(BUILD_BASH_COMPLETION) \
2182         $(CHECK_HEADER) \
2183         $(DOCPP) \
2184         $(PYTHON_BOOTSTRAP) \
2185         $(gnt_python_sbin_SCRIPTS) \
2186         qa \
2187         $(python_test_support)
2188         $(python_test_utils)
2189
2190 test/py/daemon-util_unittest.bash: daemons/daemon-util
2191
2192 test/py/systemd_unittest.bash: daemons/daemon-util $(BUILT_EXAMPLES)
2193
2194 test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
2195
2196 test/py/bash_completion.bash: doc/examples/bash_completion-debug
2197
2198 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
2199         sed -f $(REPLACE_VARS_SED) < $< > $@
2200         chmod +x $@
2201
2202 tools/kvm-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED)
2203         sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/kvm-ifup-os:/" < $< > $@
2204         chmod +x $@
2205
2206 tools/xen-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED)
2207         sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/xen-ifup-os:/" < $< > $@
2208         chmod +x $@
2209
2210 tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
2211         sed -f $(REPLACE_VARS_SED) < $< > $@
2212         chmod +x $@
2213
2214 tools/vif-ganeti-metad: tools/vif-ganeti-metad.in $(REPLACE_VARS_SED)
2215         sed -f $(REPLACE_VARS_SED) < $< > $@
2216         chmod +x $@
2217
2218 tools/net-common: tools/net-common.in $(REPLACE_VARS_SED)
2219         sed -f $(REPLACE_VARS_SED) < $< > $@
2220         chmod +x $@
2221
2222 tools/users-setup: Makefile $(userspecs)
2223         set -e; \
2224         { echo '#!/bin/sh'; \
2225           echo 'if [ "x$$1" != "x--yes-do-it" ];'; \
2226           echo 'then echo "This will do the following changes"'; \
2227           $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
2228                      END {if (count == 0) {print "echo + No groups to add"}}' doc/users/groups; \
2229           $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with primary group",$$2} \
2230                                   else {print "echo + Will add user",$$1}; count++}\
2231                      END {if (count == 0) {print "echo + No users to add"}}' doc/users/users; \
2232           $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}' doc/users/groupmemberships; \
2233           echo 'echo'; \
2234           echo 'echo "OK? (y/n)"'; \
2235           echo 'read confirm'; \
2236           echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
2237           echo 'fi'; \
2238           $(AWK) -- '{print "groupadd --system",$$1}' doc/users/groups; \
2239           $(AWK) -- '{if (NF > 1) {print "useradd --system --gid",$$2,$$1} else {print "useradd --system",$$1}}' doc/users/users; \
2240           $(AWK) -- '{print "usermod --append --groups",$$2,$$1}' doc/users/groupmemberships; \
2241         } > $@
2242         chmod +x $@
2243
2244 tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
2245         sed -f $(REPLACE_VARS_SED) < $< > $@
2246         chmod +x $@
2247
2248 daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
2249         sed -f $(REPLACE_VARS_SED) < $< > $@
2250         chmod +x $@
2251
2252 doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
2253         sed -f $(REPLACE_VARS_SED) < $< > $@
2254
2255 doc/examples/bash_completion: BC_ARGS = --compact
2256 doc/examples/bash_completion-debug: BC_ARGS =
2257
2258 doc/examples/bash_completion doc/examples/bash_completion-debug: \
2259         $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
2260         lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
2261         daemons/ganeti-cleaner \
2262         $(GENERATED_FILES) $(HS_GENERATED_FILES)
2263         PYTHONPATH=. $(RUN_IN_TEMPDIR) \
2264           $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
2265
2266 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
2267         lib/build/shell_example_lexer.py \
2268         | $(RUN_IN_TEMPDIR) $(built_python_sources)
2269         @echo "Checking $< for hardcoded paths..."
2270         @if grep -nEf autotools/wrong-hardcoded-paths $<; then \
2271           echo "Man page $< has hardcoded paths (see above)!" 1>&2 ; \
2272           exit 1; \
2273         fi
2274         set -e ; \
2275         trap 'echo auto-removing $@; rm $@' EXIT; \
2276         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
2277         $(CHECK_MAN_REFERENCES) $@; \
2278         trap - EXIT
2279
2280 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.rst
2281         @test -n "$(PANDOC)" || \
2282           { echo 'pandoc' not found during configure; exit 1; }
2283         set -o pipefail -e; \
2284         trap 'echo auto-removing $@; rm $@' EXIT; \
2285         $(PANDOC) -s -f rst -t man $< man/footer.rst | \
2286           sed -e 's/\\@/@/g' > $@; \
2287         if test -n "$(MAN_HAS_WARNINGS)"; then LC_ALL=en_US.UTF-8 $(CHECK_MAN_WARNINGS) $@; fi; \
2288         $(CHECK_MAN_DASHES) $@; \
2289         trap - EXIT
2290
2291 man/%.html.in: man/%.gen man/footer.rst
2292         @test -n "$(PANDOC)" || \
2293           { echo 'pandoc' not found during configure; exit 1; }
2294         set -o pipefail ; \
2295         $(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
2296           sed -e 's/\\@/@/g' > $@
2297
2298 man/%: man/%.in  $(REPLACE_VARS_SED)
2299         sed -f $(REPLACE_VARS_SED) < $< > $@
2300
2301 epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
2302         sed -f $(REPLACE_VARS_SED) < $< > $@
2303
2304 vcs-version:
2305         if test -d .git; then \
2306           git describe | tr '"' - > $@; \
2307         elif test ! -f $@ ; then \
2308           echo "Cannot auto-generate $@ file"; exit 1; \
2309         fi
2310
2311 .PHONY: clean-vcs-version
2312 clean-vcs-version:
2313         rm -f vcs-version
2314
2315 .PHONY: regen-vcs-version
2316 regen-vcs-version:
2317         @set -e; \
2318         cd $(srcdir); \
2319         if test -d .git; then \
2320           T=`mktemp` ; trap 'rm -f $$T' EXIT; \
2321           git describe > $$T; \
2322           if ! cmp --quiet $$T vcs-version; then \
2323             mv $$T vcs-version; \
2324           fi; \
2325         fi
2326
2327 src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
2328         vcs-version $(built_base_sources)
2329         set -e; \
2330         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
2331         sed -e 's"%ver%"'"$$VCSVER"'"' < $< > $@
2332
2333 src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
2334                                    src/Ganeti/Constants.hs \
2335                                  | stamp-directories
2336         @echo Generating $@
2337         @set -e; \
2338 ## Extract constant names from 'Constants.hs' by extracting the left
2339 ## side of all lines containing an equal sign (i.e., '=') and
2340 ## prepending the apostrophe sign (i.e., "'").
2341 ##
2342 ## For example, the constant
2343 ##   adminstDown = ...
2344 ## becomes
2345 ##   'adminstDown
2346         NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
2347                  sed -n -e "/=/ s/\(.*\) =.*/    '\1:/g p"); \
2348         m4 -DPY_CONSTANT_NAMES="$$NAMES" \
2349                 $(abs_top_srcdir)/src/Ganeti/Hs2Py/ListConstants.hs.in > $@
2350
2351 src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
2352         hsc2hs -o $@ $<
2353
2354 test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
2355         $(built_base_sources)
2356         set -e; \
2357         { cat $< ; \
2358           echo ; \
2359           for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
2360             echo "import $$name ()" ; \
2361           done ; \
2362         } > $@
2363
2364 lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
2365         cat $(abs_top_srcdir)/lib/_constants.py.in > $@
2366         src/hs2py --constants >> $@
2367
2368 lib/constants.py: lib/_constants.py
2369
2370 src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
2371                | $(built_base_sources)
2372         @echo "m4 ... >" $@
2373         @m4 -DPACKAGE_VERSION="$(PACKAGE_VERSION)" \
2374             -DVERSION_MAJOR="$(VERSION_MAJOR)" \
2375             -DVERSION_MINOR="$(VERSION_MINOR)" \
2376             -DVERSION_REVISION="$(VERSION_REVISION)" \
2377             -DVERSION_SUFFIX="$(VERSION_SUFFIX)" \
2378             -DVERSION_FULL="$(VERSION_FULL)" \
2379             -DDIRVERSION="$(DIRVERSION)" \
2380             -DLOCALSTATEDIR="$(localstatedir)" \
2381             -DSYSCONFDIR="$(sysconfdir)" \
2382             -DSSH_CONFIG_DIR="$(SSH_CONFIG_DIR)" \
2383             -DSSH_LOGIN_USER="$(SSH_LOGIN_USER)" \
2384             -DSSH_CONSOLE_USER="$(SSH_CONSOLE_USER)" \
2385             -DEXPORT_DIR="$(EXPORT_DIR)" \
2386             -DBACKUP_DIR="$(backup_dir)" \
2387             -DOS_SEARCH_PATH="\"$(OS_SEARCH_PATH)\"" \
2388             -DES_SEARCH_PATH="\"$(ES_SEARCH_PATH)\"" \
2389             -DXEN_BOOTLOADER="$(XEN_BOOTLOADER)" \
2390             -DXEN_CONFIG_DIR="$(XEN_CONFIG_DIR)" \
2391             -DXEN_KERNEL="$(XEN_KERNEL)" \
2392             -DXEN_INITRD="$(XEN_INITRD)" \
2393             -DKVM_KERNEL="$(KVM_KERNEL)" \
2394             -DSHARED_FILE_STORAGE_DIR="$(SHARED_FILE_STORAGE_DIR)" \
2395             -DIALLOCATOR_SEARCH_PATH="\"$(IALLOCATOR_SEARCH_PATH)\"" \
2396             -DDEFAULT_BRIDGE="$(DEFAULT_BRIDGE)" \
2397             -DDEFAULT_VG="$(DEFAULT_VG)" \
2398             -DKVM_PATH="$(KVM_PATH)" \
2399             -DIP_PATH="$(IP_PATH)" \
2400             -DSOCAT_PATH="$(SOCAT)" \
2401             -DPYTHON_PATH="$(PYTHON)" \
2402             -DSOCAT_USE_ESCAPE="$(SOCAT_USE_ESCAPE)" \
2403             -DSOCAT_USE_COMPRESS="$(SOCAT_USE_COMPRESS)" \
2404             -DLVM_STRIPECOUNT="$(LVM_STRIPECOUNT)" \
2405             -DTOOLSDIR="$(libdir)/ganeti/tools" \
2406             -DGNT_SCRIPTS="$(foreach i,$(notdir $(gnt_scripts)),\"$(i)\":)" \
2407             -DHS_HTOOLS_PROGS="$(foreach i,$(HS_HTOOLS_PROGS),\"$(i)\":)" \
2408             -DPKGLIBDIR="$(libdir)/ganeti" \
2409             -DSHAREDIR="$(prefix)/share/ganeti" \
2410             -DVERSIONEDSHAREDIR="$(versionedsharedir)" \
2411             -DDRBD_BARRIERS="$(DRBD_BARRIERS)" \
2412             -DDRBD_NO_META_FLUSH="$(DRBD_NO_META_FLUSH)" \
2413             -DSYSLOG_USAGE="$(SYSLOG_USAGE)" \
2414             -DDAEMONS_GROUP="$(DAEMONS_GROUP)" \
2415             -DADMIN_GROUP="$(ADMIN_GROUP)" \
2416             -DMASTERD_USER="$(MASTERD_USER)" \
2417             -DMASTERD_GROUP="$(MASTERD_GROUP)" \
2418             -DMETAD_USER="$(METAD_USER)" \
2419             -DMETAD_GROUP="$(METAD_GROUP)" \
2420             -DRAPI_USER="$(RAPI_USER)" \
2421             -DRAPI_GROUP="$(RAPI_GROUP)" \
2422             -DCONFD_USER="$(CONFD_USER)" \
2423             -DCONFD_GROUP="$(CONFD_GROUP)" \
2424             -DWCONFD_USER="$(WCONFD_USER)" \
2425             -DWCONFD_GROUP="$(WCONFD_GROUP)" \
2426             -DKVMD_USER="$(KVMD_USER)" \
2427             -DKVMD_GROUP="$(KVMD_GROUP)" \
2428             -DLUXID_USER="$(LUXID_USER)" \
2429             -DLUXID_GROUP="$(LUXID_GROUP)" \
2430             -DNODED_USER="$(NODED_USER)" \
2431             -DNODED_GROUP="$(NODED_GROUP)" \
2432             -DMOND_USER="$(MOND_USER)" \
2433             -DMOND_GROUP="$(MOND_GROUP)" \
2434             -DMETAD_USER="$(METAD_USER)" \
2435             -DMETAD_GROUP="$(METAD_GROUP)" \
2436             -DDISK_SEPARATOR="$(DISK_SEPARATOR)" \
2437             -DQEMUIMG_PATH="$(QEMUIMG_PATH)" \
2438             -DXEN_CMD="$(XEN_CMD)" \
2439             -DENABLE_RESTRICTED_COMMANDS="$(ENABLE_RESTRICTED_COMMANDS)" \
2440             -DENABLE_METADATA="$(ENABLE_METADATA)" \
2441             -DENABLE_MOND="$(ENABLE_MOND)" \
2442             -DHAS_GNU_LN="$(HAS_GNU_LN)" \
2443             -DMAN_PAGES="$$(for i in $(notdir $(man_MANS)); do \
2444                             echo -n "$$i" | sed -re 's/^(.*)\.([0-9]+)$$/("\1",\2):/g'; \
2445                             done)" \
2446             -DAF_INET4="$$(PYTHONPATH=. $(PYTHON) $(PRINT_PY_CONSTANTS) AF_INET4)" \
2447             -DAF_INET6="$$(PYTHONPATH=. $(PYTHON) $(PRINT_PY_CONSTANTS) AF_INET6)" \
2448         $(abs_top_srcdir)/src/AutoConf.hs.in > $@
2449
2450 lib/_vcsversion.py: Makefile vcs-version | stamp-directories
2451         set -e; \
2452         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
2453         { echo '# This file is automatically generated, do not edit!'; \
2454           echo '#'; \
2455           echo ''; \
2456           echo '"""Build-time VCS version number for Ganeti.'; \
2457           echo '';\
2458           echo 'This file is autogenerated by the build process.'; \
2459           echo 'For any changes you need to re-run ./configure (and'; \
2460           echo 'not edit by hand).'; \
2461           echo ''; \
2462           echo '"""'; \
2463           echo ''; \
2464           echo '# pylint: disable=C0301,C0324'; \
2465           echo '# because this is autogenerated, we do not want'; \
2466           echo '# style warnings' ; \
2467           echo ''; \
2468           echo "VCS_VERSION = '$$VCSVER'"; \
2469         } > $@
2470
2471 lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
2472                 lib/opcodes.py.in_after | stamp-directories
2473         cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
2474         src/hs2py --opcodes >> $@
2475         cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
2476
2477 # Generating the RPC wrappers depends on many things, so make sure
2478 # it's built at the end of the built sources
2479 lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC) | $(built_base_sources) $(built_python_base_sources)
2480         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
2481
2482 if ENABLE_METADATA
2483 lib/rpc/stub/metad.py: Makefile src/hs2py | stamp-directories
2484         src/hs2py --metad-rpc > $@
2485 endif
2486
2487 lib/rpc/stub/wconfd.py: Makefile src/hs2py | stamp-directories
2488         src/hs2py --wconfd-rpc > $@
2489
2490 $(SHELL_ENV_INIT): Makefile stamp-directories
2491         set -e; \
2492         { echo '# Allow overriding for tests'; \
2493           echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
2494           echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
2495           echo; \
2496           echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
2497           echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
2498           echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
2499           echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
2500           echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
2501         } > $@
2502
2503 ## Writes sed script to replace placeholders with build-time values. The
2504 ## additional quotes after the first @ sign are necessary to stop configure
2505 ## from replacing those values as well.
2506 $(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
2507         set -e; \
2508         { echo 's#@''PREFIX@#$(prefix)#g'; \
2509           echo 's#@''SYSCONFDIR@#$(sysconfdir)#g'; \
2510           echo 's#@''LOCALSTATEDIR@#$(localstatedir)#g'; \
2511           echo 's#@''BINDIR@#$(BINDIR)#g'; \
2512           echo 's#@''SBINDIR@#$(SBINDIR)#g'; \
2513           echo 's#@''LIBDIR@#$(libdir)#g'; \
2514           echo 's#@''GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
2515           echo 's#@''CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
2516           echo 's#@''CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
2517           echo 's#@''CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
2518           echo 's#@''CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
2519           echo 's#@''CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
2520           echo 's#@''RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
2521           echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
2522           echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
2523           echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
2524           echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
2525           echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
2526           echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
2527           echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
2528           echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
2529           echo 's#@''GNTMETADUSER@#$(METAD_USER)#g'; \
2530           echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
2531           echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
2532           echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
2533           echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
2534           echo 's#@''GNTWCONFDGROUP@#$(CONFD_GROUP)#g'; \
2535           echo 's#@''GNTLUXIDGROUP@#$(LUXID_GROUP)#g'; \
2536           echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
2537           echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \
2538           echo 's#@''GNTMETADGROUP@#$(METAD_GROUP)#g'; \
2539           echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
2540           echo 's#@''CUSTOM_ENABLE_MOND@#$(ENABLE_MOND)#g'; \
2541           echo 's#@''MODULES@#$(strip $(lint_python_code))#g'; \
2542           echo 's#@''XEN_CONFIG_DIR@#$(XEN_CONFIG_DIR)#g'; \
2543           echo; \
2544           echo '/^@SHELL_ENV_INIT@$$/ {'; \
2545           echo '  r $(SHELL_ENV_INIT)'; \
2546           echo '  d'; \
2547           echo '}'; \
2548         } > $@
2549
2550 # Using deferred evaluation
2551 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
2552 daemons/ganeti-watcher: MODULE = ganeti.watcher
2553 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
2554 tools/burnin: MODULE = ganeti.tools.burnin
2555 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
2556 tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
2557 tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
2558 tools/ssh-update: MODULE = ganeti.tools.ssh_update
2559 tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
2560 tools/ssl-update: MODULE = ganeti.tools.ssl_update
2561 $(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
2562
2563 $(PYTHON_BOOTSTRAP) $(gnt_scripts) $(gnt_python_sbin_SCRIPTS): Makefile | stamp-directories
2564         test -n "$(MODULE)" || { echo Missing module; exit 1; }
2565         set -e; \
2566         { echo '#!${PYTHON}'; \
2567           echo '# This file is automatically generated, do not edit!'; \
2568           echo "# Edit $(MODULE) instead."; \
2569           echo; \
2570           echo '"""Bootstrap script for L{$(MODULE)}"""'; \
2571           echo; \
2572           echo '# pylint: disable=C0103'; \
2573           echo '# C0103: Invalid name'; \
2574           echo; \
2575           echo 'import sys'; \
2576           echo 'import $(MODULE) as main'; \
2577           echo; \
2578           echo '# Temporarily alias commands until bash completion'; \
2579           echo '# generator is changed'; \
2580           echo 'if hasattr(main, "commands"):'; \
2581           echo '  commands = main.commands # pylint: disable=E1101'; \
2582           echo 'if hasattr(main, "aliases"):'; \
2583           echo '  aliases = main.aliases # pylint: disable=E1101'; \
2584           echo; \
2585           echo 'if __name__ == "__main__":'; \
2586           echo '  sys.exit(main.Main())'; \
2587         } > $@
2588         chmod u+x $@
2589
2590 $(HS_BUILT_TEST_HELPERS): Makefile
2591         @test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2592         set -e; \
2593         { echo '#!/bin/sh'; \
2594           echo '# This file is automatically generated, do not edit!'; \
2595           echo "# Edit Makefile.am instead."; \
2596           echo; \
2597           echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2598         } > $@
2599         chmod u+x $@
2600
2601 stamp-directories: Makefile
2602         $(MAKE) $(AM_MAKEFLAGS) ganeti
2603         @mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2604         touch $@
2605
2606 # We need to create symlinks because "make distcheck" will not install Python
2607 # files when building.
2608 stamp-srclinks: Makefile | stamp-directories
2609         set -e; \
2610         for i in $(srclink_files); do \
2611           if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2612             $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2613           fi; \
2614         done
2615         touch $@
2616
2617 .PHONY: ganeti
2618 ganeti:
2619         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2620
2621 .PHONY: check-dirs
2622 check-dirs: $(GENERATED_FILES)
2623         @set -e; \
2624         find . -type d \( -name . -o -name .git -prune -o -print \) | { \
2625           error=; \
2626           while read dir; do \
2627             case "$$dir" in \
2628               $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
2629               *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
2630             esac; \
2631           done; \
2632           for dir in $(DIRS); do \
2633             if ! test -d "$$dir"; then \
2634               echo "Directory $$dir listed in DIRS does not exist" >&2; \
2635               error=1; \
2636             fi \
2637           done; \
2638           test -z "$$error"; \
2639         }
2640
2641 .PHONY: check-news
2642 check-news:
2643         RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2644
2645 .PHONY: check-local
2646 check-local: check-dirs check-news $(GENERATED_FILES)
2647         $(CHECK_PYTHON_CODE) $(check_python_code)
2648         PYTHONPATH=. $(CHECK_HEADER) \
2649             $(filter-out $(GENERATED_FILES),$(check_python_code))
2650         $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
2651         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
2652         error= ; \
2653         if [ "x`echo $(VERSION_SUFFIX)|grep 'alpha'`" == "x" ]; then \
2654           expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
2655           if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
2656             echo "Incorrect version in README, expected $$expver" >&2; \
2657             error=1; \
2658           fi; \
2659           for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
2660               doc/security.rst; do \
2661             if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
2662               "Documents Ganeti version $$expver"; then \
2663               echo "Incorrect version in $$file, expected $$expver" >&2; \
2664               error=1; \
2665             fi; \
2666           done; \
2667           if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
2668             echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
2669             error=1; \
2670           fi; \
2671           if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
2672             ".. Last updated for Ganeti $$expver"; then \
2673             echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
2674             error=1; \
2675           fi; \
2676         fi; \
2677         for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
2678           if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
2679             echo "Longest line in $$file is longer than 80 characters" >&2; \
2680             error=1; \
2681           fi; \
2682         done; \
2683         test -z "$$error"
2684
2685 .PHONY: hs-test-%
2686 hs-test-%: test/hs/htest
2687         @rm -f htest.tix
2688         test/hs/htest -t $*
2689
2690 .PHONY: hs-tests
2691 hs-tests: test/hs/htest
2692         @rm -f htest.tix
2693         ./test/hs/htest
2694
2695 .PHONY: py-tests
2696 py-tests: $(python_tests) ganeti $(built_python_sources)
2697         error=; \
2698         for file in $(python_tests); \
2699           do if ! $(TESTS_ENVIRONMENT) $$file; then error=1; fi; \
2700         done; \
2701         test -z "$$error"
2702
2703 .PHONY: hs-shell-%
2704 hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2705             $(HS_BUILT_TEST_HELPERS)
2706         @rm -f hpc-htools.tix hpc-mon-collector.tix
2707         HBINARY="./test/hs/hpc-htools" \
2708         SHELLTESTARGS=$(SHELLTESTARGS) \
2709         ./test/hs/offline-test.sh $*
2710
2711 .PHONY: hs-shell
2712 hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
2713         @rm -f hpc-htools.tix hpc-mon-collector.tix
2714         HBINARY="./test/hs/hpc-htools" \
2715         SHELLTESTARGS=$(SHELLTESTARGS) \
2716         ./test/hs/offline-test.sh
2717
2718 .PHONY: hs-check
2719 hs-check: hs-tests hs-shell
2720
2721 # E111: indentation is not a multiple of four
2722 # E121: continuation line indentation is not a multiple of four
2723 #       (since our indent level is not 4)
2724 # E125: continuation line does not distinguish itself from next logical line
2725 #       (since our indent level is not 4)
2726 # E123: closing bracket does not match indentation of opening bracket's line
2727 # E127: continuation line over-indented for visual indent
2728 #       (since our indent level is not 4)
2729 # note: do NOT add E128 here; it's a valid style error in most cases!
2730 # I've seen real errors, but also some cases were we indent wrongly
2731 # due to line length; try to rework the cases where it is triggered,
2732 # instead of silencing it
2733 # E261: at least two spaces before inline comment
2734 # E501: line too long (80 characters)
2735 PEP8_IGNORE = E111,E121,E123,E125,E127,E261,E501
2736
2737 # For excluding pep8 expects filenames only, not whole paths
2738 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(built_python_sources))))
2739
2740 # A space-separated list of pylint warnings to completely ignore:
2741 # I0013 = disable warnings for ignoring whole files
2742 LINT_DISABLE = I0013
2743 # Additional pylint options
2744 LINT_OPTS =
2745 # The combined set of pylint options
2746 LINT_OPTS_ALL = $(LINT_OPTS) \
2747   $(addprefix --disable=,$(LINT_DISABLE))
2748
2749 LINT_TARGETS = pylint pylint-qa pylint-test
2750 if HAS_PEP8
2751 LINT_TARGETS += pep8
2752 endif
2753 if HAS_HLINT
2754 LINT_TARGETS += hlint
2755 endif
2756
2757 .PHONY: lint
2758 lint: $(LINT_TARGETS)
2759
2760 .PHONY: pylint
2761 pylint: $(GENERATED_FILES)
2762         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2763         $(PYLINT) $(LINT_OPTS_ALL) $(lint_python_code)
2764
2765 .PHONY: pylint-qa
2766 pylint-qa: $(GENERATED_FILES)
2767         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2768         cd $(top_srcdir)/qa && \
2769           PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS_ALL) \
2770                 --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2771 # FIXME: lint all test code, not just the newly added test support
2772 pylint-test: $(GENERATED_FILES)
2773         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2774         cd $(top_srcdir) && \
2775                 PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS_ALL) \
2776                 --rcfile=pylintrc-test  $(python_test_support) $(python_test_utils)
2777
2778 .PHONY: pep8
2779 pep8: $(GENERATED_FILES)
2780         @test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2781         $(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2782           --repeat $(pep8_python_code)
2783
2784 # FIXME: remove ignore "Use void" when GHC 6.x is deprecated
2785 HLINT_EXCLUDES = src/Ganeti/THH.hs test/hs/hpc-htools.hs
2786 .PHONY: hlint
2787 hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
2788         @test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
2789         @rm -f doc/hs-lint.html
2790         if tty -s; then C="-c"; else C=""; fi; \
2791         $(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
2792           --ignore "Use first" \
2793           --ignore "Use &&&" \
2794           --ignore "Use &&" \
2795           --ignore "Use ||" \
2796           --ignore "Use void" \
2797           --ignore "Reduce duplication" \
2798           --ignore "Use import/export shortcut" \
2799           --hint src/lint-hints \
2800           --cpp-file=$(HASKELL_PACKAGE_VERSIONS_FILE) \
2801           $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
2802         @if [ ! -f doc/hs-lint.html ]; then \
2803           echo "All good" > doc/hs-lint.html; \
2804         fi
2805
2806 # a dist hook rule for updating the vcs-version file; this is
2807 # hardcoded due to where it needs to build the file...
2808 dist-hook:
2809         $(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2810         rm -f $(top_distdir)/vcs-version
2811         cp -p $(srcdir)/vcs-version $(top_distdir)
2812
2813 # a distcheck hook rule for catching revision control directories
2814 distcheck-hook:
2815         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
2816           echo "Found revision control files in final archive." 1>&2; \
2817           exit 1; \
2818         fi
2819         if find $(top_distdir) -name '*.py[co]' | grep .; then \
2820           echo "Found Python byte code in final archive." 1>&2; \
2821           exit 1; \
2822         fi
2823         if find $(top_distdir) -name '*~' | grep .; then \
2824           echo "Found backup files in final archive." 1>&2; \
2825           exit 1; \
2826         fi
2827 # Empty files or directories should not be distributed. They can cause
2828 # unnecessary warnings for packagers. Directories used by automake during
2829 # distcheck must be excluded.
2830         if find $(top_distdir) -empty -and -not \( \
2831             -path $(top_distdir)/_build -or \
2832             -path $(top_distdir)/_inst \) | grep .; then \
2833           echo "Found empty files or directories in final archive." 1>&2; \
2834           exit 1; \
2835         fi
2836         if test -e $(top_distdir)/doc/man-html; then \
2837           echo "Found documentation including man pages in final archive" >&2; \
2838           exit 1; \
2839         fi
2840
2841 # Backwards compatible distcheck-release target
2842 distcheck-release: distcheck
2843
2844 distrebuildcheck: dist
2845         set -e; \
2846         builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2847         trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2848         cd $$builddir; \
2849         tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2850         cd $(distdir); \
2851         ./configure; \
2852         $(MAKE) maintainer-clean; \
2853         cp $(abs_srcdir)/vcs-version .; \
2854         ./configure; \
2855         $(MAKE) $(AM_MAKEFLAGS)
2856
2857 dist-release: dist
2858         set -e; \
2859         for i in $(DIST_ARCHIVES); do \
2860           echo -n "Checking $$i ... "; \
2861           autotools/check-tar < $$i; \
2862           echo OK; \
2863         done
2864
2865 install-exec-local:
2866         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
2867           "$(DESTDIR)${localstatedir}/log/ganeti" \
2868           "$(DESTDIR)${localstatedir}/run/ganeti"
2869         for dir in $(SYMLINK_TARGET_DIRS); do \
2870           @mkdir_p@  $(DESTDIR)$$dir; \
2871         done
2872         $(LN_S) -f $(sysconfdir)/ganeti/lib $(DESTDIR)$(defaultversiondir)
2873         $(LN_S) -f $(sysconfdir)/ganeti/share $(DESTDIR)$(defaultversionedsharedir)
2874         for prog in $(HS_BIN_ROLES); do \
2875           $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
2876         done
2877         $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
2878         for prog in $(all_sbin_scripts); do \
2879           $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2880         done
2881         for prog in $(gnt_scripts_basenames); do \
2882           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2883         done
2884         for prog in $(pkglib_python_basenames); do \
2885           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2886         done
2887         for prog in $(tools_python_basenames); do \
2888           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2889         done
2890         for prog in $(tools_basenames); do \
2891           $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2892         done
2893         if ! test -n '$(ENABLE_MANPAGES)'; then \
2894           for man in $(manfullpath); do \
2895             $(LN_S) -f $(defaultversionedsharedir)/root$(MANDIR)/$$man $(DESTDIR)$(MANDIR)/$$man; \
2896           done; \
2897         fi
2898         for prog in $(myexeclib_scripts_basenames); do \
2899           $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2900         done
2901 if INSTALL_SYMLINKS
2902         $(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
2903         $(LN_S) -f $(versiondir) $(DESTDIR)$(sysconfdir)/ganeti/lib
2904 endif
2905
2906 .PHONY: apidoc
2907 if WANT_HSAPIDOC
2908 apidoc: py-apidoc hs-apidoc
2909 else
2910 apidoc: py-apidoc
2911 endif
2912
2913 .PHONY: py-apidoc
2914 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2915         env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2916         $(RUN_IN_TEMPDIR) epydoc -v \
2917           --conf $(CURDIR)/epydoc.conf \
2918           --output $(CURDIR)/$(APIDOC_PY_DIR)
2919
2920 .PHONY: hs-apidoc
2921 hs-apidoc: $(APIDOC_HS_DIR)/index.html
2922
2923 $(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
2924         @test -n "$(HSCOLOUR)" || \
2925             { echo 'HsColour' not found during configure; exit 1; }
2926         @test -n "$(HADDOCK)" || \
2927             { echo 'haddock' not found during configure; exit 1; }
2928         rm -rf $(APIDOC_HS_DIR)/*
2929         for i in $(ALL_APIDOC_HS_DIRS); do \
2930           @mkdir_p@ $$i; \
2931           $(HSCOLOUR) -print-css > $$i/hscolour.css; \
2932         done
2933         set -e ; \
2934         export LC_ALL=en_US.UTF-8; \
2935         OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
2936         OPTGHC="$$OPTGHC --optghc=-optP-include --optghc=-optP$(HASKELL_PACKAGE_VERSIONS_FILE)"; \
2937         for file in $(HS_LIBTESTBUILT_SRCS); do \
2938           f_nosrc=$${file##src/}; \
2939           f_notst=$${f_nosrc##test/hs/}; \
2940           f_html=$${f_notst%%.hs}.html; \
2941           $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
2942         done ; \
2943         $(HADDOCK) --odir $(APIDOC_HS_DIR) --html --hoogle --ignore-all-exports -w \
2944           -t ganeti -p src/haddock-prologue \
2945           --source-module="%{MODULE/.//}.html" \
2946           --source-entity="%{MODULE/.//}.html#%{NAME}" \
2947           $$OPTGHC \
2948           $(HS_LIBTESTBUILT_SRCS)
2949
2950 .PHONY: TAGS
2951 TAGS: $(GENERATED_FILES)
2952         rm -f TAGS
2953         $(GHC) -e ":etags TAGS_hs" -v0 \
2954           $(filter-out -O -Werror,$(HFLAGS)) \
2955                 -osuf tags.o \
2956                 -hisuf tags.hi \
2957     -lcurl \
2958           $(HS_LIBTEST_SRCS)
2959         find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2960           -path './daemons/ganeti-*' -o -path './tools/*' -o \
2961           -path './qa/*.py' | \
2962           etags --etags-include=TAGS_hs -L -
2963
2964 .PHONY: coverage
2965
2966 COVERAGE_TESTS=
2967 if HS_UNIT
2968 COVERAGE_TESTS += hs-coverage
2969 endif
2970 if PY_UNIT
2971 COVERAGE_TESTS += py-coverage
2972 endif
2973
2974 coverage: $(COVERAGE_TESTS)
2975
2976 test/py/docs_unittest.py: $(gnt_scripts)
2977
2978 .PHONY: py-coverage
2979 py-coverage: $(GENERATED_FILES) $(python_tests)
2980         @test -n "$(PYCOVERAGE)" || \
2981             { echo 'python-coverage' not found during configure; exit 1; }
2982         set -e; \
2983         COVERAGE=$(PYCOVERAGE) \
2984         COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2985         TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2986         HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2987         $(PLAIN_TESTS_ENVIRONMENT) \
2988         $(abs_top_srcdir)/autotools/gen-py-coverage \
2989         $(python_tests)
2990
2991 .PHONY: hs-coverage
2992 hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2993         rm -f *.tix
2994         $(MAKE) $(AM_MAKEFLAGS) hs-check
2995         @mkdir_p@ $(COVERAGE_HS_DIR)
2996         hpc sum --union $(HPCEXCL) \
2997           htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2998         hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2999         hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
3000         $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
3001
3002 # Special "kind-of-QA" target for htools, needs special setup (all
3003 # tools compiled with -fhpc)
3004 .PHONY: live-test
3005 live-test: all
3006         set -e ; \
3007         cd src; \
3008         rm -f .hpc; $(LN_S) ../.hpc .hpc; \
3009         rm -f *.tix *.mix; \
3010         ./live-test.sh; \
3011         hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
3012           --output=live-test.tix ; \
3013         @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
3014         hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
3015           --srcdir=.. $(HPCEXCL) ; \
3016         hpc report --srcdir=.. live-test $(HPCEXCL)
3017
3018 commit-check: autotools-check distcheck lint apidoc
3019
3020 autotools-check:
3021         TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
3022   $(abs_top_srcdir)/test/autotools/*-*.test \
3023   -- --hide-successes
3024
3025 .PHONY: gitignore-check
3026 gitignore-check:
3027         @if [ -n "`git status --short`" ]; then \
3028           echo "Git status is not clean!" 1>&2 ; \
3029           git status --short; \
3030           exit 1; \
3031         fi
3032
3033 # target to rebuild all man pages (both groff and html output)
3034 .PHONY: man
3035 man: $(man_MANS) $(manhtml)
3036
3037 CABAL_EXECUTABLES = $(HS_DEFAULT_PROGS)
3038 CABAL_EXECUTABLES_HS = $(patsubst %,%.hs,$(CABAL_EXECUTABLES))
3039 CABAL_EXECUTABLES_APPS_STAMPS = $(patsubst src/%,apps/%.hs.stamp,$(patsubst test/hs/%,apps/%.hs.stamp,$(CABAL_EXECUTABLES)))
3040
3041 # Executable symlinks
3042 apps/%.hs.stamp: Makefile
3043         mkdir -p apps
3044         rm -f $(basename $@)
3045         ln -s ../$(filter %/$(basename $(notdir $@)),$(CABAL_EXECUTABLES_HS)) $(basename $@)
3046         touch $@
3047
3048 # Builds the cabal file
3049 ganeti.cabal: cabal/ganeti.template.cabal Makefile cabal/cabal-from-modules.py $(CABAL_EXECUTABLES_APPS_STAMPS)
3050         @echo $(subst /,.,$(patsubst %.hs,%,$(patsubst test/hs/%,%,$(patsubst src/%,%,$(HS_SRCS))))) \
3051           | python $(abs_top_srcdir)/cabal/cabal-from-modules.py $(abs_top_srcdir)/cabal/ganeti.template.cabal > $@
3052
3053         for p in $(CABAL_EXECUTABLES); do \
3054           echo                                   >> $@; \
3055           echo "executable `basename $$p`"       >> $@; \
3056           echo "  hs-source-dirs: apps"          >> $@; \
3057           echo "  main-is: `basename $$p`.hs"    >> $@; \
3058           echo "  default-language: Haskell2010" >> $@; \
3059           echo "  build-depends:"                >> $@; \
3060           echo "      base"                      >> $@; \
3061           echo "    , ganeti"                    >> $@; \
3062           if [ $$p == test/hs/htest ]; then \
3063             echo "    , hslogger"                  >> $@; \
3064             echo "    , test-framework"            >> $@; \
3065           elif [ $$p == src/rpc-test ]; then \
3066             echo "    , json"                      >> $@; \
3067           fi \
3068         done
3069
3070 # Target that builds all binaries (including those that are not
3071 # rebuilt except when running the tests)
3072 .PHONY: really-all
3073 really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
3074
3075 # we don't need the ancient implicit rules:
3076 %: %,v
3077 %: RCS/%,v
3078 %: RCS/%
3079 %: s.%
3080 %: SCCS/s.%
3081
3082 -include ./Makefile.local
3083
3084 # support inspecting the value of a make variable
3085
3086 print-%:
3087         @echo $($*)
3088
3089 # vim: set noet :