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