Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ fcdb582d

History | View | Annotate | Download (24.9 kB)

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
# Use bash in order to be able to use pipefail
13
SHELL=/bin/bash
14

    
15
ACLOCAL_AMFLAGS = -I autotools
16
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
17
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
18
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
19
CHECK_MAN = $(top_srcdir)/autotools/check-man
20
CHECK_VERSION = $(top_srcdir)/autotools/check-version
21
CHECK_NEWS = $(top_srcdir)/autotools/check-news
22
DOCPP = $(top_srcdir)/autotools/docpp
23
REPLACE_VARS_SED = autotools/replace_vars.sed
24

    
25
clientdir = $(pkgpythondir)/client
26
hypervisordir = $(pkgpythondir)/hypervisor
27
httpdir = $(pkgpythondir)/http
28
masterddir = $(pkgpythondir)/masterd
29
confddir = $(pkgpythondir)/confd
30
rapidir = $(pkgpythondir)/rapi
31
serverdir = $(pkgpythondir)/server
32
watcherdir = $(pkgpythondir)/watcher
33
impexpddir = $(pkgpythondir)/impexpd
34
utilsdir = $(pkgpythondir)/utils
35
toolsdir = $(pkglibdir)/tools
36
docdir = $(datadir)/doc/$(PACKAGE)
37

    
38
# Delete output file if an error occurred while building it
39
.DELETE_ON_ERROR:
40

    
41
DIRS = \
42
	autotools \
43
	daemons \
44
	devel \
45
	doc \
46
	doc/examples \
47
	doc/examples/hooks \
48
	doc/examples/gnt-debug \
49
	lib \
50
	lib/client \
51
	lib/build \
52
	lib/confd \
53
	lib/http \
54
	lib/hypervisor \
55
	lib/impexpd \
56
	lib/masterd \
57
	lib/rapi \
58
	lib/server \
59
	lib/utils \
60
	lib/watcher \
61
	man \
62
	qa \
63
	test \
64
	test/data \
65
	tools
66

    
67
BUILDTIME_DIR_AUTOCREATE = \
68
	scripts \
69
	doc/api \
70
	doc/coverage
71

    
72
BUILDTIME_DIRS = \
73
	$(BUILDTIME_DIR_AUTOCREATE) \
74
	doc/html
75

    
76
DIRCHECK_EXCLUDE = \
77
	$(BUILDTIME_DIRS) \
78
	ganeti-[0-9]*.[0-9]*.[0-9]* \
79
	doc/html/_*
80

    
81
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
82

    
83
MAINTAINERCLEANFILES = \
84
	$(docpng) \
85
	$(maninput) \
86
	doc/install-quick.rst \
87
	doc/news.rst \
88
	doc/upgrade.rst \
89
	vcs-version
90

    
91
maintainer-clean-local:
92
	rm -rf $(BUILDTIME_DIRS)
