Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 4ae49c63

History | View | Annotate | Download (24.8 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
BUILD_ZSH_COMPLETION = $(top_srcdir)/autotools/build-zsh-completion
18
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
19
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
20
CHECK_MAN = $(top_srcdir)/autotools/check-man
21
CHECK_VERSION = $(top_srcdir)/autotools/check-version
22
CHECK_NEWS = $(top_srcdir)/autotools/check-news
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/zsh_completion \
106
	doc/examples/ganeti.initd \
107
	doc/examples/ganeti-kvm-poweroff.initd \
108
	doc/examples/ganeti.cron \
109
	doc/examples/gnt-config-backup \
110
	doc/examples/hooks/ipsec \
111
	$(man_MANS) \
112
	$(manhtml) \
113
	tools/kvm-ifup \
114
	stamp-srclinks \
115
	$(nodist_pkgpython_PYTHON)
116

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

    
126
nodist_pkgpython_PYTHON = \
127
	lib/_autoconf.py
128

    
129
noinst_PYTHON = \
130
	lib/build/__init__.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-oob.rst \
245
	doc/design-query2.rst \
246
	doc/cluster-merge.rst \
247
	doc/design-shared-storage.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
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
266
	$(RUN_IN_TEMPDIR)
267
	@test -n "$(SPHINX)" || \
268
	    { echo 'sphinx-build' not found during configure; exit 1; }
269
	@mkdir_p@ $(dir $@)
270
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
271
	    -d . \
272
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
273
	    -D release="$(PACKAGE_VERSION)" \
274
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
275
	rm -f doc/html/.buildinfo doc/html/objects.inv
276
	touch $@
277

    
278
doc/html: doc/html/index.html
279

    
280
doc/install-quick.rst: INSTALL
281
doc/news.rst: NEWS
282
doc/upgrade.rst: UPGRADE
283

    
284
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
285
	set -e; \
286
	{ echo '.. This file is automatically updated at build time from $<.'; \
287
	  echo '.. Do not edit.'; \
288
	  echo; \
289
	  cat $<; \
290
	} > $@
291

    
292
docdot = \
293
	doc/arch-2.0.dot \
294
	doc/design-2.1-lock-acquire.dot \
295
	doc/design-2.1-lock-release.dot
296

    
297
docpng = $(patsubst %.dot,%.png,$(docdot))
298

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

    
313
gnt_scripts = \
314
	scripts/gnt-backup \
315
	scripts/gnt-cluster \
316
	scripts/gnt-debug \
317
	scripts/gnt-group \
318
	scripts/gnt-instance \
319
	scripts/gnt-job \
320
	scripts/gnt-node \
321
	scripts/gnt-os
322

    
323
PYTHON_BOOTSTRAP = \
324
	daemons/ganeti-confd \
325
	daemons/ganeti-masterd \
326
	daemons/ganeti-noded \
327
	daemons/ganeti-watcher \
328
	daemons/ganeti-rapi \
329
	scripts/gnt-backup \
330
	scripts/gnt-cluster \
331
	scripts/gnt-debug \
332
	scripts/gnt-group \
333
	scripts/gnt-instance \
334
	scripts/gnt-job \
335
	scripts/gnt-node \
336
	scripts/gnt-os
337

    
338
qa_scripts = \
339
	qa/ganeti-qa.py \
340
	qa/qa_cluster.py \
341
	qa/qa_config.py \
342
	qa/qa_daemon.py \
343
	qa/qa_env.py \
344
	qa/qa_error.py \
345
	qa/qa_instance.py \
346
	qa/qa_node.py \
347
	qa/qa_os.py \
348
	qa/qa_rapi.py \
349
	qa/qa_tags.py \
350
	qa/qa_utils.py
351

    
352
dist_sbin_SCRIPTS = \
353
	tools/ganeti-listrunner
354

    
355
nodist_sbin_SCRIPTS = \
356
	$(PYTHON_BOOTSTRAP) \
357
	daemons/ganeti-cleaner
358

    
359
dist_tools_SCRIPTS = \
360
	tools/burnin \
361
	tools/cfgshell \
362
	tools/cfgupgrade \
363
	tools/cfgupgrade12 \
364
	tools/cfgupgrade_grnet \
365
	tools/upgrade-kvm-runtime \
366
	tools/cluster-merge \
367
	tools/lvmstrap \
368
	tools/move-instance \
369
	tools/setup-ssh \
370
	tools/sanitize-config
371

    
372
pkglib_python_scripts = \
373
	daemons/import-export \
374
	tools/check-cert-expired
375

    
376
pkglib_SCRIPTS = \
377
	daemons/daemon-util \
378
	daemons/ensure-dirs \
379
	tools/kvm-ifup \
380
	$(pkglib_python_scripts)
381

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

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

    
448
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
449
manhtml = $(patsubst %.rst,%.html,$(manrst))
450
maninput = \
451
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
452
	$(patsubst %.html,%.html.in,$(manhtml)) \
453
	man/footer.man man/footer.html
454

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

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

    
528
dist_TESTS = \
529
	test/check-cert-expired_unittest.bash \
530
	test/daemon-util_unittest.bash \
531
	test/ganeti-cleaner_unittest.bash \
532
	test/import-export_unittest.bash \
533
	$(python_tests)
534

    
535
nodist_TESTS =
536

    
537
TESTS = $(dist_TESTS) $(nodist_TESTS)
538

    
539
# Environment for all tests
540
PLAIN_TESTS_ENVIRONMENT = \
541
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
542

    
543
# Environment for tests run by automake
544
TESTS_ENVIRONMENT = \
545
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
546

    
547
all_python_code = \
548
	$(dist_sbin_SCRIPTS) \
549
	$(dist_tools_SCRIPTS) \
550
	$(pkglib_python_scripts) \
551
	$(python_tests) \
552
	$(pkgpython_PYTHON) \
553
	$(client_PYTHON) \
554
	$(hypervisor_PYTHON) \
555
	$(rapi_PYTHON) \
556
	$(server_PYTHON) \
557
	$(http_PYTHON) \
558
	$(confd_PYTHON) \
559
	$(masterd_PYTHON) \
560
	$(impexpd_PYTHON) \
561
	$(utils_PYTHON) \
562
	$(watcher_PYTHON) \
563
	$(noinst_PYTHON) \
564
	$(qa_scripts)
565

    
566
srclink_files = \
567
	man/footer.rst \
568
	test/check-cert-expired_unittest.bash \
569
	test/daemon-util_unittest.bash \
570
	test/ganeti-cleaner_unittest.bash \
571
	test/import-export_unittest.bash \
572
	$(all_python_code)
573

    
574
check_python_code = \
575
	$(BUILD_BASH_COMPLETION) \
576
	$(BUILD_ZSH_COMPLETION) \
577
	$(all_python_code)
578

    
579
lint_python_code = \
580
	ganeti \
581
	ganeti/http/server.py \
582
	$(dist_sbin_SCRIPTS) \
583
	$(dist_tools_SCRIPTS) \
584
	$(pkglib_python_scripts) \
585
	$(BUILD_BASH_COMPLETION) \
586
	$(BUILD_ZSH_COMPLETION) \
587
	$(PYTHON_BOOTSTRAP)
588

    
589
test/daemon-util_unittest.bash: daemons/daemon-util
590

    
591
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
592

    
593
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
594
	sed -f $(REPLACE_VARS_SED) < $< > $@
595
	chmod +x $@
596

    
597
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
598
	sed -f $(REPLACE_VARS_SED) < $< > $@
599
	chmod u+x $@
600

    
601
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
602
	sed -f $(REPLACE_VARS_SED) < $< > $@
603
	chmod +x $@
604

    
605
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
606
	sed -f $(REPLACE_VARS_SED) < $< > $@
607

    
608
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
609
	sed -f $(REPLACE_VARS_SED) < $< > $@
610

    
611
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
612
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
613
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
614

    
615
doc/examples/zsh_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
616
	lib/cli.py $(gnt_scripts) $(client_PYTHON)
617
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_ZSH_COMPLETION) > $@
618

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

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

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

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

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

    
648
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
649
	sed -f $(REPLACE_VARS_SED) < $< > $@
650

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

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

    
657
epydoc.conf: epydoc.conf.in
658
	sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@
659

    
660
vcs-version:
661
	if test -d .git; then \
662
	  git describe > $@; \
663
	elif test ! -f $@ ; then \
664
	  echo "Cannot auto-generate $@ file"; exit 1; \
665
	fi
666

    
667
.PHONY: regen-vcs-version
668
regen-vcs-version:
669
	set -e; \
670
	cd $(srcdir); \
671
	if test -d .git; then \
672
	  rm -f vcs-version; \
673
	  $(MAKE) vcs-version; \
674
	fi
675

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
925
commit-check: distcheck lint apidoc
926

    
927
-include ./Makefile.local
928

    
929
# vim: set noet :