Bump version suffix to 2.16.0 beta2
[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 # internal extra flags (used for test/hs/htest mainly)
861 HEXTRA_INT =
862 # combination of HEXTRA and HEXTRA_CONFIGURE
863 HEXTRA_COMBINED = $(HEXTRA) $(HEXTRA_CONFIGURE)
864 # exclude options for coverage reports
865 HPCEXCL = --exclude Main \
866         --exclude Ganeti.Constants \
867         --exclude Ganeti.HTools.QC \
868         --exclude Ganeti.THH \
869         --exclude Ganeti.Version \
870         --exclude Test.Ganeti.Attoparsec \
871         --exclude Test.Ganeti.TestCommon \
872         --exclude Test.Ganeti.TestHTools \
873         --exclude Test.Ganeti.TestHelper \
874         --exclude Test.Ganeti.TestImports \
875         $(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
876
877 HS_LIB_SRCS = \
878         src/Ganeti/BasicTypes.hs \
879         src/Ganeti/Codec.hs \
880         src/Ganeti/Common.hs \
881         src/Ganeti/Compat.hs \
882         src/Ganeti/Confd/Client.hs \
883         src/Ganeti/Confd/ClientFunctions.hs \
884         src/Ganeti/Confd/Server.hs \
885         src/Ganeti/Confd/Types.hs \
886         src/Ganeti/Confd/Utils.hs \
887         src/Ganeti/Config.hs \
888         src/Ganeti/ConfigReader.hs \
889         src/Ganeti/Constants.hs \
890         src/Ganeti/ConstantUtils.hs \
891         src/Ganeti/Cpu/LoadParser.hs \
892         src/Ganeti/Cpu/Types.hs \
893         src/Ganeti/Curl/Multi.hs \
894         src/Ganeti/Daemon.hs \
895         src/Ganeti/Daemon/Utils.hs \
896         src/Ganeti/DataCollectors.hs \
897         src/Ganeti/DataCollectors/CLI.hs \
898         src/Ganeti/DataCollectors/CPUload.hs \
899         src/Ganeti/DataCollectors/Diskstats.hs \
900         src/Ganeti/DataCollectors/Drbd.hs \
901         src/Ganeti/DataCollectors/InstStatus.hs \
902         src/Ganeti/DataCollectors/InstStatusTypes.hs \
903         src/Ganeti/DataCollectors/Lv.hs \
904         src/Ganeti/DataCollectors/Program.hs \
905         src/Ganeti/DataCollectors/Types.hs \
906         src/Ganeti/DataCollectors/XenCpuLoad.hs \
907         src/Ganeti/Errors.hs \
908         src/Ganeti/HTools/AlgorithmParams.hs \
909         src/Ganeti/HTools/Backend/IAlloc.hs \
910         src/Ganeti/HTools/Backend/Luxi.hs \
911         src/Ganeti/HTools/Backend/MonD.hs \
912         src/Ganeti/HTools/Backend/Rapi.hs \
913         src/Ganeti/HTools/Backend/Simu.hs \
914         src/Ganeti/HTools/Backend/Text.hs \
915         src/Ganeti/HTools/CLI.hs \
916         src/Ganeti/HTools/Cluster.hs \
917         src/Ganeti/HTools/Cluster/AllocatePrimitives.hs \
918         src/Ganeti/HTools/Cluster/AllocateSecondary.hs \
919         src/Ganeti/HTools/Cluster/AllocationSolution.hs \
920         src/Ganeti/HTools/Cluster/Evacuate.hs \
921         src/Ganeti/HTools/Cluster/Metrics.hs \
922         src/Ganeti/HTools/Cluster/Moves.hs \
923         src/Ganeti/HTools/Cluster/Utils.hs \
924         src/Ganeti/HTools/Container.hs \
925         src/Ganeti/HTools/Dedicated.hs \
926         src/Ganeti/HTools/ExtLoader.hs \
927         src/Ganeti/HTools/GlobalN1.hs \
928         src/Ganeti/HTools/Graph.hs \
929         src/Ganeti/HTools/Group.hs \
930         src/Ganeti/HTools/Instance.hs \
931         src/Ganeti/HTools/Loader.hs \
932         src/Ganeti/HTools/Nic.hs \
933         src/Ganeti/HTools/Node.hs \
934         src/Ganeti/HTools/PeerMap.hs \
935         src/Ganeti/HTools/Program/Hail.hs \
936         src/Ganeti/HTools/Program/Harep.hs \
937         src/Ganeti/HTools/Program/Hbal.hs \
938         src/Ganeti/HTools/Program/Hcheck.hs \
939         src/Ganeti/HTools/Program/Hinfo.hs \
940         src/Ganeti/HTools/Program/Hscan.hs \
941         src/Ganeti/HTools/Program/Hspace.hs \
942         src/Ganeti/HTools/Program/Hsqueeze.hs \
943         src/Ganeti/HTools/Program/Hroller.hs \
944         src/Ganeti/HTools/Program/Main.hs \
945         src/Ganeti/HTools/Tags.hs \
946         src/Ganeti/HTools/Tags/Constants.hs \
947         src/Ganeti/HTools/Types.hs \
948         src/Ganeti/Hypervisor/Xen.hs \
949         src/Ganeti/Hypervisor/Xen/XmParser.hs \
950         src/Ganeti/Hypervisor/Xen/Types.hs \
951         src/Ganeti/Hash.hs \
952         src/Ganeti/Hs2Py/GenConstants.hs \
953         src/Ganeti/Hs2Py/GenOpCodes.hs \
954         src/Ganeti/Hs2Py/OpDoc.hs \
955         src/Ganeti/JQScheduler.hs \
956         src/Ganeti/JQScheduler/Filtering.hs \
957         src/Ganeti/JQScheduler/ReasonRateLimiting.hs \
958         src/Ganeti/JQScheduler/Types.hs \
959         src/Ganeti/JQueue.hs \
960         src/Ganeti/JQueue/Lens.hs \
961         src/Ganeti/JQueue/Objects.hs \
962         src/Ganeti/JSON.hs \
963         src/Ganeti/Jobs.hs \
964         src/Ganeti/Kvmd.hs \
965         src/Ganeti/Lens.hs \
966         src/Ganeti/Locking/Allocation.hs \
967         src/Ganeti/Locking/Types.hs \
968         src/Ganeti/Locking/Locks.hs \
969         src/Ganeti/Locking/Waiting.hs \
970         src/Ganeti/Logging.hs \
971         src/Ganeti/Logging/Lifted.hs \
972         src/Ganeti/Logging/WriterLog.hs \
973         src/Ganeti/Luxi.hs \
974         src/Ganeti/Network.hs \
975         src/Ganeti/Objects.hs \
976         src/Ganeti/Objects/BitArray.hs \
977         src/Ganeti/Objects/Disk.hs \
978         src/Ganeti/Objects/Instance.hs \
979         src/Ganeti/Objects/Lens.hs \
980         src/Ganeti/Objects/Nic.hs \
981         src/Ganeti/OpCodes.hs \
982         src/Ganeti/OpCodes/Lens.hs \
983         src/Ganeti/OpParams.hs \
984         src/Ganeti/Path.hs \
985         src/Ganeti/Parsers.hs \
986         src/Ganeti/PyValue.hs \
987         src/Ganeti/Query/Cluster.hs \
988         src/Ganeti/Query/Common.hs \
989         src/Ganeti/Query/Exec.hs \
990         src/Ganeti/Query/Export.hs \
991         src/Ganeti/Query/Filter.hs \
992         src/Ganeti/Query/FilterRules.hs \
993         src/Ganeti/Query/Group.hs \
994         src/Ganeti/Query/Instance.hs \
995         src/Ganeti/Query/Job.hs \
996         src/Ganeti/Query/Language.hs \
997         src/Ganeti/Query/Locks.hs \
998         src/Ganeti/Query/Network.hs \
999         src/Ganeti/Query/Node.hs \
1000         src/Ganeti/Query/Query.hs \
1001         src/Ganeti/Query/Server.hs \
1002         src/Ganeti/Query/Types.hs \
1003         src/Ganeti/PartialParams.hs \
1004         src/Ganeti/Rpc.hs \
1005         src/Ganeti/Runtime.hs \
1006         src/Ganeti/SlotMap.hs \
1007         src/Ganeti/Ssconf.hs \
1008         src/Ganeti/Storage/Diskstats/Parser.hs \
1009         src/Ganeti/Storage/Diskstats/Types.hs \
1010         src/Ganeti/Storage/Drbd/Parser.hs \
1011         src/Ganeti/Storage/Drbd/Types.hs \
1012         src/Ganeti/Storage/Lvm/LVParser.hs \
1013         src/Ganeti/Storage/Lvm/Types.hs \
1014         src/Ganeti/Storage/Utils.hs \
1015         src/Ganeti/THH.hs \
1016         src/Ganeti/THH/Field.hs \
1017         src/Ganeti/THH/HsRPC.hs \
1018         src/Ganeti/THH/PyRPC.hs \
1019         src/Ganeti/THH/PyType.hs \
1020         src/Ganeti/THH/Types.hs \
1021         src/Ganeti/THH/RPC.hs \
1022         src/Ganeti/Types.hs \
1023         src/Ganeti/UDSServer.hs \
1024         src/Ganeti/Utils.hs \
1025         src/Ganeti/Utils/Atomic.hs \
1026         src/Ganeti/Utils/AsyncWorker.hs \
1027         src/Ganeti/Utils/IORef.hs \
1028         src/Ganeti/Utils/Livelock.hs \
1029         src/Ganeti/Utils/Monad.hs \
1030         src/Ganeti/Utils/MultiMap.hs \
1031         src/Ganeti/Utils/MVarLock.hs \
1032         src/Ganeti/Utils/Random.hs \
1033         src/Ganeti/Utils/Statistics.hs \
1034         src/Ganeti/Utils/UniStd.hs \
1035         src/Ganeti/Utils/Validate.hs \
1036         src/Ganeti/VCluster.hs \
1037         src/Ganeti/WConfd/ConfigState.hs \
1038         src/Ganeti/WConfd/ConfigModifications.hs \
1039         src/Ganeti/WConfd/ConfigVerify.hs \
1040         src/Ganeti/WConfd/ConfigWriter.hs \
1041         src/Ganeti/WConfd/Client.hs \
1042         src/Ganeti/WConfd/Core.hs \
1043         src/Ganeti/WConfd/DeathDetection.hs \
1044         src/Ganeti/WConfd/Language.hs \
1045         src/Ganeti/WConfd/Monad.hs \
1046         src/Ganeti/WConfd/Persistent.hs \
1047         src/Ganeti/WConfd/Server.hs \
1048         src/Ganeti/WConfd/Ssconf.hs \
1049         src/Ganeti/WConfd/TempRes.hs
1050
1051 if ENABLE_MOND
1052 HS_LIB_SRCS += src/Ganeti/Monitoring/Server.hs
1053 else
1054 EXTRA_DIST += src/Ganeti/Monitoring/Server.hs
1055 endif
1056
1057 if ENABLE_METADATA
1058 HS_LIB_SRCS += \
1059         src/Ganeti/Metad/Config.hs \
1060         src/Ganeti/Metad/ConfigCore.hs \
1061         src/Ganeti/Metad/ConfigServer.hs \
1062         src/Ganeti/Metad/Server.hs \
1063         src/Ganeti/Metad/Types.hs \
1064         src/Ganeti/Metad/WebServer.hs
1065 else
1066 EXTRA_DIST += \
1067         src/Ganeti/Metad/Config.hs \
1068         src/Ganeti/Metad/ConfigCore.hs \
1069         src/Ganeti/Metad/ConfigServer.hs \
1070         src/Ganeti/Metad/Server.hs \
1071         src/Ganeti/Metad/Types.hs \
1072         src/Ganeti/Metad/WebServer.hs
1073 endif
1074
1075 HS_TEST_SRCS = \
1076         test/hs/Test/AutoConf.hs \
1077         test/hs/Test/Ganeti/Attoparsec.hs \
1078         test/hs/Test/Ganeti/BasicTypes.hs \
1079         test/hs/Test/Ganeti/Common.hs \
1080         test/hs/Test/Ganeti/Confd/Types.hs \
1081         test/hs/Test/Ganeti/Confd/Utils.hs \
1082         test/hs/Test/Ganeti/Constants.hs \
1083         test/hs/Test/Ganeti/Daemon.hs \
1084         test/hs/Test/Ganeti/Errors.hs \
1085         test/hs/Test/Ganeti/HTools/Backend/MonD.hs \
1086         test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
1087         test/hs/Test/Ganeti/HTools/Backend/Text.hs \
1088         test/hs/Test/Ganeti/HTools/CLI.hs \
1089         test/hs/Test/Ganeti/HTools/Cluster.hs \
1090         test/hs/Test/Ganeti/HTools/Container.hs \
1091         test/hs/Test/Ganeti/HTools/Graph.hs \
1092         test/hs/Test/Ganeti/HTools/Instance.hs \
1093         test/hs/Test/Ganeti/HTools/Loader.hs \
1094         test/hs/Test/Ganeti/HTools/Node.hs \
1095         test/hs/Test/Ganeti/HTools/PeerMap.hs \
1096         test/hs/Test/Ganeti/HTools/Types.hs \
1097         test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
1098         test/hs/Test/Ganeti/JSON.hs \
1099         test/hs/Test/Ganeti/Jobs.hs \
1100         test/hs/Test/Ganeti/JQScheduler.hs \
1101         test/hs/Test/Ganeti/JQueue.hs \
1102         test/hs/Test/Ganeti/JQueue/Objects.hs \
1103         test/hs/Test/Ganeti/Kvmd.hs \
1104         test/hs/Test/Ganeti/Luxi.hs \
1105         test/hs/Test/Ganeti/Locking/Allocation.hs \
1106         test/hs/Test/Ganeti/Locking/Locks.hs \
1107         test/hs/Test/Ganeti/Locking/Waiting.hs \
1108         test/hs/Test/Ganeti/Network.hs \
1109         test/hs/Test/Ganeti/PartialParams.hs \
1110         test/hs/Test/Ganeti/Objects.hs \
1111         test/hs/Test/Ganeti/Objects/BitArray.hs \
1112         test/hs/Test/Ganeti/OpCodes.hs \
1113         test/hs/Test/Ganeti/Query/Aliases.hs \
1114         test/hs/Test/Ganeti/Query/Filter.hs \
1115         test/hs/Test/Ganeti/Query/Instance.hs \
1116         test/hs/Test/Ganeti/Query/Language.hs \
1117         test/hs/Test/Ganeti/Query/Network.hs \
1118         test/hs/Test/Ganeti/Query/Query.hs \
1119         test/hs/Test/Ganeti/Rpc.hs \
1120         test/hs/Test/Ganeti/Runtime.hs \
1121         test/hs/Test/Ganeti/SlotMap.hs \
1122         test/hs/Test/Ganeti/Ssconf.hs \
1123         test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
1124         test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
1125         test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
1126         test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
1127         test/hs/Test/Ganeti/THH.hs \
1128         test/hs/Test/Ganeti/THH/Types.hs \
1129         test/hs/Test/Ganeti/TestCommon.hs \
1130         test/hs/Test/Ganeti/TestHTools.hs \
1131         test/hs/Test/Ganeti/TestHelper.hs \
1132         test/hs/Test/Ganeti/Types.hs \
1133         test/hs/Test/Ganeti/Utils.hs \
1134         test/hs/Test/Ganeti/Utils/MultiMap.hs \
1135         test/hs/Test/Ganeti/Utils/Statistics.hs \
1136         test/hs/Test/Ganeti/WConfd/Ssconf.hs \
1137         test/hs/Test/Ganeti/WConfd/TempRes.hs
1138
1139
1140 HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
1141
1142 HS_BUILT_SRCS = \
1143         test/hs/Test/Ganeti/TestImports.hs \
1144         src/AutoConf.hs \
1145         src/Ganeti/Hs2Py/ListConstants.hs \
1146         src/Ganeti/Curl/Internal.hs \
1147         src/Ganeti/Version.hs
1148 HS_BUILT_SRCS_IN = \
1149         $(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
1150         src/Ganeti/Curl/Internal.hsc \
1151         lib/_constants.py.in \
1152         lib/opcodes.py.in_after \
1153         lib/opcodes.py.in_before
1154
1155 HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
1156
1157 $(RUN_IN_TEMPDIR): | stamp-directories
1158
1159 doc/html/index.html: ENABLE_MANPAGES =
1160 doc/man-html/index.html: ENABLE_MANPAGES = 1
1161 doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
1162
1163 if HAS_SPHINX_PRE13
1164         SPHINX_HTML_THEME=default
1165 else
1166         SPHINX_HTML_THEME=classic
1167 endif
1168 # Note: we use here an order-only prerequisite, as the contents of
1169 # _constants.py are not actually influencing the html build output: it
1170 # has to exist in order for the sphinx module to be loaded
1171 # successfully, but we certainly don't want the docs to be rebuilt if
1172 # it changes
1173 doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
1174         configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
1175         lib/build/shell_example_lexer.py lib/ht.py \
1176         doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
1177         autotools/sphinx-wrapper | $(built_python_sources)
1178         @test -n "$(SPHINX)" || \
1179             { echo 'sphinx-build' not found during configure; exit 1; }
1180 if !MANPAGES_IN_DOC
1181         if test -n '$(ENABLE_MANPAGES)'; then \
1182           echo 'Man pages in documentation were disabled at configure time' >&2; \
1183           exit 1; \
1184         fi
1185 endif
1186 ## Sphinx provides little control over what content should be included. Some
1187 ## mechanisms exist, but they all have drawbacks or actual issues. Since we
1188 ## build two different versions of the documentation--once without man pages and
1189 ## once, if enabled, with them--some control is necessary. xmpp-wrapper provides
1190 ## us with this, but requires running in a temporary directory. It moves the
1191 ## correct files into place depending on environment variables.
1192         dir=$(dir $@) && \
1193         @mkdir_p@ $$dir && \
1194         PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
1195         HTML_THEME=$(SPHINX_HTML_THEME) \
1196         $(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
1197             -d . \
1198             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
1199             -D release="$(PACKAGE_VERSION)" \
1200             -D graphviz_dot="$(DOT)" \
1201             doc $(CURDIR)/$$dir && \
1202         rm -f $$dir/.buildinfo $$dir/objects.inv
1203         touch $@
1204
1205 doc/html: doc/html/index.html
1206
1207 doc/man-html: doc/man-html/index.html
1208
1209 doc/install-quick.rst: INSTALL
1210 doc/news.rst: NEWS
1211 doc/upgrade.rst: UPGRADE
1212
1213 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
1214         set -e; \
1215         { echo '.. This file is automatically updated at build time from $<.'; \
1216           echo '.. Do not edit.'; \
1217           echo; \
1218           cat $<; \
1219         } > $@
1220
1221 doc/manpages-enabled.rst: Makefile | $(built_base_sources)
1222         { echo '.. This file is automatically generated, do not edit!'; \
1223           echo ''; \
1224           echo 'Man pages'; \
1225           echo '========='; \
1226           echo; \
1227           echo '.. toctree::'; \
1228           echo '   :maxdepth: 1'; \
1229           echo; \
1230           for i in $(notdir $(mandocrst)); do \
1231             echo "   $$i"; \
1232           done | LC_ALL=C sort; \
1233         } > $@
1234
1235 doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
1236 if MANPAGES_IN_DOC
1237         { echo '.. This file is automatically updated at build time from $<.'; \
1238           echo '.. Do not edit.'; \
1239           echo; \
1240           echo "$*"; \
1241           echo '=========================================='; \
1242           tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
1243         } > $@
1244 else
1245         echo 'Man pages in documentation were disabled at configure time' >&2; \
1246         exit 1;
1247 endif
1248
1249 doc/users/%: doc/users/%.in Makefile $(REPLACE_VARS_SED)
1250         cat $< | sed -f $(REPLACE_VARS_SED) | LC_ALL=C sort | uniq | (grep -v '^root' || true) > $@
1251
1252 userspecs = \
1253         doc/users/users \
1254         doc/users/groups \
1255         doc/users/groupmemberships
1256
1257 # Things to build but not to install (add it to EXTRA_DIST if it should be
1258 # distributed)
1259 noinst_DATA = \
1260         $(BUILT_EXAMPLES) \
1261         doc/examples/bash_completion \
1262         doc/examples/bash_completion-debug \
1263         $(userspecs) \
1264         $(manhtml)
1265
1266 if HAS_SPHINX
1267 if MANPAGES_IN_DOC
1268 noinst_DATA += doc/man-html
1269 else
1270 noinst_DATA += doc/html
1271 endif
1272 endif
1273
1274 gnt_scripts = \
1275         scripts/gnt-backup \
1276         scripts/gnt-cluster \
1277         scripts/gnt-debug \
1278         scripts/gnt-group \
1279         scripts/gnt-instance \
1280         scripts/gnt-job \
1281         scripts/gnt-network \
1282         scripts/gnt-node \
1283         scripts/gnt-os \
1284         scripts/gnt-storage \
1285         scripts/gnt-filter
1286
1287 gnt_scripts_basenames = \
1288         $(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
1289
1290 gnt_python_sbin_SCRIPTS = \
1291         $(PYTHON_BOOTSTRAP_SBIN)
1292
1293 gntpython_SCRIPTS = $(gnt_scripts)
1294
1295 PYTHON_BOOTSTRAP_SBIN = \
1296         daemons/ganeti-noded \
1297         daemons/ganeti-rapi \
1298         daemons/ganeti-watcher
1299
1300 PYTHON_BOOTSTRAP = \
1301         tools/burnin \
1302         tools/ensure-dirs \
1303         tools/node-cleanup \
1304         tools/node-daemon-setup \
1305         tools/prepare-node-join \
1306         tools/ssh-update \
1307         tools/ssl-update
1308
1309 qa_scripts = \
1310         qa/__init__.py \
1311         qa/ganeti-qa.py \
1312         qa/qa_cluster.py \
1313         qa/qa_config.py \
1314         qa/qa_daemon.py \
1315         qa/qa_env.py \
1316         qa/qa_error.py \
1317         qa/qa_filters.py \
1318         qa/qa_group.py \
1319         qa/qa_instance.py \
1320         qa/qa_instance_utils.py \
1321         qa/qa_iptables.py \
1322         qa/qa_job.py \
1323         qa/qa_job_utils.py \
1324         qa/qa_logging.py \
1325         qa/qa_monitoring.py \
1326         qa/qa_network.py \
1327         qa/qa_node.py \
1328         qa/qa_os.py \
1329         qa/qa_performance.py \
1330         qa/qa_rapi.py \
1331         qa/qa_tags.py \
1332         qa/qa_utils.py
1333
1334 bin_SCRIPTS = $(HS_BIN_PROGS)
1335 install-exec-hook:
1336         @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
1337 # FIXME: this is a hardcoded logic, instead of auto-resolving
1338         $(LN_S) -f ../../../bin/htools \
1339           $(DESTDIR)$(iallocatorsdir)/hail
1340         for role in $(HS_BIN_ROLES); do \
1341           $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1342         done
1343
1344 HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1345
1346 HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
1347 if WANT_HSTESTS
1348 HS_MAKEFILE_GHC_SRCS += $(HS_TEST_PROGS:%=%.hs)
1349 endif
1350 Makefile.ghc: $(HS_MAKEFILE_GHC_SRCS) Makefile $(HASKELL_PACKAGE_VERSIONS_FILE) \
1351               | $(built_base_sources) $(HS_BUILT_SRCS)
1352         $(GHC) -M -dep-makefile $@ $(DEP_SUFFIXES) $(HFLAGS) $(HFLAGS_DYNAMIC) \
1353                 -itest/hs \
1354                 $(HEXTRA_COMBINED) $(HS_MAKEFILE_GHC_SRCS)
1355 # Since ghc -M does not generate dependency line for object files, dependencies
1356 # from a target executable seed object (e.g. src/hluxid.o) to objects which
1357 # finally will be linked to the target object (e.g. src/Ganeti/Daemon.o) are
1358 # missing in Makefile.ghc.
1359 # see: https://www.haskell.org/ghc/docs/7.6.2/html/users_guide/separate-compilation.html#makefile-dependencies
1360 # Following substitutions will add dependencies between object files which
1361 # corresponds to the interface file already there as a dependency for each
1362 # object listed in Makefile.ghc.
1363 # e.g. src/hluxid.o : src/Ganeti/Daemon.hi
1364 #        => src/hluxid.o : src/Ganeti/Daemon.hi src/Ganeti/Daemon.o
1365         sed -i -r -e 's/([^ ]+)\.hi$$/\1.hi \1.o/' -e 's/([^ ]+)_hi$$/\1_hi \1_o/' $@
1366
1367 @include_makefile_ghc@
1368
1369 # Contains the package-id flags for the current build: "-package-id" followed
1370 # by the name and hash of the package, one for each dependency.
1371 # Obtained from the setup-config using the Cabal API
1372 # (CabalDependenciesMacros.hs) after `cabal configure`.
1373 # This file is created along with HASKELL_PACKAGE_VERSIONS_FILE; if you want
1374 # to depend on it in a rule, depend on HASKELL_PACKAGE_VERSIONS_FILE instead.
1375 HASKELL_PACKAGE_IDS_FILE = ganeti.depsflags
1376
1377 # Defines the MIN_VERSION_* macros for all Haskell packages used in this
1378 # compilation.
1379 # The versions are determined using `cabal configure`, which takes them from
1380 # the ghc-pkg database.
1381 # At the moment, we don't support cabal sandboxes, so we use cabal configure
1382 # with the --user flag.
1383 # Note: `cabal configure` and CabalDependenciesMacros.hs perform no
1384 # downloading (only `cabal install` can do that).
1385 HASKELL_PACKAGE_VERSIONS_FILE = cabal_macros.h
1386
1387 $(HASKELL_PACKAGE_VERSIONS_FILE): Makefile ganeti.cabal \
1388                                   cabal/CabalDependenciesMacros.hs
1389         touch empty-cabal-config
1390         $(CABAL) --config-file=empty-cabal-config configure --user \
1391           -f`test $(HTEST) == yes && echo "htest" || echo "-htest"` \
1392           -f`test $(ENABLE_MOND) == True && echo "mond" || echo "-mond"` \
1393           -f`test $(ENABLE_METADATA) == True && echo "metad" || echo "-metad"`
1394         runhaskell $(abs_top_srcdir)/cabal/CabalDependenciesMacros.hs \
1395           ganeti.cabal \
1396           $(HASKELL_PACKAGE_IDS_FILE) \
1397           $(HASKELL_PACKAGE_VERSIONS_FILE)
1398
1399 # Like the %.o rule, but allows access to the test/hs directory.
1400 # This uses HFLAGS instead of HTEST_FLAGS because it's only for generating
1401 # object files (.o for GHC <= 7.6, .o/.so for newer GHCs) that are loaded
1402 # in GHCI when evaluating TH. The actual test-with-coverage .hpc_o files
1403 # are created in the `%.$(HTEST_SUFFIX)_o` rule.
1404 test/hs/%.o: $(HASKELL_PACKAGE_VERSIONS_FILE)
1405         @echo '[GHC|test]: $@ <- test/hs/$^'
1406         @$(GHC) -c $(HFLAGS) -itest/hs $(HFLAGS_DYNAMIC) \
1407                 $(HEXTRA_COMBINED) $(@:%.o=%.hs)
1408
1409 %.o: $(HASKELL_PACKAGE_VERSIONS_FILE)
1410         @echo '[GHC]: $@ <- $^'
1411         @$(GHC) -c $(HFLAGS) $(HFLAGS_DYNAMIC) \
1412                 $(HEXTRA_COMBINED) $(@:%.o=%.hs)
1413
1414 # For TH+profiling we need to compile twice: Once without profiling,
1415 # and then once with profiling. See
1416 # http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/template-haskell.html#id636646
1417 if HPROFILE
1418 %.$(HPROF_SUFFIX)_o: %.o
1419         @echo '[GHC|prof]: $@ <- $^'
1420         @$(GHC) -c $(HFLAGS) \
1421           $(HPROFFLAGS) \
1422                 $(HEXTRA_COMBINED) \
1423                 $(@:%.$(HPROF_SUFFIX)_o=%.hs)
1424 endif
1425
1426 # We depend on the non-test .o file here because we need the corresponding .so
1427 # file for GHC > 7.6 ghci dynamic loading for TH, and creating the .o file
1428 # will create the .so file since we use -dynamic-too (using the `test/hs/%.o`
1429 # rule).
1430 %.$(HTEST_SUFFIX)_o: %.o
1431         @echo '[GHC|test]: $@ <- $^'
1432         @$(GHC) -c $(HTEST_FLAGS) \
1433                 $(HEXTRA_COMBINED) $(@:%.$(HTEST_SUFFIX)_o=%.hs)
1434
1435 %.hi: %.o ;
1436 %.$(HTEST_SUFFIX)_hi: %.$(HTEST_SUFFIX)_o ;
1437 %.$(HPROF_SUFFIX)_hi: %.$(HPROF_SUFFIX)_o ;
1438
1439 if HPROFILE
1440 $(HS_SRC_PROGS): %: %.$(HPROF_SUFFIX)_o | stamp-directories
1441         @echo '[GHC-link]: $@'
1442         $(GHC) $(HFLAGS) $(HPROFFLAGS) \
1443                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1444 else
1445 $(HS_SRC_PROGS): %: %.o | stamp-directories
1446         @echo '[GHC-link]: $@'
1447         $(GHC) $(HFLAGS) $(HFLAGS_DYNAMIC) \
1448                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1449 endif
1450         @rm -f $(notdir $@).tix
1451         @touch "$@"
1452
1453 $(HS_TEST_PROGS): %: %.$(HTEST_SUFFIX)_o \
1454                            | stamp-directories $(built_python_sources)
1455         @if [ "$(HS_NODEV)" ]; then \
1456           echo "Error: cannot run unittests without the development" \
1457                " libraries (see devnotes.rst)" 1>&2; \
1458           exit 1; \
1459         fi
1460         @echo '[GHC-link|test]: $@'
1461         $(GHC) $(HTEST_FLAGS) \
1462                 $(HEXTRA_COMBINED) --make $(@:%=%.hs)
1463         @rm -f $(notdir $@).tix
1464         @touch "$@"
1465
1466 dist_sbin_SCRIPTS = \
1467         tools/ganeti-listrunner
1468
1469 nodist_sbin_SCRIPTS = \
1470         daemons/ganeti-cleaner \
1471   src/ganeti-kvmd \
1472   src/ganeti-luxid \
1473   src/ganeti-confd \
1474   src/ganeti-wconfd
1475
1476 src/ganeti-luxid: src/hluxid
1477         cp -f $< $@
1478
1479 # strip path prefixes off the sbin scripts
1480 all_sbin_scripts = \
1481         $(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1482         $(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1483
1484 src/ganeti-confd: src/hconfd
1485         cp -f $< $@
1486
1487 if ENABLE_MOND
1488 nodist_sbin_SCRIPTS += src/ganeti-mond
1489 endif
1490
1491 if ENABLE_METADATA
1492 nodist_sbin_SCRIPTS += src/ganeti-metad
1493 endif
1494
1495 python_scripts = \
1496         tools/cfgshell \
1497         tools/cfgupgrade \
1498         tools/cfgupgrade12 \
1499         tools/cluster-merge \
1500         tools/confd-client \
1501         tools/fmtjson \
1502         tools/lvmstrap \
1503         tools/move-instance \
1504         tools/ovfconverter \
1505         tools/post-upgrade \
1506         tools/sanitize-config \
1507         tools/query-config
1508
1509 python_scripts_shebang = \
1510         $(patsubst tools/%,tools/shebang/%, $(python_scripts))
1511
1512 tools/shebang/%: tools/%
1513         mkdir -p tools/shebang
1514         head -1 $< | sed 's|#!/usr/bin/python|#!$(PYTHON)|' > $@
1515         echo '# Generated file; do not edit.' >> $@
1516         tail -n +2 $< >> $@
1517
1518 dist_tools_SCRIPTS = \
1519         tools/kvm-console-wrapper \
1520         tools/master-ip-setup \
1521         tools/xen-console-wrapper
1522
1523 dist_tools_python_SCRIPTS = \
1524         tools/burnin
1525
1526 nodist_tools_python_SCRIPTS = \
1527         tools/node-cleanup \
1528         $(python_scripts_shebang)
1529
1530 tools_python_basenames = \
1531         $(patsubst shebang/%,%,\
1532         $(patsubst tools/%,%,\
1533         $(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS)))
1534
1535 nodist_tools_SCRIPTS = \
1536         tools/users-setup \
1537         tools/vcluster-setup
1538
1539 tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1540
1541 pkglib_python_scripts = \
1542         daemons/import-export \
1543         tools/check-cert-expired
1544
1545 nodist_pkglib_python_scripts = \
1546         tools/ensure-dirs \
1547         tools/node-daemon-setup \
1548         tools/prepare-node-join \
1549         tools/ssh-update \
1550         tools/ssl-update
1551
1552 pkglib_python_basenames = \
1553         $(patsubst daemons/%,%,$(patsubst tools/%,%,\
1554         $(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1555
1556 myexeclib_SCRIPTS = \
1557         daemons/daemon-util \
1558         tools/kvm-ifup \
1559         tools/kvm-ifup-os \
1560         tools/xen-ifup-os \
1561         tools/vif-ganeti \
1562         tools/vif-ganeti-metad \
1563         tools/net-common \
1564         $(HS_MYEXECLIB_PROGS)
1565
1566 # compute the basenames of the myexeclib_scripts
1567 myexeclib_scripts_basenames = \
1568         $(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1569
1570 EXTRA_DIST += \
1571         NEWS \
1572         UPGRADE \
1573         epydoc.conf.in \
1574         pylintrc \
1575         pylintrc-test \
1576         autotools/build-bash-completion \
1577         autotools/build-rpc \
1578         autotools/check-header \
1579         autotools/check-imports \
1580         autotools/check-man-dashes \
1581         autotools/check-man-references \
1582         autotools/check-man-warnings \
1583         autotools/check-news \
1584         autotools/check-python-code \
1585         autotools/check-tar \
1586         autotools/check-version \
1587         autotools/docpp \
1588         autotools/gen-py-coverage \
1589         autotools/print-py-constants \
1590         autotools/sphinx-wrapper \
1591         autotools/testrunner \
1592         autotools/wrong-hardcoded-paths \
1593         cabal/cabal-from-modules.py \
1594         $(RUN_IN_TEMPDIR) \
1595         daemons/daemon-util.in \
1596         daemons/ganeti-cleaner.in \
1597         $(pkglib_python_scripts) \
1598         devel/build_chroot \
1599         devel/upload \
1600         devel/webserver \
1601         tools/kvm-ifup.in \
1602         tools/ifup-os.in \
1603         tools/vif-ganeti.in \
1604         tools/vif-ganeti-metad.in \
1605         tools/net-common.in \
1606         tools/vcluster-setup.in \
1607         $(python_scripts) \
1608         $(docinput) \
1609         doc/html \
1610         $(BUILT_EXAMPLES:%=%.in) \
1611         doc/examples/ganeti.default \
1612         doc/examples/ganeti.default-debug \
1613         doc/examples/hooks/ethers \
1614         doc/examples/gnt-debug/README \
1615         doc/examples/gnt-debug/delay0.json \
1616         doc/examples/gnt-debug/delay50.json \
1617         doc/examples/systemd/ganeti-master.target \
1618         doc/examples/systemd/ganeti-node.target \
1619         doc/examples/systemd/ganeti.service \
1620         doc/examples/systemd/ganeti.target \
1621         doc/users/groupmemberships.in \
1622         doc/users/groups.in \
1623         doc/users/users.in \
1624         ganeti.cabal \
1625         cabal/ganeti.template.cabal \
1626         cabal/CabalDependenciesMacros.hs \
1627         $(dist_TESTS) \
1628         $(TEST_FILES) \
1629         $(python_test_support) \
1630         $(python_test_utils) \
1631         man/footer.rst \
1632         $(manrst) \
1633         $(maninput) \
1634         qa/qa-sample.json \
1635         $(qa_scripts) \
1636         $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
1637         $(HS_PROG_SRCS) \
1638         src/lint-hints.hs \
1639         test/hs/cli-tests-defs.sh \
1640         test/hs/offline-test.sh \
1641         .ghci
1642
1643 man_MANS = \
1644         man/ganeti-cleaner.8 \
1645         man/ganeti-confd.8 \
1646         man/ganeti-luxid.8 \
1647         man/ganeti-listrunner.8 \
1648         man/ganeti-kvmd.8 \
1649         man/ganeti-mond.8 \
1650         man/ganeti-noded.8 \
1651         man/ganeti-os-interface.7 \
1652         man/ganeti-extstorage-interface.7 \
1653         man/ganeti-rapi.8 \
1654         man/ganeti-watcher.8 \
1655         man/ganeti-wconfd.8 \
1656         man/ganeti.7 \
1657         man/gnt-backup.8 \
1658         man/gnt-cluster.8 \
1659         man/gnt-debug.8 \
1660         man/gnt-group.8 \
1661         man/gnt-network.8 \
1662         man/gnt-instance.8 \
1663         man/gnt-job.8 \
1664         man/gnt-node.8 \
1665         man/gnt-os.8 \
1666         man/gnt-storage.8 \
1667         man/gnt-filter.8 \
1668         man/hail.1 \
1669         man/harep.1 \
1670         man/hbal.1 \
1671         man/hcheck.1 \
1672         man/hinfo.1 \
1673         man/hscan.1 \
1674         man/hspace.1 \
1675         man/hsqueeze.1 \
1676         man/hroller.1 \
1677         man/htools.1 \
1678         man/mon-collector.7
1679
1680 # Remove extensions from all filenames in man_MANS
1681 mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1682
1683 manrst = $(patsubst %,%.rst,$(mannoext))
1684 manhtml = $(patsubst %.rst,%.html,$(manrst))
1685 mangen = $(patsubst %.rst,%.gen,$(manrst))
1686 maninput = \
1687         $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1688         $(patsubst %.html,%.html.in,$(manhtml)) \
1689         $(mangen)
1690
1691 manfullpath = $(patsubst man/%.1,man1/%.1,\
1692         $(patsubst man/%.7,man7/%.7,\
1693         $(patsubst man/%.8,man8/%.8,$(man_MANS))))
1694
1695 TEST_FILES = \
1696         test/autotools/autotools-check-news.test \
1697         test/data/htools/clean-nonzero-score.data \
1698         test/data/htools/common-suffix.data \
1699         test/data/htools/empty-cluster.data \
1700         test/data/htools/hail-alloc-dedicated-1.json \
1701         test/data/htools/hail-alloc-desired-location.json \
1702         test/data/htools/hail-alloc-drbd.json \
1703         test/data/htools/hail-alloc-drbd-restricted.json \
1704         test/data/htools/hail-alloc-ext.json \
1705         test/data/htools/hail-alloc-invalid-network.json \
1706         test/data/htools/hail-alloc-invalid-twodisks.json \
1707         test/data/htools/hail-alloc-restricted-network.json \
1708         test/data/htools/hail-alloc-nlocation.json \
1709         test/data/htools/hail-alloc-plain-tags.json \
1710         test/data/htools/hail-alloc-secondary.json \
1711         test/data/htools/hail-alloc-spindles.json \
1712         test/data/htools/hail-alloc-twodisks.json \
1713         test/data/htools/hail-change-group.json \
1714         test/data/htools/hail-invalid-reloc.json \
1715         test/data/htools/hail-node-evac.json \
1716         test/data/htools/hail-reloc-drbd.json \
1717         test/data/htools/hail-reloc-drbd-crowded.json \
1718         test/data/htools/hbal-cpu-speed.data \
1719         test/data/htools/hbal-desiredlocation-1.data \
1720         test/data/htools/hbal-desiredlocation-2.data \
1721         test/data/htools/hbal-desiredlocation-3.data \
1722         test/data/htools/hbal-desiredlocation-4.data \
1723         test/data/htools/hbal-dyn.data \
1724         test/data/htools/hbal-evac.data \
1725         test/data/htools/hbal-excl-tags.data \
1726         test/data/htools/hbal-forth.data \
1727         test/data/htools/hbal-location-1.data \
1728         test/data/htools/hbal-location-exclusion.data \
1729         test/data/htools/hbal-location-2.data \
1730         test/data/htools/hbal-migration-1.data \
1731         test/data/htools/hbal-migration-2.data \
1732         test/data/htools/hbal-migration-3.data \
1733         test/data/htools/hail-multialloc-dedicated.json \
1734         test/data/htools/hbal-soft-errors.data \
1735         test/data/htools/hbal-soft-errors2.data \
1736         test/data/htools/hbal-split-insts.data \
1737         test/data/htools/hspace-bad-group.data \
1738         test/data/htools/hspace-existing.data \
1739         test/data/htools/hspace-groups-one.data \
1740         test/data/htools/hspace-groups-two.data \
1741         test/data/htools/hspace-tiered-dualspec-exclusive.data \
1742         test/data/htools/hspace-tiered-dualspec.data \
1743         test/data/htools/hspace-tiered-exclusive.data \
1744         test/data/htools/hspace-tiered-ipolicy.data \
1745         test/data/htools/hspace-tiered-mixed.data \
1746         test/data/htools/hspace-tiered-resourcetypes.data \
1747         test/data/htools/hspace-tiered-vcpu.data \
1748         test/data/htools/hspace-tiered.data \
1749         test/data/htools/invalid-node.data \
1750         test/data/htools/missing-resources.data \
1751         test/data/htools/multiple-master.data \
1752         test/data/htools/multiple-tags.data \
1753         test/data/htools/n1-failure.data \
1754         test/data/htools/partly-used.data \
1755         test/data/htools/rapi/groups.json \
1756         test/data/htools/rapi/info.json \
1757         test/data/htools/rapi/instances.json \
1758         test/data/htools/rapi/nodes.json \
1759         test/data/htools/hroller-full.data \
1760         test/data/htools/hroller-nodegroups.data \
1761         test/data/htools/hroller-nonredundant.data \
1762         test/data/htools/hroller-online.data \
1763         test/data/htools/hsqueeze-mixed-instances.data \
1764         test/data/htools/hsqueeze-overutilized.data \
1765         test/data/htools/hsqueeze-underutilized.data \
1766         test/data/htools/plain-n1-restriction.data \
1767         test/data/htools/shared-n1-failure.data \
1768         test/data/htools/shared-n1-restriction.data \
1769         test/data/htools/unique-reboot-order.data \
1770         test/data/mond-data.txt \
1771         test/hs/shelltests/htools-balancing.test \
1772         test/hs/shelltests/htools-basic.test \
1773         test/hs/shelltests/htools-dynutil.test \
1774         test/hs/shelltests/htools-excl.test \
1775         test/hs/shelltests/htools-hail.test \
1776         test/hs/shelltests/htools-hbal-evac.test \
1777         test/hs/shelltests/htools-hbal.test \
1778         test/hs/shelltests/htools-hcheck.test \
1779         test/hs/shelltests/htools-hroller.test \
1780         test/hs/shelltests/htools-hspace.test \
1781         test/hs/shelltests/htools-hsqueeze.test \
1782         test/hs/shelltests/htools-invalid.test \
1783         test/hs/shelltests/htools-multi-group.test \
1784         test/hs/shelltests/htools-no-backend.test \
1785         test/hs/shelltests/htools-rapi.test \
1786         test/hs/shelltests/htools-single-group.test \
1787         test/hs/shelltests/htools-text-backend.test \
1788         test/hs/shelltests/htools-mon-collector.test \
1789         test/data/bdev-drbd-8.0.txt \
1790         test/data/bdev-drbd-8.3.txt \
1791         test/data/bdev-drbd-8.4.txt \
1792         test/data/bdev-drbd-8.4-no-disk-params.txt \
1793         test/data/bdev-drbd-disk.txt \
1794         test/data/bdev-drbd-net-ip4.txt \
1795         test/data/bdev-drbd-net-ip6.txt \
1796         test/data/bdev-rbd/json_output_empty.txt \
1797         test/data/bdev-rbd/json_output_extra_matches.txt \
1798         test/data/bdev-rbd/json_output_no_matches.txt \
1799         test/data/bdev-rbd/json_output_ok.txt \
1800         test/data/bdev-rbd/plain_output_new_extra_matches.txt \
1801         test/data/bdev-rbd/plain_output_new_no_matches.txt \
1802         test/data/bdev-rbd/plain_output_new_ok.txt \
1803         test/data/bdev-rbd/plain_output_old_empty.txt \
1804         test/data/bdev-rbd/plain_output_old_extra_matches.txt \
1805         test/data/bdev-rbd/plain_output_old_no_matches.txt \
1806         test/data/bdev-rbd/plain_output_old_ok.txt \
1807         test/data/bdev-rbd/output_invalid.txt \
1808         test/data/cert1.pem \
1809         test/data/cert2.pem \
1810         test/data/cgroup_root/memory/lxc/instance1/memory.limit_in_bytes \
1811         test/data/cgroup_root/cpuset/some_group/lxc/instance1/cpuset.cpus \
1812         test/data/cgroup_root/devices/some_group/lxc/instance1/devices.list \
1813         test/data/cluster_config_2.7.json \
1814         test/data/cluster_config_2.8.json \
1815         test/data/cluster_config_2.9.json \
1816         test/data/cluster_config_2.10.json \
1817         test/data/cluster_config_2.11.json \
1818         test/data/cluster_config_2.12.json \
1819         test/data/cluster_config_2.13.json \
1820         test/data/cluster_config_2.14.json \
1821         test/data/cluster_config_2.15.json \
1822         test/data/instance-minor-pairing.txt \
1823         test/data/instance-disks.txt \
1824         test/data/ip-addr-show-dummy0.txt \
1825         test/data/ip-addr-show-lo-ipv4.txt \
1826         test/data/ip-addr-show-lo-ipv6.txt \
1827         test/data/ip-addr-show-lo-oneline-ipv4.txt \
1828         test/data/ip-addr-show-lo-oneline-ipv6.txt \
1829         test/data/ip-addr-show-lo-oneline.txt \
1830         test/data/ip-addr-show-lo.txt \
1831         test/data/kvm_0.12.5_help.txt \
1832         test/data/kvm_0.15.90_help.txt \
1833         test/data/kvm_0.9.1_help.txt \
1834         test/data/kvm_0.9.1_help_boot_test.txt \
1835         test/data/kvm_1.0_help.txt \
1836         test/data/kvm_1.1.2_help.txt \
1837         test/data/kvm_runtime.json \
1838         test/data/lvs_lv.txt \
1839         test/data/NEWS_OK.txt \
1840         test/data/NEWS_previous_unreleased.txt \
1841         test/data/ovfdata/compr_disk.vmdk.gz \
1842         test/data/ovfdata/config.ini \
1843         test/data/ovfdata/corrupted_resources.ovf \
1844         test/data/ovfdata/empty.ini \
1845         test/data/ovfdata/empty.ovf \
1846         test/data/ovfdata/ganeti.mf \
1847         test/data/ovfdata/ganeti.ovf \
1848         test/data/ovfdata/gzip_disk.ovf \
1849         test/data/ovfdata/new_disk.vmdk \
1850         test/data/ovfdata/no_disk.ini \
1851         test/data/ovfdata/no_disk_in_ref.ovf \
1852         test/data/ovfdata/no_os.ini \
1853         test/data/ovfdata/no_ovf.ova \
1854         test/data/ovfdata/other/rawdisk.raw \
1855         test/data/ovfdata/ova.ova \
1856         test/data/ovfdata/rawdisk.raw \
1857         test/data/ovfdata/second_disk.vmdk \
1858         test/data/ovfdata/unsafe_path.ini \
1859         test/data/ovfdata/virtualbox.ovf \
1860         test/data/ovfdata/wrong_config.ini \
1861         test/data/ovfdata/wrong_extension.ovd \
1862         test/data/ovfdata/wrong_manifest.mf \
1863         test/data/ovfdata/wrong_manifest.ovf \
1864         test/data/ovfdata/wrong_ova.ova \
1865         test/data/ovfdata/wrong_xml.ovf \
1866         test/data/proc_cgroup.txt \
1867         test/data/proc_diskstats.txt \
1868         test/data/proc_drbd8.txt \
1869         test/data/proc_drbd80-emptyline.txt \
1870         test/data/proc_drbd80-emptyversion.txt \
1871         test/data/proc_drbd83.txt \
1872         test/data/proc_drbd83_sync.txt \
1873         test/data/proc_drbd83_sync_want.txt \
1874         test/data/proc_drbd83_sync_krnl2.6.39.txt \
1875         test/data/proc_drbd84.txt \
1876         test/data/proc_drbd84_emptyfirst.txt \
1877         test/data/proc_drbd84_sync.txt \
1878         test/data/proc_meminfo.txt \
1879         test/data/proc_cpuinfo.txt \
1880         test/data/qa-minimal-nodes-instances-only.json \
1881         test/data/sys_drbd_usermode_helper.txt \
1882         test/data/vgreduce-removemissing-2.02.02.txt \
1883         test/data/vgreduce-removemissing-2.02.66-fail.txt \
1884         test/data/vgreduce-removemissing-2.02.66-ok.txt \
1885         test/data/vgs-missing-pvs-2.02.02.txt \
1886         test/data/vgs-missing-pvs-2.02.66.txt \
1887         test/data/xen-xl-list-4.4-crashed-instances.txt \
1888         test/data/xen-xm-info-4.0.1.txt \
1889         test/data/xen-xm-list-4.0.1-dom0-only.txt \
1890         test/data/xen-xm-list-4.0.1-four-instances.txt \
1891         test/data/xen-xm-list-long-4.0.1.txt \
1892         test/data/xen-xm-uptime-4.0.1.txt \
1893         test/py/ganeti-cli.test \
1894         test/py/gnt-cli.test \
1895         test/py/import-export_unittest-helper
1896
1897
1898 python_tests = \
1899         doc/examples/rapi_testutils.py \
1900         test/py/cmdlib/backup_unittest.py \
1901         test/py/cmdlib/cluster_unittest.py \
1902         test/py/cmdlib/cmdlib_unittest.py \
1903         test/py/cmdlib/group_unittest.py \
1904         test/py/cmdlib/instance_unittest.py \
1905         test/py/cmdlib/instance_migration_unittest.py \
1906         test/py/cmdlib/instance_query_unittest.py \
1907         test/py/cmdlib/instance_storage_unittest.py \
1908         test/py/cmdlib/node_unittest.py \
1909         test/py/cmdlib/test_unittest.py \
1910         test/py/cfgupgrade_unittest.py \
1911         test/py/docs_unittest.py \
1912         test/py/ganeti.asyncnotifier_unittest.py \
1913         test/py/ganeti.backend_unittest-runasroot.py \
1914         test/py/ganeti.backend_unittest.py \
1915         test/py/ganeti.bootstrap_unittest.py \
1916         test/py/ganeti.cli_unittest.py \
1917         test/py/ganeti.cli_opts_unittest.py \
1918         test/py/ganeti.client.gnt_cluster_unittest.py \
1919         test/py/ganeti.client.gnt_instance_unittest.py \
1920         test/py/ganeti.client.gnt_job_unittest.py \
1921         test/py/ganeti.compat_unittest.py \
1922         test/py/ganeti.confd.client_unittest.py \
1923         test/py/ganeti.config_unittest.py \
1924         test/py/ganeti.constants_unittest.py \
1925         test/py/ganeti.daemon_unittest.py \
1926         test/py/ganeti.errors_unittest.py \
1927         test/py/ganeti.hooks_unittest.py \
1928         test/py/ganeti.ht_unittest.py \
1929         test/py/ganeti.http_unittest.py \
1930         test/py/ganeti.hypervisor.hv_chroot_unittest.py \
1931         test/py/ganeti.hypervisor.hv_fake_unittest.py \
1932         test/py/ganeti.hypervisor.hv_kvm_unittest.py \
1933         test/py/ganeti.hypervisor.hv_lxc_unittest.py \
1934         test/py/ganeti.hypervisor.hv_xen_unittest.py \
1935         test/py/ganeti.hypervisor_unittest.py \
1936         test/py/ganeti.impexpd_unittest.py \
1937         test/py/ganeti.jqueue_unittest.py \
1938         test/py/ganeti.jstore_unittest.py \
1939         test/py/ganeti.locking_unittest.py \
1940         test/py/ganeti.luxi_unittest.py \
1941         test/py/ganeti.masterd.iallocator_unittest.py \
1942         test/py/ganeti.masterd.instance_unittest.py \
1943         test/py/ganeti.mcpu_unittest.py \
1944         test/py/ganeti.netutils_unittest.py \
1945         test/py/ganeti.objects_unittest.py \
1946         test/py/ganeti.opcodes_unittest.py \
1947         test/py/ganeti.outils_unittest.py \
1948         test/py/ganeti.ovf_unittest.py \
1949         test/py/ganeti.qlang_unittest.py \
1950         test/py/ganeti.query_unittest.py \
1951         test/py/ganeti.rapi.baserlib_unittest.py \
1952         test/py/ganeti.rapi.client_unittest.py \
1953         test/py/ganeti.rapi.resources_unittest.py \
1954         test/py/ganeti.rapi.rlib2_unittest.py \
1955         test/py/ganeti.rapi.testutils_unittest.py \
1956         test/py/ganeti.rpc_unittest.py \
1957         test/py/ganeti.rpc.client_unittest.py \
1958         test/py/ganeti.runtime_unittest.py \
1959         test/py/ganeti.serializer_unittest.py \
1960         test/py/ganeti.server.rapi_unittest.py \
1961         test/py/ganeti.ssconf_unittest.py \
1962         test/py/ganeti.ssh_unittest.py \
1963         test/py/ganeti.storage.bdev_unittest.py \
1964         test/py/ganeti.storage.container_unittest.py \
1965         test/py/ganeti.storage.drbd_unittest.py \
1966         test/py/ganeti.storage.filestorage_unittest.py \
1967         test/py/ganeti.storage.gluster_unittest.py \
1968         test/py/ganeti.tools.burnin_unittest.py \
1969         test/py/ganeti.tools.ensure_dirs_unittest.py \
1970         test/py/ganeti.tools.node_daemon_setup_unittest.py \
1971         test/py/ganeti.tools.prepare_node_join_unittest.py \
1972         test/py/ganeti.uidpool_unittest.py \
1973         test/py/ganeti.utils.algo_unittest.py \
1974         test/py/ganeti.utils.filelock_unittest.py \
1975         test/py/ganeti.utils.hash_unittest.py \
1976         test/py/ganeti.utils.io_unittest-runasroot.py \
1977         test/py/ganeti.utils.io_unittest.py \
1978         test/py/ganeti.utils.log_unittest.py \
1979         test/py/ganeti.utils.lvm_unittest.py \
1980         test/py/ganeti.utils.mlock_unittest.py \
1981         test/py/ganeti.utils.nodesetup_unittest.py \
1982         test/py/ganeti.utils.process_unittest.py \
1983         test/py/ganeti.utils.retry_unittest.py \
1984         test/py/ganeti.utils.security_unittest.py \
1985         test/py/ganeti.utils.storage_unittest.py \
1986         test/py/ganeti.utils.text_unittest.py \
1987         test/py/ganeti.utils.version_unittest.py \
1988         test/py/ganeti.utils.wrapper_unittest.py \
1989         test/py/ganeti.utils.x509_unittest.py \
1990         test/py/ganeti.utils.bitarrays_unittest.py \
1991         test/py/ganeti.utils_unittest.py \
1992         test/py/ganeti.vcluster_unittest.py \
1993         test/py/ganeti.workerpool_unittest.py \
1994         test/py/pycurl_reset_unittest.py \
1995         test/py/qa.qa_config_unittest.py \
1996         test/py/tempfile_fork_unittest.py
1997
1998 python_test_support = \
1999         test/py/__init__.py \
2000         test/py/lockperf.py \
2001         test/py/testutils_ssh.py \
2002         test/py/mocks.py \
2003         test/py/testutils/__init__.py \
2004         test/py/testutils/config_mock.py \
2005         test/py/cmdlib/__init__.py \
2006         test/py/cmdlib/testsupport/__init__.py \
2007         test/py/cmdlib/testsupport/cmdlib_testcase.py \
2008         test/py/cmdlib/testsupport/iallocator_mock.py \
2009         test/py/cmdlib/testsupport/livelock_mock.py \
2010         test/py/cmdlib/testsupport/netutils_mock.py \
2011         test/py/cmdlib/testsupport/pathutils_mock.py \
2012         test/py/cmdlib/testsupport/processor_mock.py \
2013         test/py/cmdlib/testsupport/rpc_runner_mock.py \
2014         test/py/cmdlib/testsupport/ssh_mock.py \
2015         test/py/cmdlib/testsupport/utils_mock.py \
2016         test/py/cmdlib/testsupport/util.py \
2017         test/py/cmdlib/testsupport/wconfd_mock.py
2018
2019 haskell_tests = test/hs/htest
2020
2021 dist_TESTS = \
2022         test/py/check-cert-expired_unittest.bash \
2023         test/py/daemon-util_unittest.bash \
2024         test/py/systemd_unittest.bash \
2025         test/py/ganeti-cleaner_unittest.bash \
2026         test/py/import-export_unittest.bash \
2027         test/py/cli-test.bash \
2028         test/py/bash_completion.bash
2029
2030 if PY_UNIT
2031 dist_TESTS += $(python_tests)
2032 endif
2033
2034 nodist_TESTS =
2035 check_SCRIPTS =
2036
2037 if WANT_HSTESTS
2038 nodist_TESTS += $(haskell_tests)
2039 # test dependency
2040 test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
2041 dist_TESTS += test/hs/offline-test.sh
2042 check_SCRIPTS += \
2043         test/hs/hpc-htools \
2044         test/hs/hpc-mon-collector \
2045         $(HS_BUILT_TEST_HELPERS)
2046 endif
2047
2048 TESTS = $(dist_TESTS) $(nodist_TESTS)
2049
2050 # Environment for all tests
2051 PLAIN_TESTS_ENVIRONMENT = \
2052         PYTHONPATH=.:./test/py \
2053         TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
2054         PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
2055         $(RUN_IN_TEMPDIR)
2056
2057 # Environment for tests run by automake
2058 TESTS_ENVIRONMENT = \
2059         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
2060
2061 all_python_code = \
2062         $(dist_sbin_SCRIPTS) \
2063         $(python_scripts) \
2064         $(pkglib_python_scripts) \
2065         $(nodist_pkglib_python_scripts) \
2066         $(nodist_tools_python_scripts) \
2067         $(pkgpython_PYTHON) \
2068         $(client_PYTHON) \
2069         $(cmdlib_PYTHON) \
2070         $(cmdlib_cluster_PYTHON) \
2071         $(config_PYTHON) \
2072         $(hypervisor_PYTHON) \
2073         $(hypervisor_hv_kvm_PYTHON) \
2074         $(jqueue_PYTHON) \
2075         $(storage_PYTHON) \
2076         $(rapi_PYTHON) \
2077         $(server_PYTHON) \
2078         $(rpc_PYTHON) \
2079         $(rpc_stub_PYTHON) \
2080         $(pytools_PYTHON) \
2081         $(http_PYTHON) \
2082         $(confd_PYTHON) \
2083         $(masterd_PYTHON) \
2084         $(impexpd_PYTHON) \
2085         $(utils_PYTHON) \
2086         $(watcher_PYTHON) \
2087         $(noinst_PYTHON) \
2088         $(qa_scripts)
2089
2090 if PY_UNIT
2091 all_python_code += $(python_tests)
2092 all_python_code += $(python_test_support)
2093 all_python_code += $(python_test_utils)
2094 endif
2095
2096 srclink_files = \
2097         man/footer.rst \
2098         test/py/check-cert-expired_unittest.bash \
2099         test/py/daemon-util_unittest.bash \
2100         test/py/systemd_unittest.bash \
2101         test/py/ganeti-cleaner_unittest.bash \
2102         test/py/import-export_unittest.bash \
2103         test/py/cli-test.bash \
2104         test/py/bash_completion.bash \
2105         test/hs/offline-test.sh \
2106         test/hs/cli-tests-defs.sh \
2107         $(all_python_code) \
2108         $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
2109         $(docinput)
2110
2111 check_python_code = \
2112         $(BUILD_BASH_COMPLETION) \
2113         $(CHECK_IMPORTS) \
2114         $(CHECK_HEADER) \
2115         $(DOCPP) \
2116         $(all_python_code)
2117
2118 lint_python_code = \
2119         ganeti \
2120         ganeti/http/server.py \
2121         $(dist_sbin_SCRIPTS) \
2122         $(python_scripts) \
2123         $(pkglib_python_scripts) \
2124         $(BUILD_BASH_COMPLETION) \
2125         $(CHECK_IMPORTS) \
2126         $(CHECK_HEADER) \
2127         $(DOCPP) \
2128         $(gnt_python_sbin_SCRIPTS) \
2129         $(PYTHON_BOOTSTRAP)
2130
2131 standalone_python_modules = \
2132         lib/rapi/client.py \
2133         tools/ganeti-listrunner
2134
2135 pep8_python_code = \
2136         ganeti \
2137         ganeti/http/server.py \
2138         $(dist_sbin_SCRIPTS) \
2139         $(python_scripts) \
2140         $(pkglib_python_scripts) \
2141         $(BUILD_BASH_COMPLETION) \
2142         $(CHECK_HEADER) \
2143         $(DOCPP) \
2144         $(PYTHON_BOOTSTRAP) \
2145         $(gnt_python_sbin_SCRIPTS) \
2146         qa \
2147         $(python_test_support)
2148         $(python_test_utils)
2149
2150 test/py/daemon-util_unittest.bash: daemons/daemon-util
2151
2152 test/py/systemd_unittest.bash: daemons/daemon-util $(BUILT_EXAMPLES)
2153
2154 test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
2155
2156 test/py/bash_completion.bash: doc/examples/bash_completion-debug
2157
2158 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
2159         sed -f $(REPLACE_VARS_SED) < $< > $@
2160         chmod +x $@
2161
2162 tools/kvm-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED)
2163         sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/kvm-ifup-os:/" < $< > $@
2164         chmod +x $@
2165
2166 tools/xen-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED)
2167         sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/xen-ifup-os:/" < $< > $@
2168         chmod +x $@
2169
2170 tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
2171         sed -f $(REPLACE_VARS_SED) < $< > $@
2172         chmod +x $@
2173
2174 tools/vif-ganeti-metad: tools/vif-ganeti-metad.in $(REPLACE_VARS_SED)
2175         sed -f $(REPLACE_VARS_SED) < $< > $@
2176         chmod +x $@
2177
2178 tools/net-common: tools/net-common.in $(REPLACE_VARS_SED)
2179         sed -f $(REPLACE_VARS_SED) < $< > $@
2180         chmod +x $@
2181
2182 tools/users-setup: Makefile $(userspecs)
2183         set -e; \
2184         { echo '#!/bin/sh'; \
2185           echo 'if [ "x$$1" != "x--yes-do-it" ];'; \
2186           echo 'then echo "This will do the following changes"'; \
2187           $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
2188                      END {if (count == 0) {print "echo + No groups to add"}}' doc/users/groups; \
2189           $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with primary group",$$2} \
2190                                   else {print "echo + Will add user",$$1}; count++}\
2191                      END {if (count == 0) {print "echo + No users to add"}}' doc/users/users; \
2192           $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}' doc/users/groupmemberships; \
2193           echo 'echo'; \
2194           echo 'echo "OK? (y/n)"'; \
2195           echo 'read confirm'; \
2196           echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
2197           echo 'fi'; \
2198           $(AWK) -- '{print "groupadd --system",$$1}' doc/users/groups; \
2199           $(AWK) -- '{if (NF > 1) {print "useradd --system --gid",$$2,$$1} else {print "useradd --system",$$1}}' doc/users/users; \
2200           $(AWK) -- '{print "usermod --append --groups",$$2,$$1}' doc/users/groupmemberships; \
2201         } > $@
2202         chmod +x $@
2203
2204 tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
2205         sed -f $(REPLACE_VARS_SED) < $< > $@
2206         chmod +x $@
2207
2208 daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
2209         sed -f $(REPLACE_VARS_SED) < $< > $@
2210         chmod +x $@
2211
2212 doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
2213         sed -f $(REPLACE_VARS_SED) < $< > $@
2214
2215 doc/examples/bash_completion: BC_ARGS = --compact
2216 doc/examples/bash_completion-debug: BC_ARGS =
2217
2218 doc/examples/bash_completion doc/examples/bash_completion-debug: \
2219         $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
2220         lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
2221         daemons/ganeti-cleaner \
2222         $(GENERATED_FILES) $(HS_GENERATED_FILES)
2223         PYTHONPATH=. $(RUN_IN_TEMPDIR) \
2224           $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
2225
2226 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
2227         lib/build/shell_example_lexer.py \
2228         | $(RUN_IN_TEMPDIR) $(built_python_sources)
2229         @echo "Checking $< for hardcoded paths..."
2230         @if grep -nEf autotools/wrong-hardcoded-paths $<; then \
2231           echo "Man page $< has hardcoded paths (see above)!" 1>&2 ; \
2232           exit 1; \
2233         fi
2234         set -e ; \
2235         trap 'echo auto-removing $@; rm $@' EXIT; \
2236         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
2237         $(CHECK_MAN_REFERENCES) $@; \
2238         trap - EXIT
2239
2240 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.rst
2241         @test -n "$(PANDOC)" || \
2242           { echo 'pandoc' not found during configure; exit 1; }
2243         set -o pipefail -e; \
2244         trap 'echo auto-removing $@; rm $@' EXIT; \
2245         $(PANDOC) -s -f rst -t man $< man/footer.rst | \
2246           sed -e 's/\\@/@/g' > $@; \
2247         if test -n "$(MAN_HAS_WARNINGS)"; then LC_ALL=en_US.UTF-8 $(CHECK_MAN_WARNINGS) $@; fi; \
2248         $(CHECK_MAN_DASHES) $@; \
2249         trap - EXIT
2250
2251 man/%.html.in: man/%.gen man/footer.rst
2252         @test -n "$(PANDOC)" || \
2253           { echo 'pandoc' not found during configure; exit 1; }
2254         set -o pipefail ; \
2255         $(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
2256           sed -e 's/\\@/@/g' > $@
2257
2258 man/%: man/%.in  $(REPLACE_VARS_SED)
2259         sed -f $(REPLACE_VARS_SED) < $< > $@
2260
2261 epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
2262         sed -f $(REPLACE_VARS_SED) < $< > $@
2263
2264 vcs-version:
2265         if test -d .git; then \
2266           git describe | tr '"' - > $@; \
2267         elif test ! -f $@ ; then \
2268           echo "Cannot auto-generate $@ file"; exit 1; \
2269         fi
2270
2271 .PHONY: clean-vcs-version
2272 clean-vcs-version:
2273         rm -f vcs-version
2274
2275 .PHONY: regen-vcs-version
2276 regen-vcs-version:
2277         @set -e; \
2278         cd $(srcdir); \
2279         if test -d .git; then \
2280           T=`mktemp` ; trap 'rm -f $$T' EXIT; \
2281           git describe > $$T; \
2282           if ! cmp --quiet $$T vcs-version; then \
2283             mv $$T vcs-version; \
2284           fi; \
2285         fi
2286
2287 src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
2288         vcs-version $(built_base_sources)
2289         set -e; \
2290         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
2291         sed -e 's"%ver%"'"$$VCSVER"'"' < $< > $@
2292
2293 src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
2294                                    src/Ganeti/Constants.hs \
2295                                  | stamp-directories
2296         @echo Generating $@
2297         @set -e; \
2298 ## Extract constant names from 'Constants.hs' by extracting the left
2299 ## side of all lines containing an equal sign (i.e., '=') and
2300 ## prepending the apostrophe sign (i.e., "'").
2301 ##
2302 ## For example, the constant
2303 ##   adminstDown = ...
2304 ## becomes
2305 ##   'adminstDown
2306         NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
2307                  sed -n -e "/=/ s/\(.*\) =.*/    '\1:/g p"); \
2308         m4 -DPY_CONSTANT_NAMES="$$NAMES" \
2309                 $(abs_top_srcdir)/src/Ganeti/Hs2Py/ListConstants.hs.in > $@
2310
2311 src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
2312         hsc2hs -o $@ $<
2313
2314 test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
2315         $(built_base_sources)
2316         set -e; \
2317         { cat $< ; \
2318           echo ; \
2319           for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
2320             echo "import $$name ()" ; \
2321           done ; \
2322         } > $@
2323
2324 lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
2325         cat $(abs_top_srcdir)/lib/_constants.py.in > $@
2326         src/hs2py --constants >> $@
2327
2328 lib/constants.py: lib/_constants.py
2329
2330 src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
2331                | $(built_base_sources)
2332         @echo "m4 ... >" $@
2333         @m4 -DPACKAGE_VERSION="$(PACKAGE_VERSION)" \
2334             -DVERSION_MAJOR="$(VERSION_MAJOR)" \
2335             -DVERSION_MINOR="$(VERSION_MINOR)" \
2336             -DVERSION_REVISION="$(VERSION_REVISION)" \
2337             -DVERSION_SUFFIX="$(VERSION_SUFFIX)" \
2338             -DVERSION_FULL="$(VERSION_FULL)" \
2339             -DDIRVERSION="$(DIRVERSION)" \
2340             -DLOCALSTATEDIR="$(localstatedir)" \
2341             -DSYSCONFDIR="$(sysconfdir)" \
2342             -DSSH_CONFIG_DIR="$(SSH_CONFIG_DIR)" \
2343             -DSSH_LOGIN_USER="$(SSH_LOGIN_USER)" \
2344             -DSSH_CONSOLE_USER="$(SSH_CONSOLE_USER)" \
2345             -DEXPORT_DIR="$(EXPORT_DIR)" \
2346             -DBACKUP_DIR="$(backup_dir)" \
2347             -DOS_SEARCH_PATH="\"$(OS_SEARCH_PATH)\"" \
2348             -DES_SEARCH_PATH="\"$(ES_SEARCH_PATH)\"" \
2349             -DXEN_BOOTLOADER="$(XEN_BOOTLOADER)" \
2350             -DXEN_CONFIG_DIR="$(XEN_CONFIG_DIR)" \
2351             -DXEN_KERNEL="$(XEN_KERNEL)" \
2352             -DXEN_INITRD="$(XEN_INITRD)" \
2353             -DKVM_KERNEL="$(KVM_KERNEL)" \
2354             -DSHARED_FILE_STORAGE_DIR="$(SHARED_FILE_STORAGE_DIR)" \
2355             -DIALLOCATOR_SEARCH_PATH="\"$(IALLOCATOR_SEARCH_PATH)\"" \
2356             -DDEFAULT_BRIDGE="$(DEFAULT_BRIDGE)" \
2357             -DDEFAULT_VG="$(DEFAULT_VG)" \
2358             -DKVM_PATH="$(KVM_PATH)" \
2359             -DIP_PATH="$(IP_PATH)" \
2360             -DSOCAT_PATH="$(SOCAT)" \
2361             -DPYTHON_PATH="$(PYTHON)" \
2362             -DSOCAT_USE_ESCAPE="$(SOCAT_USE_ESCAPE)" \
2363             -DSOCAT_USE_COMPRESS="$(SOCAT_USE_COMPRESS)" \
2364             -DLVM_STRIPECOUNT="$(LVM_STRIPECOUNT)" \
2365             -DTOOLSDIR="$(libdir)/ganeti/tools" \
2366             -DGNT_SCRIPTS="$(foreach i,$(notdir $(gnt_scripts)),\"$(i)\":)" \
2367             -DHS_HTOOLS_PROGS="$(foreach i,$(HS_HTOOLS_PROGS),\"$(i)\":)" \
2368             -DPKGLIBDIR="$(libdir)/ganeti" \
2369             -DSHAREDIR="$(prefix)/share/ganeti" \
2370             -DVERSIONEDSHAREDIR="$(versionedsharedir)" \
2371             -DDRBD_BARRIERS="$(DRBD_BARRIERS)" \
2372             -DDRBD_NO_META_FLUSH="$(DRBD_NO_META_FLUSH)" \
2373             -DSYSLOG_USAGE="$(SYSLOG_USAGE)" \
2374             -DDAEMONS_GROUP="$(DAEMONS_GROUP)" \
2375             -DADMIN_GROUP="$(ADMIN_GROUP)" \
2376             -DMASTERD_USER="$(MASTERD_USER)" \
2377             -DMASTERD_GROUP="$(MASTERD_GROUP)" \
2378             -DMETAD_USER="$(METAD_USER)" \
2379             -DMETAD_GROUP="$(METAD_GROUP)" \
2380             -DRAPI_USER="$(RAPI_USER)" \
2381             -DRAPI_GROUP="$(RAPI_GROUP)" \
2382             -DCONFD_USER="$(CONFD_USER)" \
2383             -DCONFD_GROUP="$(CONFD_GROUP)" \
2384             -DWCONFD_USER="$(WCONFD_USER)" \
2385             -DWCONFD_GROUP="$(WCONFD_GROUP)" \
2386             -DKVMD_USER="$(KVMD_USER)" \
2387             -DKVMD_GROUP="$(KVMD_GROUP)" \
2388             -DLUXID_USER="$(LUXID_USER)" \
2389             -DLUXID_GROUP="$(LUXID_GROUP)" \
2390             -DNODED_USER="$(NODED_USER)" \
2391             -DNODED_GROUP="$(NODED_GROUP)" \
2392             -DMOND_USER="$(MOND_USER)" \
2393             -DMOND_GROUP="$(MOND_GROUP)" \
2394             -DMETAD_USER="$(METAD_USER)" \
2395             -DMETAD_GROUP="$(METAD_GROUP)" \
2396             -DDISK_SEPARATOR="$(DISK_SEPARATOR)" \
2397             -DQEMUIMG_PATH="$(QEMUIMG_PATH)" \
2398             -DXEN_CMD="$(XEN_CMD)" \
2399             -DENABLE_RESTRICTED_COMMANDS="$(ENABLE_RESTRICTED_COMMANDS)" \
2400             -DENABLE_METADATA="$(ENABLE_METADATA)" \
2401             -DENABLE_MOND="$(ENABLE_MOND)" \
2402             -DHAS_GNU_LN="$(HAS_GNU_LN)" \
2403             -DMAN_PAGES="$$(for i in $(notdir $(man_MANS)); do \
2404                             echo -n "$$i" | sed -re 's/^(.*)\.([0-9]+)$$/("\1",\2):/g'; \
2405                             done)" \
2406             -DAF_INET4="$$(PYTHONPATH=. $(PYTHON) $(PRINT_PY_CONSTANTS) AF_INET4)" \
2407             -DAF_INET6="$$(PYTHONPATH=. $(PYTHON) $(PRINT_PY_CONSTANTS) AF_INET6)" \
2408         $(abs_top_srcdir)/src/AutoConf.hs.in > $@
2409
2410 lib/_vcsversion.py: Makefile vcs-version | stamp-directories
2411         set -e; \
2412         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
2413         { echo '# This file is automatically generated, do not edit!'; \
2414           echo '#'; \
2415           echo ''; \
2416           echo '"""Build-time VCS version number for Ganeti.'; \
2417           echo '';\
2418           echo 'This file is autogenerated by the build process.'; \
2419           echo 'For any changes you need to re-run ./configure (and'; \
2420           echo 'not edit by hand).'; \
2421           echo ''; \
2422           echo '"""'; \
2423           echo ''; \
2424           echo '# pylint: disable=C0301,C0324'; \
2425           echo '# because this is autogenerated, we do not want'; \
2426           echo '# style warnings' ; \
2427           echo ''; \
2428           echo "VCS_VERSION = '$$VCSVER'"; \
2429         } > $@
2430
2431 lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
2432                 lib/opcodes.py.in_after | stamp-directories
2433         cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
2434         src/hs2py --opcodes >> $@
2435         cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
2436
2437 # Generating the RPC wrappers depends on many things, so make sure
2438 # it's built at the end of the built sources
2439 lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC) | $(built_base_sources) $(built_python_base_sources)
2440         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
2441
2442 if ENABLE_METADATA
2443 lib/rpc/stub/metad.py: Makefile src/hs2py | stamp-directories
2444         src/hs2py --metad-rpc > $@
2445 endif
2446
2447 lib/rpc/stub/wconfd.py: Makefile src/hs2py | stamp-directories
2448         src/hs2py --wconfd-rpc > $@
2449
2450 $(SHELL_ENV_INIT): Makefile stamp-directories
2451         set -e; \
2452         { echo '# Allow overriding for tests'; \
2453           echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
2454           echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
2455           echo; \
2456           echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
2457           echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
2458           echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
2459           echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
2460           echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
2461         } > $@
2462
2463 ## Writes sed script to replace placeholders with build-time values. The
2464 ## additional quotes after the first @ sign are necessary to stop configure
2465 ## from replacing those values as well.
2466 $(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
2467         set -e; \
2468         { echo 's#@''PREFIX@#$(prefix)#g'; \
2469           echo 's#@''SYSCONFDIR@#$(sysconfdir)#g'; \
2470           echo 's#@''LOCALSTATEDIR@#$(localstatedir)#g'; \
2471           echo 's#@''BINDIR@#$(BINDIR)#g'; \
2472           echo 's#@''SBINDIR@#$(SBINDIR)#g'; \
2473           echo 's#@''LIBDIR@#$(libdir)#g'; \
2474           echo 's#@''GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
2475           echo 's#@''CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
2476           echo 's#@''CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
2477           echo 's#@''CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
2478           echo 's#@''CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
2479           echo 's#@''CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
2480           echo 's#@''RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
2481           echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
2482           echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
2483           echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
2484           echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
2485           echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
2486           echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
2487           echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
2488           echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
2489           echo 's#@''GNTMETADUSER@#$(METAD_USER)#g'; \
2490           echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
2491           echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
2492           echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
2493           echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
2494           echo 's#@''GNTWCONFDGROUP@#$(CONFD_GROUP)#g'; \
2495           echo 's#@''GNTLUXIDGROUP@#$(LUXID_GROUP)#g'; \
2496           echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
2497           echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \
2498           echo 's#@''GNTMETADGROUP@#$(METAD_GROUP)#g'; \
2499           echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
2500           echo 's#@''CUSTOM_ENABLE_MOND@#$(ENABLE_MOND)#g'; \
2501           echo 's#@''MODULES@#$(strip $(lint_python_code))#g'; \
2502           echo 's#@''XEN_CONFIG_DIR@#$(XEN_CONFIG_DIR)#g'; \
2503           echo; \
2504           echo '/^@SHELL_ENV_INIT@$$/ {'; \
2505           echo '  r $(SHELL_ENV_INIT)'; \
2506           echo '  d'; \
2507           echo '}'; \
2508         } > $@
2509
2510 # Using deferred evaluation
2511 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
2512 daemons/ganeti-watcher: MODULE = ganeti.watcher
2513 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
2514 tools/burnin: MODULE = ganeti.tools.burnin
2515 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
2516 tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
2517 tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
2518 tools/ssh-update: MODULE = ganeti.tools.ssh_update
2519 tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
2520 tools/ssl-update: MODULE = ganeti.tools.ssl_update
2521 $(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
2522
2523 $(PYTHON_BOOTSTRAP) $(gnt_scripts) $(gnt_python_sbin_SCRIPTS): Makefile | stamp-directories
2524         test -n "$(MODULE)" || { echo Missing module; exit 1; }
2525         set -e; \
2526         { echo '#!${PYTHON}'; \
2527           echo '# This file is automatically generated, do not edit!'; \
2528           echo "# Edit $(MODULE) instead."; \
2529           echo; \
2530           echo '"""Bootstrap script for L{$(MODULE)}"""'; \
2531           echo; \
2532           echo '# pylint: disable=C0103'; \
2533           echo '# C0103: Invalid name'; \
2534           echo; \
2535           echo 'import sys'; \
2536           echo 'import $(MODULE) as main'; \
2537           echo; \
2538           echo '# Temporarily alias commands until bash completion'; \
2539           echo '# generator is changed'; \
2540           echo 'if hasattr(main, "commands"):'; \
2541           echo '  commands = main.commands # pylint: disable=E1101'; \
2542           echo 'if hasattr(main, "aliases"):'; \
2543           echo '  aliases = main.aliases # pylint: disable=E1101'; \
2544           echo; \
2545           echo 'if __name__ == "__main__":'; \
2546           echo '  sys.exit(main.Main())'; \
2547         } > $@
2548         chmod u+x $@
2549
2550 $(HS_BUILT_TEST_HELPERS): Makefile
2551         @test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2552         set -e; \
2553         { echo '#!/bin/sh'; \
2554           echo '# This file is automatically generated, do not edit!'; \
2555           echo "# Edit Makefile.am instead."; \
2556           echo; \
2557           echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2558         } > $@
2559         chmod u+x $@
2560
2561 stamp-directories: Makefile
2562         $(MAKE) $(AM_MAKEFLAGS) ganeti
2563         @mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2564         touch $@
2565
2566 # We need to create symlinks because "make distcheck" will not install Python
2567 # files when building.
2568 stamp-srclinks: Makefile | stamp-directories
2569         set -e; \
2570         for i in $(srclink_files); do \
2571           if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2572             $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2573           fi; \
2574         done
2575         touch $@
2576
2577 .PHONY: ganeti
2578 ganeti:
2579         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2580
2581 .PHONY: check-dirs
2582 check-dirs: $(GENERATED_FILES)
2583         @set -e; \
2584         find . -type d \( -name . -o -name .git -prune -o -print \) | { \
2585           error=; \
2586           while read dir; do \
2587             case "$$dir" in \
2588               $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
2589               *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
2590             esac; \
2591           done; \
2592           for dir in $(DIRS); do \
2593             if ! test -d "$$dir"; then \
2594               echo "Directory $$dir listed in DIRS does not exist" >&2; \
2595               error=1; \
2596             fi \
2597           done; \
2598           test -z "$$error"; \
2599         }
2600
2601 .PHONY: check-news
2602 check-news:
2603         RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2604
2605 .PHONY: check-local
2606 check-local: check-dirs check-news $(GENERATED_FILES)
2607         $(CHECK_PYTHON_CODE) $(check_python_code)
2608         PYTHONPATH=. $(CHECK_HEADER) \
2609             $(filter-out $(GENERATED_FILES),$(check_python_code))
2610         $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
2611         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
2612         error= ; \
2613         if [ "x`echo $(VERSION_SUFFIX)|grep 'alpha'`" == "x" ]; then \
2614           expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
2615           if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
2616             echo "Incorrect version in README, expected $$expver" >&2; \
2617             error=1; \
2618           fi; \
2619           for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
2620               doc/security.rst; do \
2621             if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
2622               "Documents Ganeti version $$expver"; then \
2623               echo "Incorrect version in $$file, expected $$expver" >&2; \
2624               error=1; \
2625             fi; \
2626           done; \
2627           if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
2628             echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
2629             error=1; \
2630           fi; \
2631           if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
2632             ".. Last updated for Ganeti $$expver"; then \
2633             echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
2634             error=1; \
2635           fi; \
2636         fi; \
2637         for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
2638           if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
2639             echo "Longest line in $$file is longer than 80 characters" >&2; \
2640             error=1; \
2641           fi; \
2642         done; \
2643         test -z "$$error"
2644
2645 .PHONY: hs-test-%
2646 hs-test-%: test/hs/htest
2647         @rm -f htest.tix
2648         test/hs/htest -t $*
2649
2650 .PHONY: hs-tests
2651 hs-tests: test/hs/htest
2652         @rm -f htest.tix
2653         ./test/hs/htest
2654
2655 .PHONY: py-tests
2656 py-tests: $(python_tests) ganeti $(built_python_sources)
2657         error=; \
2658         for file in $(python_tests); \
2659           do if ! $(TESTS_ENVIRONMENT) $$file; then error=1; fi; \
2660         done; \
2661         test -z "$$error"
2662
2663 .PHONY: hs-shell-%
2664 hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2665             $(HS_BUILT_TEST_HELPERS)
2666         @rm -f hpc-htools.tix hpc-mon-collector.tix
2667         HBINARY="./test/hs/hpc-htools" \
2668         SHELLTESTARGS=$(SHELLTESTARGS) \
2669         ./test/hs/offline-test.sh $*
2670
2671 .PHONY: hs-shell
2672 hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
2673         @rm -f hpc-htools.tix hpc-mon-collector.tix
2674         HBINARY="./test/hs/hpc-htools" \
2675         SHELLTESTARGS=$(SHELLTESTARGS) \
2676         ./test/hs/offline-test.sh
2677
2678 .PHONY: hs-check
2679 hs-check: hs-tests hs-shell
2680
2681 # E111: indentation is not a multiple of four
2682 # E121: continuation line indentation is not a multiple of four
2683 #       (since our indent level is not 4)
2684 # E125: continuation line does not distinguish itself from next logical line
2685 #       (since our indent level is not 4)
2686 # E123: closing bracket does not match indentation of opening bracket's line
2687 # E127: continuation line over-indented for visual indent
2688 #       (since our indent level is not 4)
2689 # note: do NOT add E128 here; it's a valid style error in most cases!
2690 # I've seen real errors, but also some cases were we indent wrongly
2691 # due to line length; try to rework the cases where it is triggered,
2692 # instead of silencing it
2693 # E261: at least two spaces before inline comment
2694 # E501: line too long (80 characters)
2695 PEP8_IGNORE = E111,E121,E123,E125,E127,E261,E501
2696
2697 # For excluding pep8 expects filenames only, not whole paths
2698 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(built_python_sources))))
2699
2700 # A space-separated list of pylint warnings to completely ignore:
2701 # I0013 = disable warnings for ignoring whole files
2702 LINT_DISABLE = I0013
2703 # Additional pylint options
2704 LINT_OPTS =
2705 # The combined set of pylint options
2706 LINT_OPTS_ALL = $(LINT_OPTS) \
2707   $(addprefix --disable=,$(LINT_DISABLE))
2708
2709 LINT_TARGETS = pylint pylint-qa pylint-test
2710 if HAS_PEP8
2711 LINT_TARGETS += pep8
2712 endif
2713 if HAS_HLINT
2714 LINT_TARGETS += hlint
2715 endif
2716
2717 .PHONY: lint
2718 lint: $(LINT_TARGETS)
2719
2720 .PHONY: pylint
2721 pylint: $(GENERATED_FILES)
2722         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2723         $(PYLINT) $(LINT_OPTS_ALL) $(lint_python_code)
2724
2725 .PHONY: pylint-qa
2726 pylint-qa: $(GENERATED_FILES)
2727         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2728         cd $(top_srcdir)/qa && \
2729           PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS_ALL) \
2730                 --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2731 # FIXME: lint all test code, not just the newly added test support
2732 pylint-test: $(GENERATED_FILES)
2733         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2734         cd $(top_srcdir) && \
2735                 PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS_ALL) \
2736                 --rcfile=pylintrc-test  $(python_test_support) $(python_test_utils)
2737
2738 .PHONY: pep8
2739 pep8: $(GENERATED_FILES)
2740         @test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2741         $(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2742           --repeat $(pep8_python_code)
2743
2744 # FIXME: remove ignore "Use void" when GHC 6.x is deprecated
2745 HLINT_EXCLUDES = src/Ganeti/THH.hs test/hs/hpc-htools.hs
2746 .PHONY: hlint
2747 hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
2748         @test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
2749         @rm -f doc/hs-lint.html
2750         if tty -s; then C="-c"; else C=""; fi; \
2751         $(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
2752           --ignore "Use first" \
2753           --ignore "Use &&&" \
2754           --ignore "Use &&" \
2755           --ignore "Use ||" \
2756           --ignore "Use void" \
2757           --ignore "Reduce duplication" \
2758           --ignore "Use import/export shortcut" \
2759           --hint src/lint-hints \
2760           --cpp-file=$(HASKELL_PACKAGE_VERSIONS_FILE) \
2761           $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
2762         @if [ ! -f doc/hs-lint.html ]; then \
2763           echo "All good" > doc/hs-lint.html; \
2764         fi
2765
2766 # a dist hook rule for updating the vcs-version file; this is
2767 # hardcoded due to where it needs to build the file...
2768 dist-hook:
2769         $(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2770         rm -f $(top_distdir)/vcs-version
2771         cp -p $(srcdir)/vcs-version $(top_distdir)
2772
2773 # a distcheck hook rule for catching revision control directories
2774 distcheck-hook:
2775         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
2776           echo "Found revision control files in final archive." 1>&2; \
2777           exit 1; \
2778         fi
2779         if find $(top_distdir) -name '*.py[co]' | grep .; then \
2780           echo "Found Python byte code in final archive." 1>&2; \
2781           exit 1; \
2782         fi
2783         if find $(top_distdir) -name '*~' | grep .; then \
2784           echo "Found backup files in final archive." 1>&2; \
2785           exit 1; \
2786         fi
2787 # Empty files or directories should not be distributed. They can cause
2788 # unnecessary warnings for packagers. Directories used by automake during
2789 # distcheck must be excluded.
2790         if find $(top_distdir) -empty -and -not \( \
2791             -path $(top_distdir)/_build -or \
2792             -path $(top_distdir)/_inst \) | grep .; then \
2793           echo "Found empty files or directories in final archive." 1>&2; \
2794           exit 1; \
2795         fi
2796         if test -e $(top_distdir)/doc/man-html; then \
2797           echo "Found documentation including man pages in final archive" >&2; \
2798           exit 1; \
2799         fi
2800
2801 # Backwards compatible distcheck-release target
2802 distcheck-release: distcheck
2803
2804 distrebuildcheck: dist
2805         set -e; \
2806         builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2807         trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2808         cd $$builddir; \
2809         tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2810         cd $(distdir); \
2811         ./configure; \
2812         $(MAKE) maintainer-clean; \
2813         cp $(abs_srcdir)/vcs-version .; \
2814         ./configure; \
2815         $(MAKE) $(AM_MAKEFLAGS)
2816
2817 dist-release: dist
2818         set -e; \
2819         for i in $(DIST_ARCHIVES); do \
2820           echo -n "Checking $$i ... "; \
2821           autotools/check-tar < $$i; \
2822           echo OK; \
2823         done
2824
2825 install-exec-local:
2826         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
2827           "$(DESTDIR)${localstatedir}/log/ganeti" \
2828           "$(DESTDIR)${localstatedir}/run/ganeti"
2829         for dir in $(SYMLINK_TARGET_DIRS); do \
2830           @mkdir_p@  $(DESTDIR)$$dir; \
2831         done
2832         $(LN_S) -f $(sysconfdir)/ganeti/lib $(DESTDIR)$(defaultversiondir)
2833         $(LN_S) -f $(sysconfdir)/ganeti/share $(DESTDIR)$(defaultversionedsharedir)
2834         for prog in $(HS_BIN_ROLES); do \
2835           $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
2836         done
2837         $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
2838         for prog in $(all_sbin_scripts); do \
2839           $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2840         done
2841         for prog in $(gnt_scripts_basenames); do \
2842           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2843         done
2844         for prog in $(pkglib_python_basenames); do \
2845           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2846         done
2847         for prog in $(tools_python_basenames); do \
2848           $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2849         done
2850         for prog in $(tools_basenames); do \
2851           $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2852         done
2853         if ! test -n '$(ENABLE_MANPAGES)'; then \
2854           for man in $(manfullpath); do \
2855             $(LN_S) -f $(defaultversionedsharedir)/root$(MANDIR)/$$man $(DESTDIR)$(MANDIR)/$$man; \
2856           done; \
2857         fi
2858         for prog in $(myexeclib_scripts_basenames); do \
2859           $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2860         done
2861 if INSTALL_SYMLINKS
2862         $(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
2863         $(LN_S) -f $(versiondir) $(DESTDIR)$(sysconfdir)/ganeti/lib
2864 endif
2865
2866 .PHONY: apidoc
2867 if WANT_HSAPIDOC
2868 apidoc: py-apidoc hs-apidoc
2869 else
2870 apidoc: py-apidoc
2871 endif
2872
2873 .PHONY: py-apidoc
2874 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2875         env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2876         $(RUN_IN_TEMPDIR) epydoc -v \
2877           --conf $(CURDIR)/epydoc.conf \
2878           --output $(CURDIR)/$(APIDOC_PY_DIR)
2879
2880 .PHONY: hs-apidoc
2881 hs-apidoc: $(APIDOC_HS_DIR)/index.html
2882
2883 $(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
2884         @test -n "$(HSCOLOUR)" || \
2885             { echo 'HsColour' not found during configure; exit 1; }
2886         @test -n "$(HADDOCK)" || \
2887             { echo 'haddock' not found during configure; exit 1; }
2888         rm -rf $(APIDOC_HS_DIR)/*
2889         for i in $(ALL_APIDOC_HS_DIRS); do \
2890           @mkdir_p@ $$i; \
2891           $(HSCOLOUR) -print-css > $$i/hscolour.css; \
2892         done
2893         set -e ; \
2894         export LC_ALL=en_US.UTF-8; \
2895         OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
2896         OPTGHC="$$OPTGHC --optghc=-optP-include --optghc=-optP$(HASKELL_PACKAGE_VERSIONS_FILE)"; \
2897         for file in $(HS_LIBTESTBUILT_SRCS); do \
2898           f_nosrc=$${file##src/}; \
2899           f_notst=$${f_nosrc##test/hs/}; \
2900           f_html=$${f_notst%%.hs}.html; \
2901           $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
2902         done ; \
2903         $(HADDOCK) --odir $(APIDOC_HS_DIR) --html --hoogle --ignore-all-exports -w \
2904           -t ganeti -p src/haddock-prologue \
2905           --source-module="%{MODULE/.//}.html" \
2906           --source-entity="%{MODULE/.//}.html#%{NAME}" \
2907           $$OPTGHC \
2908           $(HS_LIBTESTBUILT_SRCS)
2909
2910 .PHONY: TAGS
2911 TAGS: $(GENERATED_FILES)
2912         rm -f TAGS
2913         $(GHC) -e ":etags TAGS_hs" -v0 \
2914           $(filter-out -O -Werror,$(HFLAGS)) \
2915                 -osuf tags.o \
2916                 -hisuf tags.hi \
2917     -lcurl \
2918           $(HS_LIBTEST_SRCS)
2919         find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2920           -path './daemons/ganeti-*' -o -path './tools/*' -o \
2921           -path './qa/*.py' | \
2922           etags --etags-include=TAGS_hs -L -
2923
2924 .PHONY: coverage
2925
2926 COVERAGE_TESTS=
2927 if HS_UNIT
2928 COVERAGE_TESTS += hs-coverage
2929 endif
2930 if PY_UNIT
2931 COVERAGE_TESTS += py-coverage
2932 endif
2933
2934 coverage: $(COVERAGE_TESTS)
2935
2936 test/py/docs_unittest.py: $(gnt_scripts)
2937
2938 .PHONY: py-coverage
2939 py-coverage: $(GENERATED_FILES) $(python_tests)
2940         @test -n "$(PYCOVERAGE)" || \
2941             { echo 'python-coverage' not found during configure; exit 1; }
2942         set -e; \
2943         COVERAGE=$(PYCOVERAGE) \
2944         COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2945         TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2946         HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2947         $(PLAIN_TESTS_ENVIRONMENT) \
2948         $(abs_top_srcdir)/autotools/gen-py-coverage \
2949         $(python_tests)
2950
2951 .PHONY: hs-coverage
2952 hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2953         rm -f *.tix
2954         $(MAKE) $(AM_MAKEFLAGS) hs-check
2955         @mkdir_p@ $(COVERAGE_HS_DIR)
2956         hpc sum --union $(HPCEXCL) \
2957           htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2958         hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2959         hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
2960         $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
2961
2962 # Special "kind-of-QA" target for htools, needs special setup (all
2963 # tools compiled with -fhpc)
2964 .PHONY: live-test
2965 live-test: all
2966         set -e ; \
2967         cd src; \
2968         rm -f .hpc; $(LN_S) ../.hpc .hpc; \
2969         rm -f *.tix *.mix; \
2970         ./live-test.sh; \
2971         hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
2972           --output=live-test.tix ; \
2973         @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
2974         hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
2975           --srcdir=.. $(HPCEXCL) ; \
2976         hpc report --srcdir=.. live-test $(HPCEXCL)
2977
2978 commit-check: autotools-check distcheck lint apidoc
2979
2980 autotools-check:
2981         TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
2982   $(abs_top_srcdir)/test/autotools/*-*.test \
2983   -- --hide-successes
2984
2985 .PHONY: gitignore-check
2986 gitignore-check:
2987         @if [ -n "`git status --short`" ]; then \
2988           echo "Git status is not clean!" 1>&2 ; \
2989           git status --short; \
2990           exit 1; \
2991         fi
2992
2993 # target to rebuild all man pages (both groff and html output)
2994 .PHONY: man
2995 man: $(man_MANS) $(manhtml)
2996
2997 CABAL_EXECUTABLES = $(HS_DEFAULT_PROGS)
2998 CABAL_EXECUTABLES_HS = $(patsubst %,%.hs,$(CABAL_EXECUTABLES))
2999 CABAL_EXECUTABLES_APPS_STAMPS = $(patsubst src/%,apps/%.hs.stamp,$(patsubst test/hs/%,apps/%.hs.stamp,$(CABAL_EXECUTABLES)))
3000
3001 # Executable symlinks
3002 apps/%.hs.stamp: Makefile
3003         mkdir -p apps
3004         rm -f $(basename $@)
3005         ln -s ../$(filter %/$(basename $(notdir $@)),$(CABAL_EXECUTABLES_HS)) $(basename $@)
3006         touch $@
3007
3008 # Builds the cabal file
3009 ganeti.cabal: cabal/ganeti.template.cabal Makefile cabal/cabal-from-modules.py $(CABAL_EXECUTABLES_APPS_STAMPS)
3010         @echo $(subst /,.,$(patsubst %.hs,%,$(patsubst test/hs/%,%,$(patsubst src/%,%,$(HS_SRCS))))) \
3011           | python $(abs_top_srcdir)/cabal/cabal-from-modules.py $(abs_top_srcdir)/cabal/ganeti.template.cabal > $@
3012
3013         for p in $(CABAL_EXECUTABLES); do \
3014           echo                                   >> $@; \
3015           echo "executable `basename $$p`"       >> $@; \
3016           echo "  hs-source-dirs: apps"          >> $@; \
3017           echo "  main-is: `basename $$p`.hs"    >> $@; \
3018           echo "  default-language: Haskell2010" >> $@; \
3019           echo "  build-depends:"                >> $@; \
3020           echo "      base"                      >> $@; \
3021           echo "    , ganeti"                    >> $@; \
3022           if [ $$p == test/hs/htest ]; then \
3023             echo "    , hslogger"                  >> $@; \
3024             echo "    , test-framework"            >> $@; \
3025           elif [ $$p == src/rpc-test ]; then \
3026             echo "    , json"                      >> $@; \
3027           fi \
3028         done
3029
3030 # Target that builds all binaries (including those that are not
3031 # rebuilt except when running the tests)
3032 .PHONY: really-all
3033 really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
3034
3035 # we don't need the ancient implicit rules:
3036 %: %,v
3037 %: RCS/%,v
3038 %: RCS/%
3039 %: s.%
3040 %: SCCS/s.%
3041
3042 -include ./Makefile.local
3043
3044 # support inspecting the value of a make variable
3045
3046 print-%:
3047         @echo $($*)
3048
3049 # vim: set noet :