Replace htools→hs in configure/makefile rules
[ganeti-local] / 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 # Automake doesn't export these variables before version 1.10.
9 abs_top_builddir = @abs_top_builddir@
10 abs_top_srcdir = @abs_top_srcdir@
11
12 # Helper values for calling builtin functions
13 empty :=
14 space := $(empty) $(empty)
15 comma := ,
16
17 # Use bash in order to be able to use pipefail
18 SHELL=/bin/bash
19
20 ACLOCAL_AMFLAGS = -I autotools
21 BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
22 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
23 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
24 CHECK_HEADER = $(top_srcdir)/autotools/check-header
25 CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
26 CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
27 CHECK_VERSION = $(top_srcdir)/autotools/check-version
28 CHECK_NEWS = $(top_srcdir)/autotools/check-news
29 CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
30 DOCPP = $(top_srcdir)/autotools/docpp
31 REPLACE_VARS_SED = autotools/replace_vars.sed
32 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
33 BUILD_RPC = $(top_srcdir)/autotools/build-rpc
34 SHELL_ENV_INIT = autotools/shell-env-init
35
36 # Note: these are automake-specific variables, and must be named after
37 # the directory + 'dir' suffix
38 clientdir = $(pkgpythondir)/client
39 hypervisordir = $(pkgpythondir)/hypervisor
40 httpdir = $(pkgpythondir)/http
41 masterddir = $(pkgpythondir)/masterd
42 confddir = $(pkgpythondir)/confd
43 rapidir = $(pkgpythondir)/rapi
44 serverdir = $(pkgpythondir)/server
45 watcherdir = $(pkgpythondir)/watcher
46 impexpddir = $(pkgpythondir)/impexpd
47 utilsdir = $(pkgpythondir)/utils
48 toolsdir = $(pkglibdir)/tools
49 iallocatorsdir = $(pkglibdir)/iallocators
50 pytoolsdir = $(pkgpythondir)/tools
51 docdir = $(datadir)/doc/$(PACKAGE)
52 myexeclibdir = $(pkglibdir)
53
54 # Delete output file if an error occurred while building it
55 .DELETE_ON_ERROR:
56
57 HS_DIRS = \
58         src \
59         src/Ganeti \
60         src/Ganeti/Block \
61         src/Ganeti/Block/Drbd \
62         src/Ganeti/Confd \
63         src/Ganeti/DataCollectors \
64         src/Ganeti/HTools \
65         src/Ganeti/HTools/Backend \
66         src/Ganeti/HTools/Program \
67         src/Ganeti/Query \
68         htest \
69         htest/Test \
70         htest/Test/Ganeti \
71         htest/Test/Ganeti/Block \
72         htest/Test/Ganeti/Block/Drbd \
73         htest/Test/Ganeti/Confd \
74         htest/Test/Ganeti/HTools \
75         htest/Test/Ganeti/HTools/Backend \
76         htest/Test/Ganeti/Query
77
78 DIRS = \
79         $(HS_DIRS) \
80         autotools \
81         daemons \
82         devel \
83         doc \
84         doc/examples \
85         doc/examples/gnt-debug \
86         doc/examples/hooks \
87         htest/data \
88         htest/data/rapi \
89         htest/shelltests \
90         lib \
91         lib/build \
92         lib/client \
93         lib/confd \
94         lib/http \
95         lib/hypervisor \
96         lib/impexpd \
97         lib/masterd \
98         lib/rapi \
99         lib/server \
100         lib/tools \
101         lib/utils \
102         lib/watcher \
103         man \
104         qa \
105         test \
106         test/data \
107         test/data/ovfdata \
108         test/data/ovfdata/other \
109         tools
110
111 ALL_APIDOC_HS_DIRS = \
112         $(APIDOC_HS_DIR) \
113         $(APIDOC_HS_DIR)/Ganeti \
114         $(APIDOC_HS_DIR)/Ganeti/Block \
115         $(APIDOC_HS_DIR)/Ganeti/Block/Drbd \
116         $(APIDOC_HS_DIR)/Ganeti/Confd \
117         $(APIDOC_HS_DIR)/Ganeti/DataCollectors \
118         $(APIDOC_HS_DIR)/Ganeti/HTools \
119         $(APIDOC_HS_DIR)/Ganeti/HTools/Backend \
120         $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
121         $(APIDOC_HS_DIR)/Ganeti/Query
122
123 BUILDTIME_DIR_AUTOCREATE = \
124         scripts \
125         $(APIDOC_DIR) \
126         $(ALL_APIDOC_HS_DIRS) \
127         $(APIDOC_PY_DIR) \
128         $(COVERAGE_DIR) \
129         $(COVERAGE_HS_DIR) \
130         $(COVERAGE_PY_DIR) \
131         .hpc
132
133 BUILDTIME_DIRS = \
134         $(BUILDTIME_DIR_AUTOCREATE) \
135         doc/html
136
137 DIRCHECK_EXCLUDE = \
138         $(BUILDTIME_DIRS) \
139         ganeti-[0-9]*.[0-9]*.[0-9]* \
140         doc/html/_* \
141         autom4te.cache
142
143 # some helper vars
144 COVERAGE_DIR = doc/coverage
145 COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
146 COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
147 APIDOC_DIR = doc/api
148 APIDOC_PY_DIR = $(APIDOC_DIR)/py
149 APIDOC_HS_DIR = $(APIDOC_DIR)/hs
150
151 MAINTAINERCLEANFILES = \
152         $(docpng) \
153         $(maninput) \
154         doc/install-quick.rst \
155         doc/news.rst \
156         doc/upgrade.rst \
157         vcs-version
158
159 maintainer-clean-local:
160         rm -rf $(BUILDTIME_DIRS)
161
162 CLEANFILES = \
163         $(addsuffix /*.py[co],$(DIRS)) \
164         $(addsuffix /*.hi,$(HS_DIRS)) \
165         $(addsuffix /*.o,$(HS_DIRS)) \
166         $(PYTHON_BOOTSTRAP) \
167         epydoc.conf \
168         $(REPLACE_VARS_SED) \
169         $(SHELL_ENV_INIT) \
170         daemons/daemon-util \
171         daemons/ganeti-cleaner \
172         $(BUILT_EXAMPLES) \
173         doc/examples/bash_completion \
174         doc/examples/bash_completion-debug \
175         lib/_generated_rpc.py \
176         $(man_MANS) \
177         $(manhtml) \
178         tools/kvm-ifup \
179         tools/vcluster-setup \
180         stamp-directories \
181         stamp-srclinks \
182         $(nodist_pkgpython_PYTHON) \
183         $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
184         $(HS_BUILT_TEST_HELPERS) \
185         src/ganeti-confd \
186         .hpc/*.mix src/*.tix htest/*.tix \
187         doc/hs-lint.html
188
189 GENERATED_FILES = \
190         $(built_base_sources) \
191         $(BUILT_PYTHON_SOURCES) \
192         $(PYTHON_BOOTSTRAP)
193
194 HS_GENERATED_FILES =
195 if WANT_HTOOLS
196 HS_GENERATED_FILES += $(HS_PROGS)
197 if ENABLE_CONFD
198 HS_GENERATED_FILES += src/hconfd src/ganeti-confd
199 endif
200 endif
201
202 built_base_sources = \
203         stamp-directories \
204         stamp-srclinks
205
206 built_python_base_sources = \
207         lib/_autoconf.py \
208         lib/_vcsversion.py
209
210 BUILT_PYTHON_SOURCES = \
211         $(built_python_base_sources) \
212         lib/_generated_rpc.py
213
214 # Generating the RPC wrappers depends on many things, so make sure
215 # it's built at the end of the built sources
216 lib/_generated_rpc.py: | $(built_base_sources) $(built_python_base_sources)
217
218 # these are all built from the underlying %.in sources
219 BUILT_EXAMPLES = \
220         doc/examples/ganeti-kvm-poweroff.initd \
221         doc/examples/ganeti.cron \
222         doc/examples/ganeti.initd \
223         doc/examples/ganeti-master-role.ocf \
224         doc/examples/ganeti-node-role.ocf \
225         doc/examples/gnt-config-backup \
226         doc/examples/hooks/ipsec
227
228 nodist_pkgpython_PYTHON = \
229         $(BUILT_PYTHON_SOURCES)
230
231 noinst_PYTHON = \
232         lib/build/__init__.py \
233         lib/build/shell_example_lexer.py \
234         lib/build/sphinx_ext.py
235
236 pkgpython_PYTHON = \
237         lib/__init__.py \
238         lib/asyncnotifier.py \
239         lib/backend.py \
240         lib/bdev.py \
241         lib/bootstrap.py \
242         lib/cli.py \
243         lib/cmdlib.py \
244         lib/compat.py \
245         lib/config.py \
246         lib/constants.py \
247         lib/daemon.py \
248         lib/errors.py \
249         lib/ht.py \
250         lib/jqueue.py \
251         lib/jstore.py \
252         lib/locking.py \
253         lib/luxi.py \
254         lib/mcpu.py \
255         lib/netutils.py \
256         lib/objects.py \
257         lib/objectutils.py \
258         lib/opcodes.py \
259         lib/ovf.py \
260         lib/pathutils.py \
261         lib/qlang.py \
262         lib/query.py \
263         lib/rpc.py \
264         lib/rpc_defs.py \
265         lib/runtime.py \
266         lib/serializer.py \
267         lib/ssconf.py \
268         lib/ssh.py \
269         lib/storage.py \
270         lib/uidpool.py \
271         lib/vcluster.py \
272         lib/network.py \
273         lib/workerpool.py
274
275 client_PYTHON = \
276         lib/client/__init__.py \
277         lib/client/gnt_backup.py \
278         lib/client/gnt_cluster.py \
279         lib/client/gnt_debug.py \
280         lib/client/gnt_group.py \
281         lib/client/gnt_instance.py \
282         lib/client/gnt_job.py \
283         lib/client/gnt_node.py \
284         lib/client/gnt_network.py \
285         lib/client/gnt_os.py \
286         lib/client/gnt_storage.py
287
288 hypervisor_PYTHON = \
289         lib/hypervisor/__init__.py \
290         lib/hypervisor/hv_base.py \
291         lib/hypervisor/hv_chroot.py \
292         lib/hypervisor/hv_fake.py \
293         lib/hypervisor/hv_kvm.py \
294         lib/hypervisor/hv_lxc.py \
295         lib/hypervisor/hv_xen.py
296
297 rapi_PYTHON = \
298         lib/rapi/__init__.py \
299         lib/rapi/baserlib.py \
300         lib/rapi/client.py \
301         lib/rapi/client_utils.py \
302         lib/rapi/connector.py \
303         lib/rapi/rlib2.py \
304         lib/rapi/testutils.py
305
306 http_PYTHON = \
307         lib/http/__init__.py \
308         lib/http/auth.py \
309         lib/http/client.py \
310         lib/http/server.py
311
312 confd_PYTHON = \
313         lib/confd/__init__.py \
314         lib/confd/client.py
315
316 masterd_PYTHON = \
317         lib/masterd/__init__.py \
318         lib/masterd/iallocator.py \
319         lib/masterd/instance.py
320
321 impexpd_PYTHON = \
322         lib/impexpd/__init__.py
323
324 watcher_PYTHON = \
325         lib/watcher/__init__.py \
326         lib/watcher/nodemaint.py \
327         lib/watcher/state.py
328
329 server_PYTHON = \
330         lib/server/__init__.py \
331         lib/server/masterd.py \
332         lib/server/noded.py \
333         lib/server/rapi.py
334
335 pytools_PYTHON = \
336         lib/tools/__init__.py \
337         lib/tools/ensure_dirs.py \
338         lib/tools/node_cleanup.py \
339         lib/tools/node_daemon_setup.py \
340         lib/tools/prepare_node_join.py
341
342 utils_PYTHON = \
343         lib/utils/__init__.py \
344         lib/utils/algo.py \
345         lib/utils/filelock.py \
346         lib/utils/hash.py \
347         lib/utils/io.py \
348         lib/utils/log.py \
349         lib/utils/lvm.py \
350         lib/utils/mlock.py \
351         lib/utils/nodesetup.py \
352         lib/utils/process.py \
353         lib/utils/retry.py \
354         lib/utils/text.py \
355         lib/utils/wrapper.py \
356         lib/utils/x509.py
357
358 docrst = \
359         doc/admin.rst \
360         doc/cluster-merge.rst \
361         doc/design-2.0.rst \
362         doc/design-2.1.rst \
363         doc/design-2.2.rst \
364         doc/design-2.3.rst \
365         doc/design-2.4.rst \
366         doc/design-2.5.rst \
367         doc/design-2.6.rst \
368         doc/design-2.7.rst \
369         doc/design-autorepair.rst \
370         doc/design-bulk-create.rst \
371         doc/design-chained-jobs.rst \
372         doc/design-cpu-pinning.rst \
373         doc/design-draft.rst \
374         doc/design-htools-2.3.rst \
375         doc/design-http-server.rst \
376         doc/design-impexp2.rst \
377         doc/design-lu-generated-jobs.rst \
378         doc/design-linuxha.rst \
379         doc/design-multi-reloc.rst \
380         doc/design-network.rst \
381         doc/design-node-add.rst \
382         doc/design-oob.rst \
383         doc/design-ovf-support.rst \
384         doc/design-opportunistic-locking.rst \
385         doc/design-partitioned.rst \
386         doc/design-query-splitting.rst \
387         doc/design-query2.rst \
388         doc/design-remote-commands.rst \
389         doc/design-resource-model.rst \
390         doc/design-shared-storage.rst \
391         doc/design-monitoring-agent.rst \
392         doc/design-virtual-clusters.rst \
393         doc/design-x509-ca.rst \
394         doc/devnotes.rst \
395         doc/glossary.rst \
396         doc/hooks.rst \
397         doc/iallocator.rst \
398         doc/index.rst \
399         doc/install-quick.rst \
400         doc/install.rst \
401         doc/locking.rst \
402         doc/move-instance.rst \
403         doc/news.rst \
404         doc/ovfconverter.rst \
405         doc/rapi.rst \
406         doc/security.rst \
407         doc/upgrade.rst \
408         doc/virtual-cluster.rst \
409         doc/walkthrough.rst
410
411 HS_PROGS = src/htools src/mon-collector
412 HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
413 HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
414
415 HS_ALL_PROGS = \
416         $(HS_PROGS) \
417         htest/hpc-htools \
418         htest/hpc-mon-collector \
419         htest/test \
420         src/hconfd \
421         src/rpc-test
422
423 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
424 HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
425
426 HFLAGS = \
427         -O -Wall -Werror -isrc \
428         -fwarn-monomorphism-restriction \
429         -fwarn-tabs \
430         $(GHC_BYVERSION_FLAGS)
431
432 # extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
433 HEXTRA =
434 # internal extra flags (used for htest/test mainly)
435 HEXTRA_INT =
436 # exclude options for coverage reports
437 HPCEXCL = --exclude Main \
438         --exclude Ganeti.Constants \
439         --exclude Ganeti.HTools.QC \
440         --exclude Ganeti.THH \
441         --exclude Ganeti.Version \
442         --exclude Test.Ganeti.Attoparsec \
443         --exclude Test.Ganeti.TestCommon \
444         --exclude Test.Ganeti.TestHTools \
445         --exclude Test.Ganeti.TestHelper \
446         --exclude Test.Ganeti.TestImports \
447         $(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
448
449 HS_LIB_SRCS = \
450         src/Ganeti/Block/Drbd/Types.hs \
451         src/Ganeti/Block/Drbd/Parser.hs \
452         src/Ganeti/BasicTypes.hs \
453         src/Ganeti/Common.hs \
454         src/Ganeti/Compat.hs \
455         src/Ganeti/Confd/Client.hs \
456         src/Ganeti/Confd/Server.hs \
457         src/Ganeti/Confd/Types.hs \
458         src/Ganeti/Confd/Utils.hs \
459         src/Ganeti/Config.hs \
460         src/Ganeti/Daemon.hs \
461         src/Ganeti/DataCollectors/CLI.hs \
462         src/Ganeti/DataCollectors/Drbd.hs \
463         src/Ganeti/DataCollectors/Program.hs \
464         src/Ganeti/Errors.hs \
465         src/Ganeti/HTools/Backend/IAlloc.hs \
466         src/Ganeti/HTools/Backend/Luxi.hs \
467         src/Ganeti/HTools/Backend/Rapi.hs \
468         src/Ganeti/HTools/Backend/Simu.hs \
469         src/Ganeti/HTools/Backend/Text.hs \
470         src/Ganeti/HTools/CLI.hs \
471         src/Ganeti/HTools/Cluster.hs \
472         src/Ganeti/HTools/Container.hs \
473         src/Ganeti/HTools/ExtLoader.hs \
474         src/Ganeti/HTools/Graph.hs \
475         src/Ganeti/HTools/Group.hs \
476         src/Ganeti/HTools/Instance.hs \
477         src/Ganeti/HTools/Loader.hs \
478         src/Ganeti/HTools/Node.hs \
479         src/Ganeti/HTools/PeerMap.hs \
480         src/Ganeti/HTools/Program.hs \
481         src/Ganeti/HTools/Program/Hail.hs \
482         src/Ganeti/HTools/Program/Hbal.hs \
483         src/Ganeti/HTools/Program/Hcheck.hs \
484         src/Ganeti/HTools/Program/Hinfo.hs \
485         src/Ganeti/HTools/Program/Hscan.hs \
486         src/Ganeti/HTools/Program/Hspace.hs \
487         src/Ganeti/HTools/Program/Hroller.hs \
488         src/Ganeti/HTools/Types.hs \
489         src/Ganeti/Hash.hs \
490         src/Ganeti/JQueue.hs \
491         src/Ganeti/JSON.hs \
492         src/Ganeti/Jobs.hs \
493         src/Ganeti/Logging.hs \
494         src/Ganeti/Luxi.hs \
495         src/Ganeti/Network.hs \
496         src/Ganeti/Objects.hs \
497         src/Ganeti/OpCodes.hs \
498         src/Ganeti/OpParams.hs \
499         src/Ganeti/Path.hs \
500         src/Ganeti/Query/Common.hs \
501         src/Ganeti/Query/Filter.hs \
502         src/Ganeti/Query/Group.hs \
503         src/Ganeti/Query/Job.hs \
504         src/Ganeti/Query/Language.hs \
505         src/Ganeti/Query/Node.hs \
506         src/Ganeti/Query/Query.hs \
507         src/Ganeti/Query/Server.hs \
508         src/Ganeti/Query/Types.hs \
509         src/Ganeti/Rpc.hs \
510         src/Ganeti/Runtime.hs \
511         src/Ganeti/Ssconf.hs \
512         src/Ganeti/THH.hs \
513         src/Ganeti/Types.hs \
514         src/Ganeti/Utils.hs
515
516 HS_TEST_SRCS = \
517         htest/Test/Ganeti/Attoparsec.hs \
518         htest/Test/Ganeti/BasicTypes.hs \
519         htest/Test/Ganeti/Block/Drbd/Parser.hs \
520         htest/Test/Ganeti/Block/Drbd/Types.hs \
521         htest/Test/Ganeti/Common.hs \
522         htest/Test/Ganeti/Confd/Types.hs \
523         htest/Test/Ganeti/Confd/Utils.hs \
524         htest/Test/Ganeti/Daemon.hs \
525         htest/Test/Ganeti/Errors.hs \
526         htest/Test/Ganeti/HTools/Backend/Simu.hs \
527         htest/Test/Ganeti/HTools/Backend/Text.hs \
528         htest/Test/Ganeti/HTools/CLI.hs \
529         htest/Test/Ganeti/HTools/Cluster.hs \
530         htest/Test/Ganeti/HTools/Container.hs \
531         htest/Test/Ganeti/HTools/Graph.hs \
532         htest/Test/Ganeti/HTools/Instance.hs \
533         htest/Test/Ganeti/HTools/Loader.hs \
534         htest/Test/Ganeti/HTools/Node.hs \
535         htest/Test/Ganeti/HTools/PeerMap.hs \
536         htest/Test/Ganeti/HTools/Types.hs \
537         htest/Test/Ganeti/JSON.hs \
538         htest/Test/Ganeti/Jobs.hs \
539         htest/Test/Ganeti/JQueue.hs \
540         htest/Test/Ganeti/Luxi.hs \
541         htest/Test/Ganeti/Network.hs \
542         htest/Test/Ganeti/Objects.hs \
543         htest/Test/Ganeti/OpCodes.hs \
544         htest/Test/Ganeti/Query/Filter.hs \
545         htest/Test/Ganeti/Query/Language.hs \
546         htest/Test/Ganeti/Query/Query.hs \
547         htest/Test/Ganeti/Rpc.hs \
548         htest/Test/Ganeti/Ssconf.hs \
549         htest/Test/Ganeti/THH.hs \
550         htest/Test/Ganeti/TestCommon.hs \
551         htest/Test/Ganeti/TestHTools.hs \
552         htest/Test/Ganeti/TestHelper.hs \
553         htest/Test/Ganeti/Types.hs \
554         htest/Test/Ganeti/Utils.hs
555
556 HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
557
558 HS_BUILT_SRCS = \
559         htest/Test/Ganeti/TestImports.hs \
560         src/Ganeti/Constants.hs \
561         src/Ganeti/Version.hs
562 HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
563
564 $(RUN_IN_TEMPDIR): | stamp-directories
565
566 # Note: we use here an order-only prerequisite, as the contents of
567 # _autoconf.py are not actually influencing the html build output: it
568 # has to exist in order for the sphinx module to be loaded
569 # successfully, but we certainly don't want the docs to be rebuilt if
570 # it changes
571 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
572         $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
573         lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
574         | $(BUILT_PYTHON_SOURCES)
575         @test -n "$(SPHINX)" || \
576             { echo 'sphinx-build' not found during configure; exit 1; }
577         @mkdir_p@ $(dir $@)
578         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
579             -d . \
580             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
581             -D release="$(PACKAGE_VERSION)" \
582             $(abs_top_srcdir)/doc $(CURDIR)/doc/html
583         rm -f doc/html/.buildinfo doc/html/objects.inv
584         touch $@
585
586 doc/html: doc/html/index.html
587
588 doc/install-quick.rst: INSTALL
589 doc/news.rst: NEWS
590 doc/upgrade.rst: UPGRADE
591
592 doc/install-quick.rst doc/news.rst doc/upgrade.rst:
593         set -e; \
594         { echo '.. This file is automatically updated at build time from $<.'; \
595           echo '.. Do not edit.'; \
596           echo; \
597           cat $<; \
598         } > $@
599
600 docdot = \
601         doc/arch-2.0.dot \
602         doc/design-2.1-lock-acquire.dot \
603         doc/design-2.1-lock-release.dot
604
605 docpng = $(patsubst %.dot,%.png,$(docdot))
606
607 # Things to build but not to install (add it to EXTRA_DIST if it should be
608 # distributed)
609 noinst_DATA = \
610         doc/html \
611         $(BUILT_EXAMPLES) \
612         doc/examples/bash_completion \
613         doc/examples/bash_completion-debug \
614         $(manhtml)
615
616 gnt_scripts = \
617         scripts/gnt-backup \
618         scripts/gnt-cluster \
619         scripts/gnt-debug \
620         scripts/gnt-group \
621         scripts/gnt-instance \
622         scripts/gnt-job \
623         scripts/gnt-network \
624         scripts/gnt-node \
625         scripts/gnt-os \
626         scripts/gnt-storage
627
628 PYTHON_BOOTSTRAP_SBIN = \
629         daemons/ganeti-masterd \
630         daemons/ganeti-noded \
631         daemons/ganeti-rapi \
632         daemons/ganeti-watcher \
633         $(gnt_scripts)
634
635 PYTHON_BOOTSTRAP = \
636         $(PYTHON_BOOTSTRAP_SBIN) \
637         tools/ensure-dirs \
638         tools/node-cleanup \
639         tools/node-daemon-setup \
640         tools/prepare-node-join
641
642 qa_scripts = \
643         qa/__init__.py \
644         qa/ganeti-qa.py \
645         qa/qa_cluster.py \
646         qa/qa_config.py \
647         qa/qa_daemon.py \
648         qa/qa_env.py \
649         qa/qa_error.py \
650         qa/qa_group.py \
651         qa/qa_instance.py \
652         qa/qa_job.py \
653         qa/qa_node.py \
654         qa/qa_os.py \
655         qa/qa_rapi.py \
656         qa/qa_tags.py \
657         qa/qa_utils.py
658
659 bin_SCRIPTS =
660 if WANT_HTOOLS
661 bin_SCRIPTS += $(filter-out src/hail,$(HS_PROGS))
662 install-exec-hook:
663         @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
664 # FIXME: this is a hardcoded logic, instead of auto-resolving
665         $(LN_S) -f ../../../bin/htools \
666           $(DESTDIR)$(iallocatorsdir)/hail
667         for role in $(HS_BIN_ROLES); do \
668           $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
669         done
670 endif
671
672 $(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
673         @if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
674           echo "Error: cannot run unittests without the development" \
675                " libraries (see devnotes.rst)" 1>&2; \
676           exit 1; \
677         fi
678         @rm -f $(notdir $@).tix
679         $(GHC) --make \
680           $(HFLAGS) \
681           $(HS_NOCURL) $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
682           -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
683           $(HEXTRA) $(HEXTRA_INT) $@
684         @touch "$@"
685
686 # for the htest/test binary, we need to enable profiling/coverage
687 htest/test: HEXTRA_INT=-fhpc -ihtest
688
689 # we compile the hpc-htools binary with the program coverage
690 htest/hpc-htools: HEXTRA_INT=-fhpc
691
692 # we compile the hpc-mon-collector binary with the program coverage
693 htest/hpc-mon-collector: HEXTRA_INT=-fhpc
694
695 # test dependency
696 htest/offline-tests.sh: htest/hpc-htools htest/hpc-mon-collector
697
698 # rules for building profiling-enabled versions of the haskell
699 # programs: hs-prof does the full two-step build, whereas
700 # hs-prof-quick does only the final rebuild (hs-prof must have been
701 # run before)
702 .PHONY: hs-prof hs-prof-quick
703 hs-prof:
704         @if [ -z "$(TARGET)" ]; then \
705           echo "You need to define TARGET when running this rule" 1>&2; \
706           exit 1; \
707         fi
708         $(MAKE) $(AM_MAKEFLAGS) clean
709         $(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o"
710         rm -f $(HS_ALL_PROGS)
711         $(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
712
713 hs-prof-quick:
714         @if [ -z "$(TARGET)" ]; then \
715           echo "You need to define TARGET when running this rule" 1>&2; \
716           exit 1; \
717         fi
718         $(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf prof_o -prof -auto-all"
719
720 dist_sbin_SCRIPTS = \
721         tools/ganeti-listrunner
722
723 nodist_sbin_SCRIPTS = \
724         $(PYTHON_BOOTSTRAP_SBIN) \
725         daemons/ganeti-cleaner
726
727 if ENABLE_CONFD
728 src/ganeti-confd: src/hconfd
729         cp -f $< $@
730
731 nodist_sbin_SCRIPTS += src/ganeti-confd
732 endif
733
734 python_scripts = \
735         tools/burnin \
736         tools/cfgshell \
737         tools/cfgupgrade \
738         tools/cfgupgrade12 \
739         tools/cluster-merge \
740         tools/confd-client \
741         tools/fmtjson \
742         tools/lvmstrap \
743         tools/move-instance \
744         tools/ovfconverter \
745         tools/sanitize-config
746
747 dist_tools_SCRIPTS = \
748         $(python_scripts) \
749         tools/kvm-console-wrapper \
750         tools/master-ip-setup \
751         tools/xen-console-wrapper
752
753 nodist_tools_python_scripts = \
754         tools/node-cleanup
755
756 nodist_tools_SCRIPTS = \
757         $(nodist_tools_python_scripts) \
758         tools/vcluster-setup
759
760 pkglib_python_scripts = \
761         daemons/import-export \
762         tools/check-cert-expired
763
764 nodist_pkglib_python_scripts = \
765         tools/ensure-dirs \
766         tools/node-daemon-setup \
767         tools/prepare-node-join
768
769 myexeclib_SCRIPTS = \
770         daemons/daemon-util \
771         tools/kvm-ifup \
772         $(pkglib_python_scripts) \
773         src/mon-collector
774
775 nodist_myexeclib_SCRIPTS = \
776         $(nodist_pkglib_python_scripts)
777
778 EXTRA_DIST = \
779         NEWS \
780         UPGRADE \
781         epydoc.conf.in \
782         pylintrc \
783         autotools/build-bash-completion \
784         autotools/build-rpc \
785         autotools/check-header \
786         autotools/check-imports \
787         autotools/check-man-dashes \
788         autotools/check-man-warnings \
789         autotools/check-news \
790         autotools/check-python-code \
791         autotools/check-tar \
792         autotools/check-version \
793         autotools/convert-constants \
794         autotools/docpp \
795         autotools/gen-coverage \
796         autotools/testrunner \
797         autotools/wrong-hardcoded-paths \
798         $(RUN_IN_TEMPDIR) \
799         daemons/daemon-util.in \
800         daemons/ganeti-cleaner.in \
801         $(pkglib_python_scripts) \
802         devel/upload \
803         tools/kvm-ifup.in \
804         tools/vcluster-setup.in \
805         $(docdot) \
806         $(docpng) \
807         $(docrst) \
808         doc/conf.py \
809         doc/html \
810         $(BUILT_EXAMPLES:%=%.in) \
811         doc/examples/ganeti.default \
812         doc/examples/ganeti.default-debug \
813         doc/examples/hooks/ethers \
814         doc/examples/gnt-debug/README \
815         doc/examples/gnt-debug/delay0.json \
816         doc/examples/gnt-debug/delay50.json \
817         test/lockperf.py \
818         test/testutils.py \
819         test/mocks.py \
820         $(dist_TESTS) \
821         $(TEST_FILES) \
822         man/footer.rst \
823         $(manrst) \
824         $(maninput) \
825         qa/qa-sample.json \
826         $(qa_scripts) \
827         $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
828         $(HS_PROG_SRCS) \
829         src/lint-hints.hs \
830         htest/cli-tests-defs.sh \
831         htest/offline-test.sh \
832         .ghci
833
834 man_MANS = \
835         man/ganeti-cleaner.8 \
836         man/ganeti-confd.8 \
837         man/ganeti-listrunner.8 \
838         man/ganeti-masterd.8 \
839         man/ganeti-noded.8 \
840         man/ganeti-os-interface.7 \
841         man/ganeti-extstorage-interface.7 \
842         man/ganeti-rapi.8 \
843         man/ganeti-watcher.8 \
844         man/ganeti.7 \
845         man/gnt-backup.8 \
846         man/gnt-cluster.8 \
847         man/gnt-debug.8 \
848         man/gnt-group.8 \
849         man/gnt-network.8 \
850         man/gnt-instance.8 \
851         man/gnt-job.8 \
852         man/gnt-node.8 \
853         man/gnt-os.8 \
854         man/gnt-storage.8 \
855         man/hail.1 \
856         man/hbal.1 \
857         man/hcheck.1 \
858         man/hinfo.1 \
859         man/hscan.1 \
860         man/hspace.1 \
861         man/hroller.1 \
862         man/htools.1 \
863         man/mon-collector.7
864
865 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
866 manhtml = $(patsubst %.rst,%.html,$(manrst))
867 mangen = $(patsubst %.rst,%.gen,$(manrst))
868 maninput = \
869         $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
870         $(patsubst %.html,%.html.in,$(manhtml)) \
871         man/footer.man man/footer.html $(mangen)
872
873 TEST_FILES = \
874         htest/data/clean-nonzero-score.data \
875         htest/data/common-suffix.data \
876         htest/data/empty-cluster.data \
877         htest/data/hail-alloc-drbd.json \
878         htest/data/hail-change-group.json \
879         htest/data/hail-invalid-reloc.json \
880         htest/data/hail-node-evac.json \
881         htest/data/hail-reloc-drbd.json \
882         htest/data/hbal-excl-tags.data \
883         htest/data/hbal-split-insts.data \
884         htest/data/invalid-node.data \
885         htest/data/missing-resources.data \
886         htest/data/n1-failure.data \
887         htest/data/rapi/groups.json \
888         htest/data/rapi/info.json \
889         htest/data/rapi/instances.json \
890         htest/data/rapi/nodes.json \
891         htest/shelltests/htools-balancing.test \
892         htest/shelltests/htools-basic.test \
893         htest/shelltests/htools-dynutil.test \
894         htest/shelltests/htools-excl.test \
895         htest/shelltests/htools-hail.test \
896         htest/shelltests/htools-hspace.test \
897         htest/shelltests/htools-invalid.test \
898         htest/shelltests/htools-multi-group.test \
899         htest/shelltests/htools-no-backend.test \
900         htest/shelltests/htools-rapi.test \
901         htest/shelltests/htools-single-group.test \
902         htest/shelltests/htools-text-backend.test \
903         htest/shelltests/htools-mon-collector.test \
904         test/data/bdev-drbd-8.0.txt \
905         test/data/bdev-drbd-8.3.txt \
906         test/data/bdev-drbd-disk.txt \
907         test/data/bdev-drbd-net-ip4.txt \
908         test/data/bdev-drbd-net-ip6.txt \
909         test/data/cert1.pem \
910         test/data/cert2.pem \
911         test/data/ip-addr-show-dummy0.txt \
912         test/data/ip-addr-show-lo-ipv4.txt \
913         test/data/ip-addr-show-lo-ipv6.txt \
914         test/data/ip-addr-show-lo-oneline-ipv4.txt \
915         test/data/ip-addr-show-lo-oneline-ipv6.txt \
916         test/data/ip-addr-show-lo-oneline.txt \
917         test/data/ip-addr-show-lo.txt \
918         test/data/kvm_0.12.5_help.txt \
919         test/data/kvm_0.15.90_help.txt \
920         test/data/kvm_0.9.1_help.txt \
921         test/data/kvm_1.0_help.txt \
922         test/data/ovfdata/compr_disk.vmdk.gz \
923         test/data/ovfdata/config.ini \
924         test/data/ovfdata/corrupted_resources.ovf \
925         test/data/ovfdata/empty.ini \
926         test/data/ovfdata/empty.ovf \
927         test/data/ovfdata/ganeti.mf \
928         test/data/ovfdata/ganeti.ovf \
929         test/data/ovfdata/gzip_disk.ovf \
930         test/data/ovfdata/new_disk.vmdk \
931         test/data/ovfdata/no_disk.ini \
932         test/data/ovfdata/no_disk_in_ref.ovf \
933         test/data/ovfdata/no_os.ini \
934         test/data/ovfdata/no_ovf.ova \
935         test/data/ovfdata/other/rawdisk.raw \
936         test/data/ovfdata/ova.ova \
937         test/data/ovfdata/rawdisk.raw \
938         test/data/ovfdata/second_disk.vmdk \
939         test/data/ovfdata/unsafe_path.ini \
940         test/data/ovfdata/virtualbox.ovf \
941         test/data/ovfdata/wrong_config.ini \
942         test/data/ovfdata/wrong_extension.ovd \
943         test/data/ovfdata/wrong_manifest.mf \
944         test/data/ovfdata/wrong_manifest.ovf \
945         test/data/ovfdata/wrong_ova.ova \
946         test/data/ovfdata/wrong_xml.ovf \
947         test/data/proc_drbd8.txt \
948         test/data/proc_drbd80-emptyline.txt \
949         test/data/proc_drbd83.txt \
950         test/data/proc_drbd83_sync.txt \
951         test/data/proc_drbd83_sync_want.txt \
952         test/data/proc_drbd83_sync_krnl2.6.39.txt \
953         test/data/sys_drbd_usermode_helper.txt \
954         test/data/vgreduce-removemissing-2.02.02.txt \
955         test/data/vgreduce-removemissing-2.02.66-fail.txt \
956         test/data/vgreduce-removemissing-2.02.66-ok.txt \
957         test/data/vgs-missing-pvs-2.02.02.txt \
958         test/data/vgs-missing-pvs-2.02.66.txt \
959         test/ganeti-cli.test \
960         test/gnt-cli.test \
961         test/import-export_unittest-helper
962
963 python_tests = \
964         doc/examples/rapi_testutils.py \
965         test/cfgupgrade_unittest.py \
966         test/docs_unittest.py \
967         test/ganeti.asyncnotifier_unittest.py \
968         test/ganeti.backend_unittest-runasroot.py \
969         test/ganeti.backend_unittest.py \
970         test/ganeti.bdev_unittest.py \
971         test/ganeti.cli_unittest.py \
972         test/ganeti.client.gnt_cluster_unittest.py \
973         test/ganeti.client.gnt_instance_unittest.py \
974         test/ganeti.client.gnt_job_unittest.py \
975         test/ganeti.cmdlib_unittest.py \
976         test/ganeti.compat_unittest.py \
977         test/ganeti.confd.client_unittest.py \
978         test/ganeti.config_unittest.py \
979         test/ganeti.constants_unittest.py \
980         test/ganeti.daemon_unittest.py \
981         test/ganeti.errors_unittest.py \
982         test/ganeti.hooks_unittest.py \
983         test/ganeti.ht_unittest.py \
984         test/ganeti.http_unittest.py \
985         test/ganeti.hypervisor.hv_chroot_unittest.py \
986         test/ganeti.hypervisor.hv_fake_unittest.py \
987         test/ganeti.hypervisor.hv_kvm_unittest.py \
988         test/ganeti.hypervisor.hv_lxc_unittest.py \
989         test/ganeti.hypervisor.hv_xen_unittest.py \
990         test/ganeti.hypervisor_unittest.py \
991         test/ganeti.impexpd_unittest.py \
992         test/ganeti.jqueue_unittest.py \
993         test/ganeti.jstore_unittest.py \
994         test/ganeti.locking_unittest.py \
995         test/ganeti.luxi_unittest.py \
996         test/ganeti.masterd.iallocator_unittest.py \
997         test/ganeti.masterd.instance_unittest.py \
998         test/ganeti.mcpu_unittest.py \
999         test/ganeti.netutils_unittest.py \
1000         test/ganeti.objects_unittest.py \
1001         test/ganeti.objectutils_unittest.py \
1002         test/ganeti.opcodes_unittest.py \
1003         test/ganeti.ovf_unittest.py \
1004         test/ganeti.qlang_unittest.py \
1005         test/ganeti.query_unittest.py \
1006         test/ganeti.rapi.baserlib_unittest.py \
1007         test/ganeti.rapi.client_unittest.py \
1008         test/ganeti.rapi.resources_unittest.py \
1009         test/ganeti.rapi.rlib2_unittest.py \
1010         test/ganeti.rapi.testutils_unittest.py \
1011         test/ganeti.rpc_unittest.py \
1012         test/ganeti.runtime_unittest.py \
1013         test/ganeti.serializer_unittest.py \
1014         test/ganeti.server.rapi_unittest.py \
1015         test/ganeti.ssconf_unittest.py \
1016         test/ganeti.ssh_unittest.py \
1017         test/ganeti.storage_unittest.py \
1018         test/ganeti.tools.ensure_dirs_unittest.py \
1019         test/ganeti.tools.node_daemon_setup_unittest.py \
1020         test/ganeti.tools.prepare_node_join_unittest.py \
1021         test/ganeti.uidpool_unittest.py \
1022         test/ganeti.utils.algo_unittest.py \
1023         test/ganeti.utils.filelock_unittest.py \
1024         test/ganeti.utils.hash_unittest.py \
1025         test/ganeti.utils.io_unittest-runasroot.py \
1026         test/ganeti.utils.io_unittest.py \
1027         test/ganeti.utils.log_unittest.py \
1028         test/ganeti.utils.mlock_unittest.py \
1029         test/ganeti.utils.nodesetup_unittest.py \
1030         test/ganeti.utils.process_unittest.py \
1031         test/ganeti.utils.retry_unittest.py \
1032         test/ganeti.utils.text_unittest.py \
1033         test/ganeti.utils.wrapper_unittest.py \
1034         test/ganeti.utils.x509_unittest.py \
1035         test/ganeti.utils_unittest.py \
1036         test/ganeti.vcluster_unittest.py \
1037         test/ganeti.workerpool_unittest.py \
1038         test/pycurl_reset_unittest.py \
1039         test/qa.qa_config_unittest.py \
1040         test/tempfile_fork_unittest.py
1041
1042 haskell_tests = htest/test
1043
1044 dist_TESTS = \
1045         test/check-cert-expired_unittest.bash \
1046         test/daemon-util_unittest.bash \
1047         test/ganeti-cleaner_unittest.bash \
1048         test/import-export_unittest.bash \
1049         test/cli-test.bash \
1050         test/bash_completion.bash \
1051         $(python_tests)
1052
1053 nodist_TESTS =
1054 check_SCRIPTS =
1055
1056 if WANT_HSTESTS
1057 nodist_TESTS += $(haskell_tests)
1058 dist_TESTS += htest/offline-test.sh
1059 check_SCRIPTS += \
1060         htest/hpc-htools \
1061         htest/hpc-mon-collector \
1062         $(HS_BUILT_TEST_HELPERS)
1063 endif
1064
1065 TESTS = $(dist_TESTS) $(nodist_TESTS)
1066
1067 # Environment for all tests
1068 PLAIN_TESTS_ENVIRONMENT = \
1069         PYTHONPATH=. \
1070         TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
1071         PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
1072         $(RUN_IN_TEMPDIR)
1073
1074 # Environment for tests run by automake
1075 TESTS_ENVIRONMENT = \
1076         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1077
1078 all_python_code = \
1079         $(dist_sbin_SCRIPTS) \
1080         $(python_scripts) \
1081         $(pkglib_python_scripts) \
1082         $(nodist_pkglib_python_scripts) \
1083         $(nodist_tools_python_scripts) \
1084         $(python_tests) \
1085         $(pkgpython_PYTHON) \
1086         $(client_PYTHON) \
1087         $(hypervisor_PYTHON) \
1088         $(rapi_PYTHON) \
1089         $(server_PYTHON) \
1090         $(pytools_PYTHON) \
1091         $(http_PYTHON) \
1092         $(confd_PYTHON) \
1093         $(masterd_PYTHON) \
1094         $(impexpd_PYTHON) \
1095         $(utils_PYTHON) \
1096         $(watcher_PYTHON) \
1097         $(noinst_PYTHON) \
1098         $(qa_scripts)
1099
1100 srclink_files = \
1101         man/footer.rst \
1102         test/check-cert-expired_unittest.bash \
1103         test/daemon-util_unittest.bash \
1104         test/ganeti-cleaner_unittest.bash \
1105         test/import-export_unittest.bash \
1106         test/cli-test.bash \
1107         test/bash_completion.bash \
1108         htest/offline-test.sh \
1109         htest/cli-tests-defs.sh \
1110         $(all_python_code) \
1111         $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS)
1112
1113 check_python_code = \
1114         $(BUILD_BASH_COMPLETION) \
1115         $(CHECK_IMPORTS) \
1116         $(CHECK_HEADER) \
1117         $(DOCPP) \
1118         $(all_python_code)
1119
1120 lint_python_code = \
1121         ganeti \
1122         ganeti/http/server.py \
1123         $(dist_sbin_SCRIPTS) \
1124         $(python_scripts) \
1125         $(pkglib_python_scripts) \
1126         $(BUILD_BASH_COMPLETION) \
1127         $(CHECK_IMPORTS) \
1128         $(CHECK_HEADER) \
1129         $(DOCPP) \
1130         $(PYTHON_BOOTSTRAP)
1131
1132 standalone_python_modules = \
1133         lib/rapi/client.py \
1134         tools/ganeti-listrunner
1135
1136 pep8_python_code = \
1137         ganeti \
1138         ganeti/http/server.py \
1139         $(dist_sbin_SCRIPTS) \
1140         $(python_scripts) \
1141         $(pkglib_python_scripts) \
1142         $(BUILD_BASH_COMPLETION) \
1143         $(CHECK_HEADER) \
1144         $(DOCPP) \
1145         $(PYTHON_BOOTSTRAP) \
1146         qa
1147
1148 test/daemon-util_unittest.bash: daemons/daemon-util
1149
1150 test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1151
1152 test/bash_completion.bash: doc/examples/bash_completion-debug
1153
1154 tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1155         sed -f $(REPLACE_VARS_SED) < $< > $@
1156         chmod +x $@
1157
1158 tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
1159         sed -f $(REPLACE_VARS_SED) < $< > $@
1160         chmod +x $@
1161
1162 daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1163         sed -f $(REPLACE_VARS_SED) < $< > $@
1164         chmod +x $@
1165
1166 doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1167         sed -f $(REPLACE_VARS_SED) < $< > $@
1168
1169 doc/examples/bash_completion: BC_ARGS = --compact
1170 doc/examples/bash_completion-debug: BC_ARGS =
1171
1172 doc/examples/bash_completion doc/examples/bash_completion-debug: \
1173         $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1174         lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1175         daemons/ganeti-cleaner \
1176         $(GENERATED_FILES) $(HS_GENERATED_FILES)
1177         PYTHONPATH=. $(RUN_IN_TEMPDIR) \
1178           $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
1179
1180 doc/%.png: doc/%.dot
1181         @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
1182         $(DOT) -Tpng -o $@ $<
1183
1184 man/footer.man: man/footer.rst
1185         @test -n "$(PANDOC)" || \
1186           { echo 'pandoc' not found during configure; exit 1; }
1187         $(PANDOC) -f rst -t man -o $@ $<
1188
1189 man/footer.html: man/footer.rst
1190         @test -n "$(PANDOC)" || \
1191           { echo 'pandoc' not found during configure; exit 1; }
1192         $(PANDOC) -f rst -t html -o $@ $<
1193
1194 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
1195         lib/build/shell_example_lexer.py \
1196         | $(RUN_IN_TEMPDIR) $(BUILT_PYTHON_SOURCES)
1197         @echo "Checking $< for hardcoded paths..."
1198         @if grep -nEf autotools/wrong-hardcoded-paths $<; then \
1199           echo "Man page $< has harcoded paths (see above)!" 1>&2 ; \
1200           exit 1; \
1201         fi
1202         set -e ; \
1203         trap 'echo auto-removing $@; rm $@' EXIT; \
1204         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
1205         trap - EXIT
1206
1207 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
1208         @test -n "$(PANDOC)" || \
1209           { echo 'pandoc' not found during configure; exit 1; }
1210         set -o pipefail ; \
1211         trap 'echo auto-removing $@; rm $@' EXIT; \
1212         $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
1213           sed -e 's/\\@/@/g' > $@; \
1214         if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
1215         $(CHECK_MAN_DASHES) $@; \
1216         trap - EXIT
1217
1218
1219 man/%.html.in: man/%.gen man/footer.html
1220         @test -n "$(PANDOC)" || \
1221           { echo 'pandoc' not found during configure; exit 1; }
1222         set -o pipefail ; \
1223         $(PANDOC) -s -f rst -t html -A man/footer.html $< | \
1224           sed -e 's/\\@/@/g' > $@
1225
1226 man/%: man/%.in  $(REPLACE_VARS_SED)
1227         sed -f $(REPLACE_VARS_SED) < $< > $@
1228
1229 epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1230         sed -f $(REPLACE_VARS_SED) < $< > $@
1231
1232 vcs-version:
1233         if test -d .git; then \
1234           git describe > $@; \
1235         elif test ! -f $@ ; then \
1236           echo "Cannot auto-generate $@ file"; exit 1; \
1237         fi
1238
1239 .PHONY: clean-vcs-version
1240 clean-vcs-version:
1241         rm -f vcs-version
1242
1243 .PHONY: regen-vcs-version
1244 regen-vcs-version:
1245         @set -e; \
1246         cd $(srcdir); \
1247         if test -d .git; then \
1248           T=`mktemp` ; trap 'rm -f $$T' EXIT; \
1249           git describe > $$T; \
1250           if ! cmp --quiet $$T vcs-version; then \
1251             mv $$T vcs-version; \
1252           fi; \
1253         fi
1254
1255 src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
1256         vcs-version $(built_base_sources)
1257         set -e; \
1258         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1259         sed -e "s/%ver%/$$VCSVER/" < $< > $@
1260
1261 src/Ganeti/Constants.hs: src/Ganeti/Constants.hs.in \
1262         lib/constants.py lib/_autoconf.py lib/luxi.py lib/errors.py \
1263         lib/jstore.py $(RUN_IN_TEMPDIR)\
1264         $(CONVERT_CONSTANTS) $(built_base_sources) \
1265         | lib/_vcsversion.py
1266         set -e; \
1267         { cat $< ; \
1268           PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CONVERT_CONSTANTS); \
1269         } > $@
1270
1271 htest/Test/Ganeti/TestImports.hs: htest/Test/Ganeti/TestImports.hs.in \
1272         $(built_base_sources)
1273         set -e; \
1274         { cat $< ; \
1275           echo ; \
1276           for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
1277             echo "import $$name ()" ; \
1278           done ; \
1279         } > $@
1280
1281 lib/_autoconf.py: Makefile | stamp-directories
1282         set -e; \
1283         { echo '# This file is automatically generated, do not edit!'; \
1284           echo '#'; \
1285           echo ''; \
1286           echo '"""Build-time configuration for Ganeti.'; \
1287           echo '';\
1288           echo 'This file is autogenerated by the build process.'; \
1289           echo 'For any changes you need to re-run ./configure (and'; \
1290           echo 'not edit by hand).'; \
1291           echo ''; \
1292           echo '"""'; \
1293           echo ''; \
1294           echo '# pylint: disable=C0301,C0324'; \
1295           echo '# because this is autogenerated, we do not want'; \
1296           echo '# style warnings' ; \
1297           echo ''; \
1298           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
1299           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
1300           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
1301           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
1302           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
1303           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
1304           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
1305           echo "SYSCONFDIR = '$(sysconfdir)'"; \
1306           echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
1307           echo "SSH_LOGIN_USER = '$(SSH_LOGIN_USER)'"; \
1308           echo "SSH_CONSOLE_USER = '$(SSH_CONSOLE_USER)'"; \
1309           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
1310           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
1311           echo "ES_SEARCH_PATH = [$(ES_SEARCH_PATH)]"; \
1312           echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
1313           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
1314           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
1315           echo "KVM_KERNEL = '$(KVM_KERNEL)'"; \
1316           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
1317           echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
1318           echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
1319           echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
1320           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
1321           echo "KVM_PATH = '$(KVM_PATH)'"; \
1322           echo "IP_PATH = '$(IP_PATH)'"; \
1323           echo "SOCAT_PATH = '$(SOCAT)'"; \
1324           echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
1325           echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
1326           echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
1327           echo "TOOLSDIR = '$(toolsdir)'"; \
1328           echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
1329           echo "HTOOLS_PROGS = [$(foreach i,$(HS_HTOOLS_PROGS),'$(i)',)]"; \
1330           echo "PKGLIBDIR = '$(pkglibdir)'"; \
1331           echo "DRBD_BARRIERS = '$(DRBD_BARRIERS)'"; \
1332           echo "DRBD_NO_META_FLUSH = $(DRBD_NO_META_FLUSH)"; \
1333           echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
1334           echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
1335           echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
1336           echo "MASTERD_USER = '$(MASTERD_USER)'"; \
1337           echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
1338           echo "RAPI_USER = '$(RAPI_USER)'"; \
1339           echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
1340           echo "CONFD_USER = '$(CONFD_USER)'"; \
1341           echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
1342           echo "NODED_USER = '$(NODED_USER)'"; \
1343           echo "NODED_GROUP = '$(NODED_GROUP)'"; \
1344           echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
1345           echo "QEMUIMG_PATH = '$(QEMUIMG_PATH)'"; \
1346           echo "HTOOLS = True"; \
1347           echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
1348           echo "XEN_CMD = '$(XEN_CMD)'"; \
1349           echo "ENABLE_SPLIT_QUERY = $(ENABLE_SPLIT_QUERY)"; \
1350           echo "ENABLE_RESTRICTED_COMMANDS = $(ENABLE_RESTRICTED_COMMANDS)"; \
1351           echo "ENABLE_MONITORING = $(ENABLE_MONITORING)"; \
1352         } > $@
1353
1354 lib/_vcsversion.py: Makefile vcs-version | stamp-directories
1355         set -e; \
1356         VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1357         { echo '# This file is automatically generated, do not edit!'; \
1358           echo '#'; \
1359           echo ''; \
1360           echo '"""Build-time VCS version number for Ganeti.'; \
1361           echo '';\
1362           echo 'This file is autogenerated by the build process.'; \
1363           echo 'For any changes you need to re-run ./configure (and'; \
1364           echo 'not edit by hand).'; \
1365           echo ''; \
1366           echo '"""'; \
1367           echo ''; \
1368           echo '# pylint: disable=C0301,C0324'; \
1369           echo '# because this is autogenerated, we do not want'; \
1370           echo '# style warnings' ; \
1371           echo ''; \
1372           echo "VCS_VERSION = '$$VCSVER'"; \
1373         } > $@
1374
1375 lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1376         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1377
1378 $(SHELL_ENV_INIT): Makefile stamp-directories
1379         set -e; \
1380         { echo '# Allow overriding for tests'; \
1381           echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1382           echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1383           echo; \
1384           echo 'readonly PKGLIBDIR=$(pkglibdir)'; \
1385           echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1386           echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1387           echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1388           echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1389         } > $@
1390
1391 $(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
1392         set -e; \
1393         { echo 's#@PREFIX@#$(prefix)#g'; \
1394           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
1395           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
1396           echo 's#@BINDIR@#$(bindir)#g'; \
1397           echo 's#@SBINDIR@#$(sbindir)#g'; \
1398           echo 's#@LIBDIR@#$(libdir)#g'; \
1399           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1400           echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1401           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1402           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1403           echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1404           echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1405           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
1406           echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1407           echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
1408           echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1409           echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
1410           echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
1411           echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
1412           echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1413           echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1414           echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1415           echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1416           echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1417           echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
1418           echo 's#@MODULES@#$(strip $(lint_python_code))#g'; \
1419           echo 's#@ENABLE_SPLIT_QUERY@#$(ENABLE_SPLIT_QUERY)#g'; \
1420           echo; \
1421           echo '/^@SHELL_ENV_INIT@$$/ {'; \
1422           echo '  r $(SHELL_ENV_INIT)'; \
1423           echo '  d'; \
1424           echo '}'; \
1425         } > $@
1426
1427 # Using deferred evaluation
1428 daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1429 daemons/ganeti-watcher: MODULE = ganeti.watcher
1430 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1431 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1432 tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
1433 tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
1434 tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
1435 $(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst htest/%,%,$@)
1436
1437 $(PYTHON_BOOTSTRAP): Makefile | stamp-directories
1438         test -n "$(MODULE)" || { echo Missing module; exit 1; }
1439         set -e; \
1440         { echo '#!/usr/bin/python'; \
1441           echo '# This file is automatically generated, do not edit!'; \
1442           echo "# Edit $(MODULE) instead."; \
1443           echo; \
1444           echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1445           echo; \
1446           echo '# pylint: disable=C0103'; \
1447           echo '# C0103: Invalid name'; \
1448           echo; \
1449           echo 'import sys'; \
1450           echo 'import $(MODULE) as main'; \
1451           echo; \
1452           echo '# Temporarily alias commands until bash completion'; \
1453           echo '# generator is changed'; \
1454           echo 'if hasattr(main, "commands"):'; \
1455           echo '  commands = main.commands # pylint: disable=E1101'; \
1456           echo 'if hasattr(main, "aliases"):'; \
1457           echo '  aliases = main.aliases # pylint: disable=E1101'; \
1458           echo; \
1459           echo 'if __name__ == "__main__":'; \
1460           echo '  sys.exit(main.Main())'; \
1461         } > $@
1462         chmod u+x $@
1463
1464 $(HS_BUILT_TEST_HELPERS): Makefile
1465         @test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
1466         set -e; \
1467         { echo '#!/bin/sh'; \
1468           echo '# This file is automatically generated, do not edit!'; \
1469           echo "# Edit Makefile.am instead."; \
1470           echo; \
1471           echo "HTOOLS=$(TESTROLE) exec ./htest/hpc-htools \"\$$@\""; \
1472         } > $@
1473         chmod u+x $@
1474
1475 stamp-directories: Makefile
1476         $(MAKE) $(AM_MAKEFLAGS) ganeti
1477         @mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
1478         touch $@
1479
1480 # We need to create symlinks because "make distcheck" will not install Python
1481 # files when building.
1482 stamp-srclinks: Makefile | stamp-directories
1483         set -e; \
1484         for i in $(srclink_files); do \
1485           if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1486             $(LN_S) $(abs_top_srcdir)/$$i $$i; \
1487           fi; \
1488         done
1489         touch $@
1490
1491 .PHONY: ganeti
1492 ganeti:
1493         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1494
1495 .PHONY: check-dirs
1496 check-dirs: $(GENERATED_FILES)
1497         @set -e; \
1498         find . -type d \( -name . -o -name .git -prune -o -print \) | { \
1499           error=; \
1500           while read dir; do \
1501             case "$$dir" in \
1502               $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1503               *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1504             esac; \
1505           done; \
1506           for dir in $(DIRS); do \
1507             if ! test -d "$$dir"; then \
1508               echo "Directory $$dir listed in DIRS does not exist" >&2; \
1509               error=1; \
1510             fi \
1511           done; \
1512           test -z "$$error"; \
1513         }
1514
1515 .PHONY: check-local
1516 check-local: check-dirs $(GENERATED_FILES)
1517         $(CHECK_PYTHON_CODE) $(check_python_code)
1518         PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
1519         $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1520         $(CHECK_NEWS) < $(top_srcdir)/NEWS
1521         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
1522         @expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1523         error= ; \
1524         if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1525           echo "Incorrect version in README, expected $$expver" >&2; \
1526           error=1; \
1527         fi; \
1528         for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
1529             doc/security.rst; do \
1530           if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
1531             "Documents Ganeti version $$expver"; then \
1532             echo "Incorrect version in $$file, expected $$expver" >&2; \
1533             error=1; \
1534           fi; \
1535         done; \
1536         if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
1537           echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
1538           error=1; \
1539         fi; \
1540         if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
1541           ".. Last updated for Ganeti $$expver"; then \
1542           echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
1543           error=1; \
1544         fi; \
1545         for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
1546           if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
1547             echo "Longest line in $$file is longer than 80 characters" >&2; \
1548             error=1; \
1549           fi; \
1550         done; \
1551         test -z "$$error"
1552
1553 .PHONY: hs-check
1554 hs-check: htest/test htest/hpc-htools htest/hpc-mon-collector $(HS_BUILT_TEST_HELPERS) \
1555         | $(BUILT_PYTHON_SOURCES)
1556         @rm -f *.tix
1557         ./htest/test
1558         HBINARY="./htest/hpc-htools" ./htest/offline-test.sh
1559
1560 # E111: indentation is not a multiple of four
1561 # E121: continuation line indentation is not a multiple of four
1562 #       (since our indent level is not 4)
1563 # E125: continuation line does not distinguish itself from next logical line
1564 #       (since our indent level is not 4)
1565 # E127: continuation line over-indented for visual indent
1566 #       (since our indent level is not 4)
1567 # note: do NOT add E128 here; it's a valid style error in most cases!
1568 # I've seen real errors, but also some cases were we indent wrongly
1569 # due to line length; try to rework the cases where it is triggered,
1570 # instead of silencing it
1571 # E261: at least two spaces before inline comment
1572 # E501: line too long (80 characters)
1573 PEP8_IGNORE = E111,E121,E125,E127,E261,E501
1574
1575 # For excluding pep8 expects filenames only, not whole paths
1576 PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1577
1578 LINT_TARGETS = pylint pylint-qa
1579 if HAS_PEP8
1580 LINT_TARGETS += pep8
1581 endif
1582 if HAS_HLINT
1583 LINT_TARGETS += hlint
1584 endif
1585
1586 .PHONY: lint
1587 lint: $(LINT_TARGETS)
1588
1589 .PHONY: pylint
1590 pylint: $(GENERATED_FILES)
1591         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1592         $(PYLINT) $(LINT_OPTS) $(lint_python_code)
1593
1594 .PHONY: pylint-qa
1595 pylint-qa: $(GENERATED_FILES)
1596         @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1597         cd $(top_srcdir)/qa && \
1598           PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1599           --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1600
1601 .PHONY: pep8
1602 pep8: $(GENERATED_FILES)
1603         @test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
1604         $(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1605           --repeat $(pep8_python_code)
1606
1607 # FIXME: remove ignore "Use void" when GHC 6.x is deprecated
1608 HLINT_EXCLUDES = src/Ganeti/THH.hs htest/hpc-htools.hs
1609 .PHONY: hlint
1610 hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
1611         @test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
1612         if tty -s; then C="-c"; else C=""; fi; \
1613         $(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
1614           --ignore "Use first" \
1615           --ignore "Use &&&" \
1616           --ignore "Use void" \
1617           --ignore "Reduce duplication" \
1618           --hint src/lint-hints \
1619           $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
1620
1621 # a dist hook rule for updating the vcs-version file; this is
1622 # hardcoded due to where it needs to build the file...
1623 dist-hook:
1624         $(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
1625         rm -f $(top_distdir)/vcs-version
1626         cp -p $(srcdir)/vcs-version $(top_distdir)
1627
1628 # a distcheck hook rule for catching revision control directories
1629 distcheck-hook:
1630         if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1631           echo "Found revision control files in final archive." 1>&2; \
1632           exit 1; \
1633         fi
1634         if find $(top_distdir) -name '*.py[co]' | grep .; then \
1635           echo "Found Python byte code in final archive." 1>&2; \
1636           exit 1; \
1637         fi
1638         if find $(top_distdir) -name '*~' | grep .; then \
1639           echo "Found backup files in final archive." 1>&2; \
1640           exit 1; \
1641         fi
1642 # Empty files or directories should not be distributed. They can cause
1643 # unnecessary warnings for packagers. Directories used by automake during
1644 # distcheck must be excluded.
1645         if find $(top_distdir) -empty -and -not \( \
1646             -path $(top_distdir)/_build -or \
1647             -path $(top_distdir)/_inst \) | grep .; then \
1648           echo "Found empty files or directories in final archive." 1>&2; \
1649           exit 1; \
1650         fi
1651         if test -n "$(BUILD_RELEASE)" && \
1652            grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1653            echo "Found unreleased version in NEWS." >&2; \
1654            exit 1; \
1655         fi
1656
1657 # When building a release, stricter checks should be used
1658 distcheck-release dist-release: export BUILD_RELEASE = 1
1659 distcheck-release: distcheck
1660
1661 distrebuildcheck: dist
1662         set -e; \
1663         builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
1664         trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
1665         cd $$builddir; \
1666         tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
1667         cd $(distdir); \
1668         ./configure; \
1669         $(MAKE) maintainer-clean; \
1670         cp $(abs_srcdir)/vcs-version .; \
1671         ./configure; \
1672         $(MAKE) $(AM_MAKEFLAGS)
1673
1674 dist-release: dist
1675         set -e; \
1676         for i in $(DIST_ARCHIVES); do \
1677           echo -n "Checking $$i ... "; \
1678           autotools/check-tar < $$i; \
1679           echo OK; \
1680         done
1681
1682 install-exec-local:
1683         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1684           "$(DESTDIR)${localstatedir}/log/ganeti" \
1685           "$(DESTDIR)${localstatedir}/run/ganeti"
1686
1687 .PHONY: apidoc
1688 if WANT_HSAPIDOC
1689 apidoc: py-apidoc hs-apidoc
1690 else
1691 apidoc: py-apidoc
1692 endif
1693
1694 .PHONY: py-apidoc
1695 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
1696         env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
1697         $(RUN_IN_TEMPDIR) epydoc -v \
1698           --conf $(CURDIR)/epydoc.conf \
1699           --output $(CURDIR)/$(APIDOC_PY_DIR)
1700
1701 .PHONY: hs-apidoc
1702 hs-apidoc: $(HS_BUILT_SRCS)
1703         @test -n "$(HSCOLOUR)" || \
1704             { echo 'HsColour' not found during configure; exit 1; }
1705         @test -n "$(HADDOCK)" || \
1706             { echo 'haddock' not found during configure; exit 1; }
1707         rm -rf $(APIDOC_HS_DIR)/*
1708         for i in $(ALL_APIDOC_HS_DIRS); do \
1709           @mkdir_p@ $$i; \
1710         done
1711         $(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1712         $(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1713         $(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/Confd/hscolour.css
1714         set -e ; \
1715         cd src; \
1716         if [ "$(HS_NOCURL)" ]; \
1717         then OPTGHC="--optghc=$(HS_NOCURL)"; \
1718         else OPTGHC=""; \
1719         fi; \
1720         if [ "$(HS_PARALLEL3)" ]; \
1721         then OPTGHC="$$OPTGHC --optghc=$(HS_PARALLEL3)"; \
1722         fi; \
1723         if [ "$(HS_REGEX_PCRE)" ]; \
1724         then OPTGHC="$$OPTGHC --optghc=$(HS_REGEX_PCRE)"; \
1725         fi; \
1726         RELSRCS="$(HS_LIB_SRCS:src/%=%) $(patsubst src/%,%,$(filter src/%,$(HS_BUILT_SRCS)))"; \
1727         for file in $$RELSRCS; do \
1728           hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1729           $(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1730         done ; \
1731         $(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1732           -t ganeti -p haddock-prologue \
1733           --source-module="%{MODULE/.//}.html" \
1734           --source-entity="%{MODULE/.//}.html#%{NAME}" \
1735           $$OPTGHC \
1736           $(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:src/%=%))
1737
1738 .PHONY: TAGS
1739 TAGS: $(GENERATED_FILES)
1740         rm -f TAGS
1741         $(GHC) -e ":etags" -v0 \
1742           $(filter-out -O -Werror,$(HFLAGS)) \
1743           $(HS_NOCURL) $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
1744           $(HS_LIBTEST_SRCS)
1745         find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1746           -path './daemons/ganeti-*' -o -path './tools/*' -o \
1747           -path './qa/*.py' | \
1748           etags -l python -a -
1749
1750 .PHONY: coverage
1751 if WANT_HTOOLS
1752 coverage: py-coverage hs-coverage
1753 else
1754 coverage: py-coverage
1755 endif
1756
1757 .PHONY: py-coverage
1758 py-coverage: $(GENERATED_FILES) $(python_tests)
1759         @test -n "$(PYCOVERAGE)" || \
1760             { echo 'python-coverage' not found during configure; exit 1; }
1761         set -e; \
1762         COVERAGE=$(PYCOVERAGE) \
1763         COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1764         TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1765         HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1766         $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1767         $(python_tests)
1768
1769 .PHONY: hs-coverage
1770 hs-coverage: $(haskell_tests) htest/hpc-htools htest/hpc-mon-collector
1771         rm -f *.tix
1772         $(MAKE) $(AM_MAKEFLAGS) hs-check
1773         @mkdir_p@ $(COVERAGE_HS_DIR)
1774         hpc sum --union $(HPCEXCL) \
1775           test.tix hpc-htools.tix hpc-mon-collector.tix > coverage-htools.tix
1776         hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-htools.tix
1777         hpc report coverage-htools.tix
1778         $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1779
1780 # Special "kind-of-QA" target for htools, needs special setup (all
1781 # tools compiled with -fhpc)
1782 .PHONY: live-test
1783 live-test: all
1784         set -e ; \
1785         cd src; \
1786         rm -f .hpc; $(LN_S) ../.hpc .hpc; \
1787         rm -f *.tix *.mix; \
1788         ./live-test.sh; \
1789         hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
1790           --output=live-test.tix ; \
1791         @mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1792         hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1793           --srcdir=.. $(HPCEXCL) ; \
1794         hpc report --srcdir=.. live-test $(HPCEXCL)
1795
1796 commit-check: distcheck lint apidoc
1797
1798 .PHONY: gitignore-check
1799 gitignore-check:
1800         @if [ -n "`git status --short`" ]; then \
1801           echo "Git status is not clean!" 1>&2 ; \
1802           git status --short; \
1803           exit 1; \
1804         fi
1805
1806 # Target that builds all binaries (including those that are not
1807 # rebuilt except when running the tests)
1808 .PHONY: really-all
1809 really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
1810
1811 # we don't need the ancient implicit rules:
1812 %: %,v
1813 %: RCS/%,v
1814 %: RCS/%
1815 %: s.%
1816 %: SCCS/s.%
1817
1818 -include ./Makefile.local
1819
1820 # vim: set noet :