93

    
94
CLEANFILES = \
95
	$(addsuffix /*.py[co],$(DIRS)) \
96
	$(all_dirfiles) \
97
	$(PYTHON_BOOTSTRAP) \
98
	epydoc.conf \
99
	autotools/replace_vars.sed \
100
	daemons/daemon-util \
101
	daemons/ensure-dirs \
102
	daemons/ganeti-cleaner \
103
	devel/upload \
104
	doc/examples/bash_completion \
105
	doc/examples/ganeti.initd \
106
	doc/examples/ganeti-kvm-poweroff.initd \
107
	doc/examples/ganeti.cron \
108
	doc/examples/gnt-config-backup \
109
	doc/examples/hooks/ipsec \
110
	$(man_MANS) \
111
	$(manhtml) \
112
	tools/kvm-ifup \
113
	stamp-srclinks \
114
	$(nodist_pkgpython_PYTHON)
115

    
116
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
117
# it'll cause the target to rebuild every time.
118
BUILT_SOURCES = \
119
	ganeti \
120
	stamp-srclinks \
121
	lib/_autoconf.py \
122
	$(all_dirfiles) \
123
	$(PYTHON_BOOTSTRAP)
124

    
125
nodist_pkgpython_PYTHON = \
126
	lib/_autoconf.py
127

    
128
noinst_PYTHON = \
129
	lib/build/__init__.py \
130
	lib/build/sphinx_ext.py
131

    
132
pkgpython_PYTHON = \
133
	lib/__init__.py \
134
	lib/asyncnotifier.py \
135
	lib/backend.py \
136
	lib/bdev.py \
137
	lib/bootstrap.py \
138
	lib/cli.py \
139
	lib/cmdlib.py \
140
	lib/compat.py \
141
	lib/config.py \
142
	lib/constants.py \
143
	lib/daemon.py \
144
	lib/errors.py \
145
	lib/ht.py \
146
	lib/jqueue.py \
147
	lib/jstore.py \
148
	lib/locking.py \
149
	lib/luxi.py \
150
	lib/mcpu.py \
151
	lib/netutils.py \
152
	lib/objects.py \
153
	lib/opcodes.py \
154
	lib/qlang.py \
155
	lib/query.py \
156
	lib/rpc.py \
157
	lib/runtime.py \
158
	lib/serializer.py \
159
	lib/ssconf.py \
160
	lib/ssh.py \
161
	lib/storage.py \
162
	lib/uidpool.py \
163
	lib/workerpool.py
164

    
165
client_PYTHON = \
166
	lib/client/__init__.py \
167
	lib/client/gnt_backup.py \
168
	lib/client/gnt_cluster.py \
169
	lib/client/gnt_debug.py \
170
	lib/client/gnt_group.py \
171
	lib/client/gnt_instance.py \
172
	lib/client/gnt_job.py \
173
	lib/client/gnt_node.py \
174
	lib/client/gnt_os.py
175

    
176
hypervisor_PYTHON = \
177
	lib/hypervisor/__init__.py \
178
	lib/hypervisor/hv_base.py \
179
	lib/hypervisor/hv_chroot.py \
180
	lib/hypervisor/hv_fake.py \
181
	lib/hypervisor/hv_kvm.py \
182
	lib/hypervisor/hv_lxc.py \
183
	lib/hypervisor/hv_xen.py
184

    
185
rapi_PYTHON = \
186
	lib/rapi/__init__.py \
187
	lib/rapi/baserlib.py \
188
	lib/rapi/client.py \
189
	lib/rapi/client_utils.py \
190
	lib/rapi/connector.py \
191
	lib/rapi/rlib2.py
192

    
193
http_PYTHON = \
194
	lib/http/__init__.py \
195
	lib/http/auth.py \
196
	lib/http/client.py \
197
	lib/http/server.py
198

    
199
confd_PYTHON = \
200
	lib/confd/__init__.py \
201
	lib/confd/client.py \
202
	lib/confd/querylib.py \
203
	lib/confd/server.py
204

    
205
masterd_PYTHON = \
206
	lib/masterd/__init__.py \
207
	lib/masterd/instance.py
208

    
209
impexpd_PYTHON = \
210
	lib/impexpd/__init__.py
211

    
212
watcher_PYTHON = \
213
	lib/watcher/__init__.py
214

    
215
server_PYTHON = \
216
	lib/server/__init__.py \
217
	lib/server/confd.py \
218
	lib/server/masterd.py \
219
	lib/server/noded.py \
220
	lib/server/rapi.py
221

    
222
utils_PYTHON = \
223
	lib/utils/__init__.py \
224
	lib/utils/algo.py \
225
	lib/utils/filelock.py \
226
	lib/utils/hash.py \
227
	lib/utils/io.py \
228
	lib/utils/log.py \
229
	lib/utils/mlock.py \
230
	lib/utils/nodesetup.py \
231
	lib/utils/process.py \
232
	lib/utils/retry.py \
233
	lib/utils/text.py \
234
	lib/utils/wrapper.py \
235
	lib/utils/x509.py
236

    
237
docrst = \
238
	doc/admin.rst \
239
	doc/design-2.0.rst \
240
	doc/design-2.1.rst \
241
	doc/design-2.2.rst \
242
	doc/design-2.3.rst \
243
	doc/design-2.4.rst \
244
	doc/design-draft.rst \
245
	doc/design-oob.rst \
246
	doc/design-query2.rst \
247
	doc/cluster-merge.rst \
248
	doc/devnotes.rst \
249
	doc/glossary.rst \
250
	doc/hooks.rst \
251
	doc/iallocator.rst \
252
	doc/index.rst \
253
	doc/install-quick.rst \
254
	doc/install.rst \
255
	doc/locking.rst \
256
	doc/move-instance.rst \
257
	doc/news.rst \
258
	doc/rapi.rst \
259
	doc/security.rst \
260
	doc/upgrade.rst \
261
	doc/walkthrough.rst
262

    
263
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
264

    
265
# Note: we use here an order-only prerequisite, as the contents of
266
# _autoconf.py are not actually influencing the html build output: it
267
# has to exist in order for the sphinx module to be loaded
268
# successfully, but we certainly don't want the docs to be rebuilt if
269
# it changes
270
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
271
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
272
	| lib/_autoconf.py
273
	@test -n "$(SPHINX)" || \
274
	    { echo 'sphinx-build' not found during configure; exit 1; }
275
	@mkdir_p@ $(dir $@)
276
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
277
	    -d . \
278
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
279
	    -D release="$(PACKAGE_VERSION)" \
280
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
281
	rm -f doc/html/.buildinfo doc/html/objects.inv
282
	touch $@
283

    
284
doc/html: doc/html/index.html
285

    
286
doc/install-quick.rst: INSTALL
287
doc/news.rst: NEWS
288
doc/upgrade.rst: UPGRADE
289

    
290
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
291
	set -e; \
292
	{ echo '.. This file is automatically updated at build time from $<.'; \
293
	  echo '.. Do not edit.'; \
294
	  echo; \
295
	  cat $<; \
296
	} > $@
297

    
298
docdot = \
299
	doc/arch-2.0.dot \
300
	doc/design-2.1-lock-acquire.dot \
301
	doc/design-2.1-lock-release.dot
302

    
303
docpng = $(patsubst %.dot,%.png,$(docdot))
304

    
305
# Things to build but not to install (add it to EXTRA_DIST if it should be
306
# distributed)
307
noinst_DATA = \
308
	devel/upload \
309
	doc/html \
310
	doc/examples/bash_completion \
311
	doc/examples/ganeti.cron \
312
	doc/examples/ganeti.initd \
313
	doc/examples/ganeti-kvm-poweroff.initd \
314
	doc/examples/gnt-config-backup \
315
	doc/examples/hooks/ipsec \
316
	$(manhtml)
317

    
318
gnt_scripts = \
319
	scripts/gnt-backup \
320
	scripts/gnt-cluster \
321
	scripts/gnt-debug \
322
	scripts/gnt-group \
323
	scripts/gnt-instance \
324
	scripts/gnt-job \
325
	scripts/gnt-node \
326
	scripts/gnt-os
327

    
328
PYTHON_BOOTSTRAP = \
329
	daemons/ganeti-confd \
330
	daemons/ganeti-masterd \
331
	daemons/ganeti-noded \
332
	daemons/ganeti-watcher \
333
	daemons/ganeti-rapi \
334
	scripts/gnt-backup \
335
	scripts/gnt-cluster \
336
	scripts/gnt-debug \
337
	scripts/gnt-group \
338
	scripts/gnt-instance \
339
	scripts/gnt-job \
340
	scripts/gnt-node \
341
	scripts/gnt-os
342

    
343
qa_scripts = \
344
	qa/ganeti-qa.py \
345
	qa/qa_cluster.py \
346
	qa/qa_config.py \
347
	qa/qa_daemon.py \
348
	qa/qa_env.py \
349
	qa/qa_error.py \
350
	qa/qa_instance.py \
351
	qa/qa_node.py \
352
	qa/qa_os.py \
353
	qa/qa_rapi.py \
354
	qa/qa_tags.py \
355
	qa/qa_utils.py
356

    
357
dist_sbin_SCRIPTS = \
358
	tools/ganeti-listrunner
359

    
360
nodist_sbin_SCRIPTS = \
361
	$(PYTHON_BOOTSTRAP) \
362
	daemons/ganeti-cleaner
363

    
364
dist_tools_SCRIPTS = \
365
	tools/burnin \
366
	tools/cfgshell \
367
	tools/cfgupgrade \
368
	tools/cfgupgrade12 \
369
	tools/cluster-merge \
370
	tools/lvmstrap \
371
	tools/move-instance \
372
	tools/setup-ssh \
373
	tools/sanitize-config
374

    
375
pkglib_python_scripts = \
376
	daemons/import-export \
377
	tools/check-cert-expired
378

    
379
pkglib_SCRIPTS = \
380
	daemons/daemon-util \
381
	daemons/ensure-dirs \
382
	tools/kvm-ifup \
383
	$(pkglib_python_scripts)
384

    
385
EXTRA_DIST = \
386
	NEWS \
387
	UPGRADE \
388
	epydoc.conf.in \
389
	pylintrc \
390
	autotools/build-bash-completion \
391
	autotools/check-python-code \
392
	autotools/check-man \
393
	autotools/check-news \
394
	autotools/check-tar \
395
	autotools/check-version \
396
	autotools/docpp \
397
	autotools/gen-coverage \
398
	autotools/testrunner \
399
	$(RUN_IN_TEMPDIR) \
400
	daemons/daemon-util.in \
401
	daemons/ensure-dirs.in \
402
	daemons/ganeti-cleaner.in \
403
	$(pkglib_python_scripts) \
404
	devel/upload.in \
405
	tools/kvm-ifup.in \
406
	$(docdot) \
407
	$(docpng) \
408
	$(docrst) \
409
	doc/conf.py \
410
	doc/html \
411
	doc/examples/ganeti.initd.in \
412
	doc/examples/ganeti-kvm-poweroff.initd.in \
413
	doc/examples/ganeti.cron.in \
414
	doc/examples/gnt-config-backup.in \
415
	doc/examples/ganeti.default \
416
	doc/examples/ganeti.default-debug \
417
	doc/examples/hooks/ethers \
418
	doc/examples/hooks/ipsec.in \
419
	doc/examples/gnt-debug/README \
420
	doc/examples/gnt-debug/delay0.json \
421
	doc/examples/gnt-debug/delay50.json \
422
	test/testutils.py \
423
	test/mocks.py \
424
	$(dist_TESTS) \
425
	$(TEST_FILES) \
426
	man/footer.rst \
427
	$(manrst) \
428
	$(maninput) \
429
	qa/qa-sample.json \
430
	$(qa_scripts)
431

    
432
man_MANS = \
433
	man/ganeti.7 \
434
	man/ganeti-cleaner.8 \
435
	man/ganeti-confd.8 \
436
	man/ganeti-listrunner.8 \
437
	man/ganeti-masterd.8 \
438
	man/ganeti-noded.8 \
439
	man/ganeti-os-interface.7 \
440
	man/ganeti-rapi.8 \
441
	man/ganeti-watcher.8 \
442
	man/gnt-backup.8 \
443
	man/gnt-cluster.8 \
444
	man/gnt-debug.8 \
445
	man/gnt-group.8 \
446
	man/gnt-instance.8 \
447
	man/gnt-job.8 \
448
	man/gnt-node.8 \
449
	man/gnt-os.8
450

    
451
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
452
manhtml = $(patsubst %.rst,%.html,$(manrst))
453
mangen = $(patsubst %.rst,%.gen,$(manrst))
454
maninput = \
455
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
456
	$(patsubst %.html,%.html.in,$(manhtml)) \
457
	man/footer.man man/footer.html $(mangen)
458

    
459
TEST_FILES = \
460
	test/data/bdev-drbd-8.0.txt \
461
	test/data/bdev-drbd-8.3.txt \
462
	test/data/bdev-drbd-disk.txt \
463
	test/data/bdev-drbd-net-ip4.txt \
464
	test/data/bdev-drbd-net-ip6.txt \
465
	test/data/cert1.pem \
466
	test/data/proc_drbd8.txt \
467
	test/data/proc_drbd80-emptyline.txt \
468
	test/data/proc_drbd83.txt \
469
	test/data/sys_drbd_usermode_helper.txt \
470
	test/import-export_unittest-helper
471

    
472
python_tests = \
473
	test/ganeti.asyncnotifier_unittest.py \
474
	test/ganeti.backend_unittest.py \
475
	test/ganeti.bdev_unittest.py \
476
	test/ganeti.cli_unittest.py \
477
	test/ganeti.client.gnt_cluster_unittest.py \
478
	test/ganeti.client.gnt_instance_unittest.py \
479
	test/ganeti.daemon_unittest.py \
480
	test/ganeti.cmdlib_unittest.py \
481
	test/ganeti.compat_unittest.py \
482
	test/ganeti.confd.client_unittest.py \
483
	test/ganeti.config_unittest.py \
484
	test/ganeti.constants_unittest.py \
485
	test/ganeti.errors_unittest.py \
486
	test/ganeti.hooks_unittest.py \
487
	test/ganeti.ht_unittest.py \
488
	test/ganeti.http_unittest.py \
489
	test/ganeti.hypervisor_unittest.py \
490
	test/ganeti.hypervisor.hv_chroot_unittest.py \
491
	test/ganeti.hypervisor.hv_fake_unittest.py \
492
	test/ganeti.hypervisor.hv_kvm_unittest.py \
493
	test/ganeti.hypervisor.hv_lxc_unittest.py \
494
	test/ganeti.hypervisor.hv_xen_unittest.py \
495
	test/ganeti.impexpd_unittest.py \
496
	test/ganeti.jqueue_unittest.py \
497
	test/ganeti.locking_unittest.py \
498
	test/ganeti.luxi_unittest.py \
499
	test/ganeti.masterd.instance_unittest.py \
500
	test/ganeti.mcpu_unittest.py \
501
	test/ganeti.netutils_unittest.py \
502
	test/ganeti.objects_unittest.py \
503
	test/ganeti.opcodes_unittest.py \
504
	test/ganeti.qlang_unittest.py \
505
	test/ganeti.query_unittest.py \
506
	test/ganeti.rapi.baserlib_unittest.py \
507
	test/ganeti.rapi.client_unittest.py \
508
	test/ganeti.rapi.resources_unittest.py \
509
	test/ganeti.rapi.rlib2_unittest.py \
510
	test/ganeti.rpc_unittest.py \
511
	test/ganeti.runtime_unittest.py \
512
	test/ganeti.serializer_unittest.py \
513
	test/ganeti.ssh_unittest.py \
514
	test/ganeti.uidpool_unittest.py \
515
	test/ganeti.utils.algo_unittest.py \
516
	test/ganeti.utils.filelock_unittest.py \
517
	test/ganeti.utils.hash_unittest.py \
518
	test/ganeti.utils.io_unittest.py \
519
	test/ganeti.utils.log_unittest.py \
520
	test/ganeti.utils.mlock_unittest.py \
521
	test/ganeti.utils.nodesetup_unittest.py \
522
	test/ganeti.utils.process_unittest.py \
523
	test/ganeti.utils.retry_unittest.py \
524
	test/ganeti.utils.text_unittest.py \
525
	test/ganeti.utils.wrapper_unittest.py \
526
	test/ganeti.utils.x509_unittest.py \
527
	test/ganeti.utils_unittest.py \
528
	test/ganeti.workerpool_unittest.py \
529
	test/cfgupgrade_unittest.py \
530
	test/docs_unittest.py \
531
	test/tempfile_fork_unittest.py
532

    
533
dist_TESTS = \
534
	test/check-cert-expired_unittest.bash \
535
	test/daemon-util_unittest.bash \
536
	test/ganeti-cleaner_unittest.bash \
537
	test/import-export_unittest.bash \
538
	$(python_tests)
539

    
540
nodist_TESTS =
541

    
542
TESTS = $(dist_TESTS) $(nodist_TESTS)
543

    
544
# Environment for all tests
545
PLAIN_TESTS_ENVIRONMENT = \
546
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
547

    
548
# Environment for tests run by automake
549
TESTS_ENVIRONMENT = \
550
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
551

    
552
all_python_code = \
553
	$(dist_sbin_SCRIPTS) \
554
	$(dist_tools_SCRIPTS) \
555
	$(pkglib_python_scripts) \
556
	$(python_tests) \
557
	$(pkgpython_PYTHON) \
558
	$(client_PYTHON) \
559
	$(hypervisor_PYTHON) \
560
	$(rapi_PYTHON) \
561
	$(server_PYTHON) \
562
	$(http_PYTHON) \
563
	$(confd_PYTHON) \
564
	$(masterd_PYTHON) \
565
	$(impexpd_PYTHON) \
566
	$(utils_PYTHON) \
567
	$(watcher_PYTHON) \
568
	$(noinst_PYTHON) \
569
	$(qa_scripts)
570

    
571
srclink_files = \
572
	man/footer.rst \
573
	test/check-cert-expired_unittest.bash \
574
	test/daemon-util_unittest.bash \
575
	test/ganeti-cleaner_unittest.bash \
576
	test/import-export_unittest.bash \
577
	$(all_python_code)
578

    
579
check_python_code = \
580
	$(BUILD_BASH_COMPLETION) \
581
	$(DOCPP) \
582
	$(all_python_code)
583

    
584
lint_python_code = \
585
	ganeti \
586
	ganeti/http/server.py \
587
	$(dist_sbin_SCRIPTS) \
588
	$(dist_tools_SCRIPTS) \
589
	$(pkglib_python_scripts) \
590
	$(BUILD_BASH_COMPLETION) \
591
	$(DOCPP) \
592
	$(PYTHON_BOOTSTRAP)
593

    
594
test/daemon-util_unittest.bash: daemons/daemon-util
595

    
596
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
597

    
598
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
599
	sed -f $(REPLACE_VARS_SED) < $< > $@
600
	chmod +x $@
601

    
602
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
603
	sed -f $(REPLACE_VARS_SED) < $< > $@
604
	chmod u+x $@
605

    
606
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
607
	sed -f $(REPLACE_VARS_SED) < $< > $@
608
	chmod +x $@
609

    
610
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
611
	sed -f $(REPLACE_VARS_SED) < $< > $@
612

    
613
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
614
	sed -f $(REPLACE_VARS_SED) < $< > $@
615

    
616
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
617
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
618
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
619

    
620
doc/%.png: doc/%.dot
621
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
622
	$(DOT) -Tpng -o $@ $<
623

    
624
man/footer.man: man/footer.rst
625
	@test -n "$(PANDOC)" || \
626
	  { echo 'pandoc' not found during configure; exit 1; }
627
	$(PANDOC) -f rst -t man -o $@ $<
628

    
629
man/footer.html: man/footer.rst
630
	@test -n "$(PANDOC)" || \
631
	  { echo 'pandoc' not found during configure; exit 1; }
632
	$(PANDOC) -f rst -t html -o $@ $<
633

    
634
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
635
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
636

    
637
man/%.7.in man/%.8.in: man/%.gen man/footer.man
638
	@test -n "$(PANDOC)" || \
639
	  { echo 'pandoc' not found during configure; exit 1; }
640
	set -o pipefail ; \
641
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
642
	  sed -e 's/\\@/@/g' > $@
643
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
644

    
645
man/%.html.in: man/%.gen man/footer.html
646
	@test -n "$(PANDOC)" || \
647
	  { echo 'pandoc' not found during configure; exit 1; }
648
	set -o pipefail ; \
649
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
650
	  sed -e 's/\\@/@/g' > $@
651

    
652
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
653
	sed -f $(REPLACE_VARS_SED) < $< > $@
654

    
655
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
656
	sed -f $(REPLACE_VARS_SED) < $< > $@
657

    
658
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
659
	sed -f $(REPLACE_VARS_SED) < $< > $@
660

    
661
epydoc.conf: epydoc.conf.in Makefile
662
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
663

    
664
vcs-version:
665
	if test -d .git; then \
666
	  git describe > $@; \
667
	elif test ! -f $@ ; then \
668
	  echo "Cannot auto-generate $@ file"; exit 1; \
669
	fi
670

    
671
.PHONY: regen-vcs-version
672
regen-vcs-version:
673
	set -e; \
674
	cd $(srcdir); \
675
	if test -d .git; then \
676
	  rm -f vcs-version; \
677
	  $(MAKE) vcs-version; \
678
	fi
679

    
680
lib/_autoconf.py: Makefile vcs-version | lib/.dir
681
	set -e; \
682
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
683
	{ echo '# This file is automatically generated, do not edit!'; \
684
	  echo '#'; \
685
	  echo ''; \
686
	  echo '"""Build-time configuration for Ganeti.'; \
687
	  echo '';\
688
	  echo 'This file is autogenerated by the build process.'; \
689
	  echo 'For any changes you need to re-run ./configure (and'; \
690
	  echo 'not edit by hand).'; \
691
	  echo ''; \
692
	  echo '"""'; \
693
	  echo ''; \
694
	  echo '# pylint: disable-msg=C0301,C0324'; \
695
	  echo '# because this is autogenerated, we do not want'; \
696
	  echo '# style warnings' ; \
697
	  echo ''; \
698
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
699
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
700
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
701
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
702
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
703
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
704
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
705
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
706
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
707
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
708
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
709
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
710
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
711
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
712
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
713
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
714
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
715
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
716
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
717
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
718
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
719
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
720
	  echo "TOOLSDIR = '$(toolsdir)'"; \
721
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
722
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
723
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
724
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
725
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
726
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
727
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
728
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
729
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
730
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
731
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
732
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
733
	  echo "NODED_USER = '$(NODED_USER)'"; \
734
	  echo "VCS_VERSION = '$$VCSVER'"; \
735
	  echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
736
	} > $@
737

    
738
$(REPLACE_VARS_SED): Makefile
739
	set -e; \
740
	{ echo 's#@PREFIX@#$(prefix)#g'; \
741
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
742
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
743
	  echo 's#@BINDIR@#$(bindir)#g'; \
744
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
745
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
746
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
747
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
748
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
749
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
750
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
751
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
752
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
753
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
754
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
755
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
756
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
757
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
758
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
759
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
760
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
761
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
762
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
763
	} > $@
764

    
765
# Using deferred evaluation
766
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
767
daemons/ganeti-watcher: MODULE = ganeti.watcher
768
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
769

    
770
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
771
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
772
	set -e; \
773
	{ echo '#!/usr/bin/python'; \
774
	  echo '# This file is automatically generated, do not edit!'; \
775
	  echo "# Edit $(MODULE) instead."; \
776
	  echo; \
777
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
778
	  echo; \
779
	  echo '# pylint: disable-msg=C0103'; \
780
	  echo '# C0103: Invalid name'; \
781
	  echo; \
782
	  echo 'import sys'; \
783
	  echo 'import $(MODULE) as main'; \
784
	  echo; \
785
	  echo '# Temporarily alias commands until bash completion'; \
786
	  echo '# generator is changed'; \
787
	  echo 'if hasattr(main, "commands"):'; \
788
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
789
	  echo; \
790
	  echo 'if __name__ == "__main__":'; \
791
	  echo '  sys.exit(main.Main())'; \
792
	} > $@
793
	chmod u+x $@
794

    
795
# We need to create symlinks because "make distcheck" will not install Python
796
# files when building.
797
stamp-srclinks: Makefile | $(all_dirfiles)
798
	set -e; \
799
	for i in $(srclink_files); do \
800
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
801
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
802
		fi; \
803
	done
804
	touch $@
805

    
806
.PHONY: ganeti
807
ganeti:
808
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
809

    
810
.PHONY: check-dirs
811
check-dirs: $(BUILT_SOURCES)
812
	@set -e; \
813
	find . -type d \( \( -name . \) -o \( \
814
		-name .git -o \
815
		-name autom4te.cache \
816
		\) -prune -o -print \) | { \
817
		error=; \
818
		while read dir; do \
819
			case "$$dir" in \
820
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
821
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
822
			esac; \
823
		done; \
824
		for dir in $(DIRS); do \
825
			if ! test -d "$$dir"; then \
826
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
827
				error=1; \
828
			fi \
829
		done; \
830
		if test -n "$$error"; then exit 1; else exit 0; fi; \
831
	}
832

    
833
check-local: check-dirs
834
	$(CHECK_PYTHON_CODE) $(check_python_code)
835
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
836
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
837

    
838
.PHONY: lint
839
lint: $(BUILT_SOURCES)
840
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
841
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
842
	cd $(top_srcdir)/qa && \
843
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
844
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
845

    
846
# a dist hook rule for updating the vcs-version file; this is
847
# hardcoded due to where it needs to build the file...
848
dist-hook:
849
	$(MAKE) regen-vcs-version && \
850
	rm -f $(top_distdir)/vcs-version && \
851
	cp -p $(srcdir)/vcs-version $(top_distdir)
852

    
853
# a distcheck hook rule for catching revision control directories
854
distcheck-hook:
855
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
856
		echo "Found revision control files in final archive." 1>&2; \
857
		exit 1; \
858
	fi
859
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
860
		echo "Found Python byte code in final archive." 1>&2; \
861
		exit 1; \
862
	fi
863
	if find $(top_distdir) -name '*~' | grep .; then \
864
		echo "Found backup files in final archive." 1>&2; \
865
		exit 1; \
866
	fi
867
# Empty files or directories should not be distributed. They can cause
868
# unnecessary warnings for packagers. Directories used by automake during
869
# distcheck must be excluded.
870
	if find $(top_distdir) -empty -and -not \( \
871
			-path $(top_distdir)/_build -or \
872
			-path $(top_distdir)/_inst \) | grep .; then \
873
		echo "Found empty files or directories in final archive." 1>&2; \
874
		exit 1; \
875
	fi
876
	if test -n "$(BUILD_RELEASE)" && \
877
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
878
		echo "Found unreleased version in NEWS." >&2; \
879
		exit 1; \
880
	fi
881

    
882
# When building a release, stricter checks should be used
883
distcheck-release dist-release: export BUILD_RELEASE = 1
884
distcheck-release: distcheck
885

    
886
dist-release: dist
887
	set -e; \
888
	for i in $(DIST_ARCHIVES); do \
889
		echo -n "Checking $$i ... "; \
890
		autotools/check-tar < $$i; \
891
		echo OK; \
892
	done
893

    
894
install-exec-local:
895
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
896
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
897
	  "$(DESTDIR)${localstatedir}/run/ganeti"
898

    
899
# To avoid conflicts between directory names and other targets, a file inside
900
# the directory is used to ensure its existence.
901
%.dir:
902
	@mkdir_p@ $* && touch $@
903

    
904
.PHONY: apidoc
905
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
906
	$(RUN_IN_TEMPDIR) epydoc -v \
907
		--conf $(CURDIR)/epydoc.conf \
908
		--output $(CURDIR)/doc/api
909

    
910
.PHONY: TAGS
911
TAGS: $(BUILT_SOURCES)
912
	rm -f TAGS
913
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
914
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
915
	  -path './qa/*.py' | \
916
	  etags -l python -
917

    
918
.PHONY: coverage
919
coverage: $(BUILT_SOURCES) $(python_tests)
920
	set -e; \
921
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
922
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
923
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
924
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
925
	$(python_tests)
926

    
927
commit-check: distcheck lint apidoc
928

    
929
-include ./Makefile.local
930

    
931
# vim: set noet :