Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 66d1f035

History | View | Annotate | Download (24.6 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
REPLACE_VARS_SED = autotools/replace_vars.sed
23

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

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

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

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

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

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

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

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

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

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

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

    
124
nodist_pkgpython_PYTHON = \
125
	lib/_autoconf.py
126

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
283
doc/html: doc/html/index.html
284

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

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

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

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

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

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

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

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

    
356
dist_sbin_SCRIPTS = \
357
	tools/ganeti-listrunner
358

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

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

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

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

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

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

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

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

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

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

    
537
nodist_TESTS =
538

    
539
TESTS = $(dist_TESTS) $(nodist_TESTS)
540

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

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

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

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

    
576
check_python_code = \
577
	$(BUILD_BASH_COMPLETION) \
578
	$(all_python_code)
579

    
580
lint_python_code = \
581
	ganeti \
582
	ganeti/http/server.py \
583
	$(dist_sbin_SCRIPTS) \
584
	$(dist_tools_SCRIPTS) \
585
	$(pkglib_python_scripts) \
586
	$(BUILD_BASH_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/%.png: doc/%.dot
616
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
617
	$(DOT) -Tpng -o $@ $<
618

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

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

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

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

    
644
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
645
	sed -f $(REPLACE_VARS_SED) < $< > $@
646

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

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

    
653
epydoc.conf: epydoc.conf.in Makefile
654
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
655

    
656
vcs-version:
657
	if test -d .git; then \
658
	  git describe > $@; \
659
	elif test ! -f $@ ; then \
660
	  echo "Cannot auto-generate $@ file"; exit 1; \
661
	fi
662

    
663
.PHONY: regen-vcs-version
664
regen-vcs-version:
665
	set -e; \
666
	cd $(srcdir); \
667
	if test -d .git; then \
668
	  rm -f vcs-version; \
669
	  $(MAKE) vcs-version; \
670
	fi
671

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

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

    
757
# Using deferred evaluation
758
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
759
daemons/ganeti-watcher: MODULE = ganeti.watcher
760
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
761

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

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

    
798
.PHONY: ganeti
799
ganeti:
800
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
801

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

    
825
check-local: check-dirs
826
	$(CHECK_PYTHON_CODE) $(check_python_code)
827
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
828
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
829

    
830
.PHONY: lint
831
lint: $(BUILT_SOURCES)
832
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
833
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
834
	cd $(top_srcdir)/qa && \
835
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
836
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
837

    
838
# a dist hook rule for updating the vcs-version file; this is
839
# hardcoded due to where it needs to build the file...
840
dist-hook:
841
	$(MAKE) regen-vcs-version && \
842
	rm -f $(top_distdir)/vcs-version && \
843
	cp -p $(srcdir)/vcs-version $(top_distdir)
844

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

    
874
# When building a release, stricter checks should be used
875
distcheck-release dist-release: export BUILD_RELEASE = 1
876
distcheck-release: distcheck
877

    
878
dist-release: dist
879
	set -e; \
880
	for i in $(DIST_ARCHIVES); do \
881
		echo -n "Checking $$i ... "; \
882
		autotools/check-tar < $$i; \
883
		echo OK; \
884
	done
885

    
886
install-exec-local:
887
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
888
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
889
	  "$(DESTDIR)${localstatedir}/run/ganeti"
890

    
891
# To avoid conflicts between directory names and other targets, a file inside
892
# the directory is used to ensure its existence.
893
%.dir:
894
	@mkdir_p@ $* && touch $@
895

    
896
.PHONY: apidoc
897
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
898
	$(RUN_IN_TEMPDIR) epydoc -v \
899
		--conf $(CURDIR)/epydoc.conf \
900
		--output $(CURDIR)/doc/api
901

    
902
.PHONY: TAGS
903
TAGS: $(BUILT_SOURCES)
904
	rm -f TAGS
905
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
906
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
907
	  -path './qa/*.py' | \
908
	  etags -l python -
909

    
910
.PHONY: coverage
911
coverage: $(BUILT_SOURCES) $(python_tests)
912
	set -e; \
913
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
914
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
915
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
916
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
917
	$(python_tests)
918

    
919
commit-check: distcheck lint apidoc
920

    
921
-include ./Makefile.local
922

    
923
# vim: set noet :