Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 26916aad

History | View | Annotate | Download (23.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
ACLOCAL_AMFLAGS = -I autotools
13
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
14
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
15
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
16
CHECK_MAN = $(top_srcdir)/autotools/check-man
17
CHECK_VERSION = $(top_srcdir)/autotools/check-version
18
REPLACE_VARS_SED = autotools/replace_vars.sed
19

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

    
33
# Delete output file if an error occurred while building it
34
.DELETE_ON_ERROR:
35

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

    
62
BUILDTIME_DIR_AUTOCREATE = \
63
	scripts \
64
	doc/api \
65
	doc/coverage
66

    
67
BUILDTIME_DIRS = \
68
	$(BUILDTIME_DIR_AUTOCREATE) \
69
	doc/html
70

    
71
DIRCHECK_EXCLUDE = \
72
	$(BUILDTIME_DIRS) \
73
	ganeti-[0-9]*.[0-9]*.[0-9]* \
74
	doc/html/_*
75

    
76
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
77

    
78
MAINTAINERCLEANFILES = \
79
	$(docpng) \
80
	$(maninput) \
81
	doc/install-quick.rst \
82
	doc/news.rst \
83
	doc/upgrade.rst \
84
	vcs-version
85

    
86
maintainer-clean-local:
87
	rm -rf $(BUILDTIME_DIRS)
88

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

    
110
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
111
# it'll cause the target to rebuild every time.
112
BUILT_SOURCES = \
113
	ganeti \
114
	stamp-srclinks \
115
	lib/_autoconf.py \
116
	$(all_dirfiles) \
117
	$(PYTHON_BOOTSTRAP)
118

    
119
nodist_pkgpython_PYTHON = \
120
	lib/_autoconf.py
121

    
122
noinst_PYTHON = \
123
	lib/build/__init__.py
124

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

    
158
client_PYTHON = \
159
	lib/client/__init__.py \
160
	lib/client/gnt_backup.py \
161
	lib/client/gnt_cluster.py \
162
	lib/client/gnt_debug.py \
163
	lib/client/gnt_group.py \
164
	lib/client/gnt_instance.py \
165
	lib/client/gnt_job.py \
166
	lib/client/gnt_node.py \
167
	lib/client/gnt_os.py
168

    
169
hypervisor_PYTHON = \
170
	lib/hypervisor/__init__.py \
171
	lib/hypervisor/hv_base.py \
172
	lib/hypervisor/hv_chroot.py \
173
	lib/hypervisor/hv_fake.py \
174
	lib/hypervisor/hv_kvm.py \
175
	lib/hypervisor/hv_lxc.py \
176
	lib/hypervisor/hv_xen.py
177

    
178
rapi_PYTHON = \
179
	lib/rapi/__init__.py \
180
	lib/rapi/baserlib.py \
181
	lib/rapi/client.py \
182
	lib/rapi/client_utils.py \
183
	lib/rapi/connector.py \
184
	lib/rapi/rlib2.py
185

    
186
http_PYTHON = \
187
	lib/http/__init__.py \
188
	lib/http/auth.py \
189
	lib/http/client.py \
190
	lib/http/server.py
191

    
192
confd_PYTHON = \
193
	lib/confd/__init__.py \
194
	lib/confd/client.py \
195
	lib/confd/querylib.py \
196
	lib/confd/server.py
197

    
198
masterd_PYTHON = \
199
	lib/masterd/__init__.py \
200
	lib/masterd/instance.py
201

    
202
impexpd_PYTHON = \
203
	lib/impexpd/__init__.py
204

    
205
watcher_PYTHON = \
206
	lib/watcher/__init__.py
207

    
208
server_PYTHON = \
209
	lib/server/__init__.py \
210
	lib/server/confd.py \
211
	lib/server/masterd.py \
212
	lib/server/noded.py \
213
	lib/server/rapi.py
214

    
215
utils_PYTHON = \
216
	lib/utils/__init__.py \
217
	lib/utils/algo.py \
218
	lib/utils/filelock.py \
219
	lib/utils/hash.py \
220
	lib/utils/io.py \
221
	lib/utils/log.py \
222
	lib/utils/mlock.py \
223
	lib/utils/nodesetup.py \
224
	lib/utils/process.py \
225
	lib/utils/retry.py \
226
	lib/utils/text.py \
227
	lib/utils/wrapper.py \
228
	lib/utils/x509.py
229

    
230
docrst = \
231
	doc/admin.rst \
232
	doc/design-2.0.rst \
233
	doc/design-2.1.rst \
234
	doc/design-2.2.rst \
235
	doc/design-2.3.rst \
236
	doc/design-2.4.rst \
237
	doc/design-oob.rst \
238
	doc/design-query2.rst \
239
	doc/cluster-merge.rst \
240
	doc/devnotes.rst \
241
	doc/glossary.rst \
242
	doc/hooks.rst \
243
	doc/iallocator.rst \
244
	doc/index.rst \
245
	doc/install-quick.rst \
246
	doc/install.rst \
247
	doc/locking.rst \
248
	doc/move-instance.rst \
249
	doc/news.rst \
250
	doc/rapi.rst \
251
	doc/security.rst \
252
	doc/upgrade.rst \
253
	doc/walkthrough.rst
254

    
255
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
256

    
257
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
258
	$(RUN_IN_TEMPDIR)
259
	@test -n "$(SPHINX)" || \
260
	    { echo 'sphinx-build' not found during configure; exit 1; }
261
	@mkdir_p@ $(dir $@)
262
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
263
	    -d . \
264
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
265
	    -D release="$(PACKAGE_VERSION)" \
266
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
267
	rm -f doc/html/.buildinfo doc/html/objects.inv
268
	touch $@
269

    
270
doc/html: doc/html/index.html
271

    
272
doc/install-quick.rst: INSTALL
273
doc/news.rst: NEWS
274
doc/upgrade.rst: UPGRADE
275

    
276
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
277
	set -e; \
278
	{ echo '.. This file is automatically updated at build time from $<.'; \
279
	  echo '.. Do not edit.'; \
280
	  echo; \
281
	  cat $<; \
282
	} > $@
283

    
284
docdot = \
285
	doc/arch-2.0.dot \
286
	doc/design-2.1-lock-acquire.dot \
287
	doc/design-2.1-lock-release.dot
288

    
289
docpng = $(patsubst %.dot,%.png,$(docdot))
290

    
291
# Things to build but not to install (add it to EXTRA_DIST if it should be
292
# distributed)
293
noinst_DATA = \
294
	devel/upload \
295
	doc/html \
296
	doc/examples/bash_completion \
297
	doc/examples/ganeti.cron \
298
	doc/examples/ganeti.initd \
299
	doc/examples/ganeti-kvm-poweroff.initd \
300
	doc/examples/gnt-config-backup \
301
	doc/examples/hooks/ipsec \
302
	$(manhtml)
303

    
304
gnt_scripts = \
305
	scripts/gnt-backup \
306
	scripts/gnt-cluster \
307
	scripts/gnt-debug \
308
	scripts/gnt-group \
309
	scripts/gnt-instance \
310
	scripts/gnt-job \
311
	scripts/gnt-node \
312
	scripts/gnt-os
313

    
314
PYTHON_BOOTSTRAP = \
315
	daemons/ganeti-confd \
316
	daemons/ganeti-masterd \
317
	daemons/ganeti-noded \
318
	daemons/ganeti-watcher \
319
	daemons/ganeti-rapi \
320
	scripts/gnt-backup \
321
	scripts/gnt-cluster \
322
	scripts/gnt-debug \
323
	scripts/gnt-group \
324
	scripts/gnt-instance \
325
	scripts/gnt-job \
326
	scripts/gnt-node \
327
	scripts/gnt-os
328

    
329
qa_scripts = \
330
	qa/ganeti-qa.py \
331
	qa/qa_cluster.py \
332
	qa/qa_config.py \
333
	qa/qa_daemon.py \
334
	qa/qa_env.py \
335
	qa/qa_error.py \
336
	qa/qa_instance.py \
337
	qa/qa_node.py \
338
	qa/qa_os.py \
339
	qa/qa_rapi.py \
340
	qa/qa_tags.py \
341
	qa/qa_utils.py
342

    
343
dist_sbin_SCRIPTS = \
344
	tools/ganeti-listrunner
345

    
346
nodist_sbin_SCRIPTS = \
347
	$(PYTHON_BOOTSTRAP) \
348
	daemons/ganeti-cleaner
349

    
350
dist_tools_SCRIPTS = \
351
	tools/burnin \
352
	tools/cfgshell \
353
	tools/cfgupgrade \
354
	tools/cfgupgrade12 \
355
	tools/cluster-merge \
356
	tools/lvmstrap \
357
	tools/move-instance \
358
	tools/setup-ssh \
359
	tools/sanitize-config
360

    
361
pkglib_python_scripts = \
362
	daemons/import-export \
363
	tools/check-cert-expired
364

    
365
pkglib_SCRIPTS = \
366
	daemons/daemon-util \
367
	daemons/ensure-dirs \
368
	tools/kvm-ifup \
369
	$(pkglib_python_scripts)
370

    
371
EXTRA_DIST = \
372
	NEWS \
373
	UPGRADE \
374
	pylintrc \
375
	autotools/build-bash-completion \
376
	autotools/check-python-code \
377
	autotools/check-man \
378
	autotools/check-tar \
379
	autotools/check-version \
380
	autotools/gen-coverage \
381
	autotools/testrunner \
382
	$(RUN_IN_TEMPDIR) \
383
	daemons/daemon-util.in \
384
	daemons/ensure-dirs.in \
385
	daemons/ganeti-cleaner.in \
386
	$(pkglib_python_scripts) \
387
	devel/upload.in \
388
	tools/kvm-ifup.in \
389
	$(docdot) \
390
	$(docpng) \
391
	$(docrst) \
392
	doc/conf.py \
393
	doc/html \
394
	doc/examples/ganeti.initd.in \
395
	doc/examples/ganeti-kvm-poweroff.initd.in \
396
	doc/examples/ganeti.cron.in \
397
	doc/examples/gnt-config-backup.in \
398
	doc/examples/dumb-allocator \
399
	doc/examples/ganeti.default \
400
	doc/examples/ganeti.default-debug \
401
	doc/examples/hooks/ethers \
402
	doc/examples/hooks/ipsec.in \
403
	doc/examples/gnt-debug/README \
404
	doc/examples/gnt-debug/delay0.json \
405
	doc/examples/gnt-debug/delay50.json \
406
	test/testutils.py \
407
	test/mocks.py \
408
	$(dist_TESTS) \
409
	$(TEST_FILES) \
410
	man/footer.rst \
411
	$(manrst) \
412
	$(maninput) \
413
	qa/qa-sample.json \
414
	$(qa_scripts)
415

    
416
man_MANS = \
417
	man/ganeti.7 \
418
	man/ganeti-cleaner.8 \
419
	man/ganeti-confd.8 \
420
	man/ganeti-listrunner.8 \
421
	man/ganeti-masterd.8 \
422
	man/ganeti-noded.8 \
423
	man/ganeti-os-interface.7 \
424
	man/ganeti-rapi.8 \
425
	man/ganeti-watcher.8 \
426
	man/gnt-backup.8 \
427
	man/gnt-cluster.8 \
428
	man/gnt-debug.8 \
429
	man/gnt-group.8 \
430
	man/gnt-instance.8 \
431
	man/gnt-job.8 \
432
	man/gnt-node.8 \
433
	man/gnt-os.8
434

    
435
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
436
manhtml = $(patsubst %.rst,%.html,$(manrst))
437
maninput = \
438
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
439
	$(patsubst %.html,%.html.in,$(manhtml)) \
440
	man/footer.man man/footer.html
441

    
442
TEST_FILES = \
443
	test/data/bdev-drbd-8.0.txt \
444
	test/data/bdev-drbd-8.3.txt \
445
	test/data/bdev-drbd-disk.txt \
446
	test/data/bdev-drbd-net-ip4.txt \
447
	test/data/bdev-drbd-net-ip6.txt \
448
	test/data/cert1.pem \
449
	test/data/proc_drbd8.txt \
450
	test/data/proc_drbd80-emptyline.txt \
451
	test/data/proc_drbd83.txt \
452
	test/data/sys_drbd_usermode_helper.txt \
453
	test/import-export_unittest-helper
454

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

    
514
dist_TESTS = \
515
	test/check-cert-expired_unittest.bash \
516
	test/daemon-util_unittest.bash \
517
	test/ganeti-cleaner_unittest.bash \
518
	test/import-export_unittest.bash \
519
	$(python_tests)
520

    
521
nodist_TESTS =
522

    
523
TESTS = $(dist_TESTS) $(nodist_TESTS)
524

    
525
# Environment for all tests
526
PLAIN_TESTS_ENVIRONMENT = \
527
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
528

    
529
# Environment for tests run by automake
530
TESTS_ENVIRONMENT = \
531
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
532

    
533
all_python_code = \
534
	$(dist_sbin_SCRIPTS) \
535
	$(dist_tools_SCRIPTS) \
536
	$(pkglib_python_scripts) \
537
	$(python_tests) \
538
	$(pkgpython_PYTHON) \
539
	$(client_PYTHON) \
540
	$(hypervisor_PYTHON) \
541
	$(rapi_PYTHON) \
542
	$(server_PYTHON) \
543
	$(http_PYTHON) \
544
	$(confd_PYTHON) \
545
	$(masterd_PYTHON) \
546
	$(impexpd_PYTHON) \
547
	$(utils_PYTHON) \
548
	$(watcher_PYTHON) \
549
	$(noinst_PYTHON) \
550
	$(qa_scripts)
551

    
552
srclink_files = \
553
	man/footer.rst \
554
	test/check-cert-expired_unittest.bash \
555
	test/daemon-util_unittest.bash \
556
	test/ganeti-cleaner_unittest.bash \
557
	test/import-export_unittest.bash \
558
	$(all_python_code)
559

    
560
check_python_code = \
561
	$(BUILD_BASH_COMPLETION) \
562
	$(all_python_code)
563

    
564
lint_python_code = \
565
	ganeti \
566
	ganeti/http/server.py \
567
	$(dist_sbin_SCRIPTS) \
568
	$(dist_tools_SCRIPTS) \
569
	$(pkglib_python_scripts) \
570
	$(BUILD_BASH_COMPLETION) \
571
	$(PYTHON_BOOTSTRAP)
572

    
573
test/daemon-util_unittest.bash: daemons/daemon-util
574

    
575
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
576

    
577
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
578
	sed -f $(REPLACE_VARS_SED) < $< > $@
579
	chmod +x $@
580

    
581
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
582
	sed -f $(REPLACE_VARS_SED) < $< > $@
583
	chmod u+x $@
584

    
585
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
586
	sed -f $(REPLACE_VARS_SED) < $< > $@
587
	chmod +x $@
588

    
589
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
590
	sed -f $(REPLACE_VARS_SED) < $< > $@
591

    
592
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
593
	sed -f $(REPLACE_VARS_SED) < $< > $@
594

    
595
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
596
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
597
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
598

    
599
doc/%.png: doc/%.dot
600
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
601
	$(DOT) -Tpng -o $@ $<
602

    
603
man/footer.man: man/footer.rst
604
	@test -n "$(PANDOC)" || \
605
	  { echo 'pandoc' not found during configure; exit 1; }
606
	$(PANDOC) -f rst -t man -o $@ $<
607

    
608
man/footer.html: man/footer.rst
609
	@test -n "$(PANDOC)" || \
610
	  { echo 'pandoc' not found during configure; exit 1; }
611
	$(PANDOC) -f rst -t html -o $@ $<
612

    
613
man/%.7.in man/%.8.in: man/%.rst man/footer.man
614
	@test -n "$(PANDOC)" || \
615
	  { echo 'pandoc' not found during configure; exit 1; }
616
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
617
	  sed -e 's/\\@/@/g' > $@
618
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
619

    
620
man/%.html.in: man/%.rst man/footer.html
621
	@test -n "$(PANDOC)" || \
622
	  { echo 'pandoc' not found during configure; exit 1; }
623
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
624
	  sed -e 's/\\@/@/g' > $@
625

    
626

    
627
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
628
	sed -f $(REPLACE_VARS_SED) < $< > $@
629

    
630
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
631
	sed -f $(REPLACE_VARS_SED) < $< > $@
632

    
633
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
634
	sed -f $(REPLACE_VARS_SED) < $< > $@
635

    
636
vcs-version:
637
	if test -d .git; then \
638
	  git describe > $@; \
639
	elif test ! -f $@ ; then \
640
	  echo "Cannot auto-generate $@ file"; exit 1; \
641
	fi
642

    
643
.PHONY: regen-vcs-version
644
regen-vcs-version:
645
	set -e; \
646
	cd $(srcdir); \
647
	if test -d .git; then \
648
	  rm -f vcs-version; \
649
	  $(MAKE) vcs-version; \
650
	fi
651

    
652
lib/_autoconf.py: Makefile vcs-version | lib/.dir
653
	set -e; \
654
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
655
	{ echo '# This file is automatically generated, do not edit!'; \
656
	  echo '#'; \
657
	  echo ''; \
658
	  echo '"""Build-time configuration for Ganeti.'; \
659
	  echo '';\
660
	  echo 'This file is autogenerated by the build process.'; \
661
	  echo 'For any changes you need to re-run ./configure (and'; \
662
	  echo 'not edit by hand).'; \
663
	  echo ''; \
664
	  echo '"""'; \
665
	  echo ''; \
666
	  echo '# pylint: disable-msg=C0301,C0324'; \
667
	  echo '# because this is autogenerated, we do not want'; \
668
	  echo '# style warnings' ; \
669
	  echo ''; \
670
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
671
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
672
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
673
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
674
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
675
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
676
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
677
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
678
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
679
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
680
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
681
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
682
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
683
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
684
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
685
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
686
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
687
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
688
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
689
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
690
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
691
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
692
	  echo "TOOLSDIR = '$(toolsdir)'"; \
693
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
694
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
695
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
696
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
697
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
698
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
699
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
700
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
701
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
702
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
703
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
704
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
705
	  echo "NODED_USER = '$(NODED_USER)'"; \
706
	  echo "VCS_VERSION = '$$VCSVER'"; \
707
	  echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
708
	} > $@
709

    
710
$(REPLACE_VARS_SED): Makefile
711
	set -e; \
712
	{ echo 's#@PREFIX@#$(prefix)#g'; \
713
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
714
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
715
	  echo 's#@BINDIR@#$(bindir)#g'; \
716
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
717
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
718
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
719
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
720
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
721
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
722
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
723
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
724
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
725
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
726
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
727
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
728
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
729
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
730
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
731
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
732
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
733
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
734
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
735
	} > $@
736

    
737
# Using deferred evaluation
738
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
739
daemons/ganeti-watcher: MODULE = ganeti.watcher
740
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
741

    
742
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
743
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
744
	set -e; \
745
	{ echo '#!/usr/bin/python'; \
746
	  echo '# This file is automatically generated, do not edit!'; \
747
	  echo "# Edit $(MODULE) instead."; \
748
	  echo; \
749
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
750
	  echo; \
751
	  echo '# pylint: disable-msg=C0103'; \
752
	  echo '# C0103: Invalid name'; \
753
	  echo; \
754
	  echo 'import sys'; \
755
	  echo 'import $(MODULE) as main'; \
756
	  echo; \
757
	  echo '# Temporarily alias commands until bash completion'; \
758
	  echo '# generator is changed'; \
759
	  echo 'if hasattr(main, "commands"):'; \
760
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
761
	  echo; \
762
	  echo 'if __name__ == "__main__":'; \
763
	  echo '  sys.exit(main.Main())'; \
764
	} > $@
765
	chmod u+x $@
766

    
767
# We need to create symlinks because "make distcheck" will not install Python
768
# files when building.
769
stamp-srclinks: Makefile | $(all_dirfiles)
770
	set -e; \
771
	for i in $(srclink_files); do \
772
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
773
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
774
		fi; \
775
	done
776
	touch $@
777

    
778
.PHONY: ganeti
779
ganeti:
780
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
781

    
782
.PHONY: check-dirs
783
check-dirs: $(BUILT_SOURCES)
784
	@set -e; \
785
	find . -type d \( \( -name . \) -o \( \
786
		-name .git -o \
787
		-name autom4te.cache \
788
		\) -prune -o -print \) | { \
789
		error=; \
790
		while read dir; do \
791
			case "$$dir" in \
792
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
793
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
794
			esac; \
795
		done; \
796
		for dir in $(DIRS); do \
797
			if ! test -d "$$dir"; then \
798
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
799
				error=1; \
800
			fi \
801
		done; \
802
		if test -n "$$error"; then exit 1; else exit 0; fi; \
803
	}
804

    
805
check-local: check-dirs
806
	$(CHECK_PYTHON_CODE) $(check_python_code)
807
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
808

    
809
.PHONY: lint
810
lint: $(BUILT_SOURCES)
811
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
812
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
813
	cd $(top_srcdir)/qa && \
814
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
815
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
816

    
817
# a dist hook rule for updating the vcs-version file; this is
818
# hardcoded due to where it needs to build the file...
819
dist-hook:
820
	$(MAKE) regen-vcs-version && \
821
	rm -f $(top_distdir)/vcs-version && \
822
	cp -p $(srcdir)/vcs-version $(top_distdir)
823

    
824
# a distcheck hook rule for catching revision control directories
825
distcheck-hook:
826
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
827
		echo "Found revision control files in final archive." 1>&2; \
828
		exit 1; \
829
	fi
830
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
831
		echo "Found Python byte code in final archive." 1>&2; \
832
		exit 1; \
833
	fi
834
	if find $(top_distdir) -name '*~' | grep .; then \
835
		echo "Found backup files in final archive." 1>&2; \
836
		exit 1; \
837
	fi
838
# Empty files or directories should not be distributed. They can cause
839
# unnecessary warnings for packagers. Directories used by automake during
840
# distcheck must be excluded.
841
	if find $(top_distdir) -empty -and -not \( \
842
			-path $(top_distdir)/_build -or \
843
			-path $(top_distdir)/_inst \) | grep .; then \
844
		echo "Found empty files or directories in final archive." 1>&2; \
845
		exit 1; \
846
	fi
847
	if test -n "$(BUILD_RELEASE)" && \
848
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
849
		echo "Found unreleased version in NEWS." >&2; \
850
		exit 1; \
851
	fi
852

    
853
# When building a release, stricter checks should be used
854
distcheck-release dist-release: export BUILD_RELEASE = 1
855
distcheck-release: distcheck
856

    
857
dist-release: dist
858
	set -e; \
859
	for i in $(DIST_ARCHIVES); do \
860
		echo -n "Checking $$i ... "; \
861
		autotools/check-tar < $$i; \
862
		echo OK; \
863
	done
864

    
865
install-exec-local:
866
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
867
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
868
	  "$(DESTDIR)${localstatedir}/run/ganeti"
869

    
870
# To avoid conflicts between directory names and other targets, a file inside
871
# the directory is used to ensure its existence.
872
%.dir:
873
	@mkdir_p@ $* && touch $@
874

    
875
.PHONY: apidoc
876
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
877
	$(RUN_IN_TEMPDIR) epydoc -v \
878
		--conf $(CURDIR)/epydoc.conf \
879
		--output $(CURDIR)/doc/api
880

    
881
.PHONY: TAGS
882
TAGS: $(BUILT_SOURCES)
883
	rm -f TAGS
884
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
885
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
886
	  -path './qa/*.py' | \
887
	  etags -l python -
888

    
889
.PHONY: coverage
890
coverage: $(BUILT_SOURCES) $(python_tests)
891
	set -e; \
892
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
893
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
894
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
895
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
896
	$(python_tests)
897

    
898
commit-check: distcheck lint apidoc
899

    
900
-include ./Makefile.local
901

    
902
# vim: set noet :