Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ c95c0f71

History | View | Annotate | Download (24.1 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
CHECK_NEWS = $(top_srcdir)/autotools/check-news
19
REPLACE_VARS_SED = autotools/replace_vars.sed
20

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

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

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

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

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

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

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

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

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

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

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

    
121
nodist_pkgpython_PYTHON = \
122
	lib/_autoconf.py
123

    
124
noinst_PYTHON = \
125
	lib/build/__init__.py
126

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

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

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

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

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

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

    
200
masterd_PYTHON = \
201
	lib/masterd/__init__.py \
202
	lib/masterd/instance.py
203

    
204
impexpd_PYTHON = \
205
	lib/impexpd/__init__.py
206

    
207
watcher_PYTHON = \
208
	lib/watcher/__init__.py
209

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

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

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

    
258
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
259

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

    
273
doc/html: doc/html/index.html
274

    
275
doc/install-quick.rst: INSTALL
276
doc/news.rst: NEWS
277
doc/upgrade.rst: UPGRADE
278

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

    
287
docdot = \
288
	doc/arch-2.0.dot \
289
	doc/design-2.1-lock-acquire.dot \
290
	doc/design-2.1-lock-release.dot
291

    
292
docpng = $(patsubst %.dot,%.png,$(docdot))
293

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

    
307
gnt_scripts = \
308
	scripts/gnt-backup \
309
	scripts/gnt-cluster \
310
	scripts/gnt-debug \
311
	scripts/gnt-group \
312
	scripts/gnt-instance \
313
	scripts/gnt-job \
314
	scripts/gnt-node \
315
	scripts/gnt-os
316

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

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

    
346
dist_sbin_SCRIPTS = \
347
	tools/ganeti-listrunner
348

    
349
nodist_sbin_SCRIPTS = \
350
	$(PYTHON_BOOTSTRAP) \
351
	daemons/ganeti-cleaner
352

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

    
364
pkglib_python_scripts = \
365
	daemons/import-export \
366
	tools/check-cert-expired
367

    
368
pkglib_SCRIPTS = \
369
	daemons/daemon-util \
370
	daemons/ensure-dirs \
371
	tools/kvm-ifup \
372
	$(pkglib_python_scripts)
373

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

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

    
440
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
441
manhtml = $(patsubst %.rst,%.html,$(manrst))
442
maninput = \
443
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
444
	$(patsubst %.html,%.html.in,$(manhtml)) \
445
	man/footer.man man/footer.html
446

    
447
TEST_FILES = \
448
	test/data/bdev-drbd-8.0.txt \
449
	test/data/bdev-drbd-8.3.txt \
450
	test/data/bdev-drbd-disk.txt \
451
	test/data/bdev-drbd-net-ip4.txt \
452
	test/data/bdev-drbd-net-ip6.txt \
453
	test/data/cert1.pem \
454
	test/data/proc_drbd8.txt \
455
	test/data/proc_drbd80-emptyline.txt \
456
	test/data/proc_drbd83.txt \
457
	test/data/sys_drbd_usermode_helper.txt \
458
	test/import-export_unittest-helper
459

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

    
519
dist_TESTS = \
520
	test/check-cert-expired_unittest.bash \
521
	test/daemon-util_unittest.bash \
522
	test/ganeti-cleaner_unittest.bash \
523
	test/import-export_unittest.bash \
524
	$(python_tests)
525

    
526
nodist_TESTS =
527

    
528
TESTS = $(dist_TESTS) $(nodist_TESTS)
529

    
530
# Environment for all tests
531
PLAIN_TESTS_ENVIRONMENT = \
532
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
533

    
534
# Environment for tests run by automake
535
TESTS_ENVIRONMENT = \
536
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
537

    
538
all_python_code = \
539
	$(dist_sbin_SCRIPTS) \
540
	$(dist_tools_SCRIPTS) \
541
	$(pkglib_python_scripts) \
542
	$(python_tests) \
543
	$(pkgpython_PYTHON) \
544
	$(client_PYTHON) \
545
	$(hypervisor_PYTHON) \
546
	$(rapi_PYTHON) \
547
	$(server_PYTHON) \
548
	$(http_PYTHON) \
549
	$(confd_PYTHON) \
550
	$(masterd_PYTHON) \
551
	$(impexpd_PYTHON) \
552
	$(utils_PYTHON) \
553
	$(watcher_PYTHON) \
554
	$(noinst_PYTHON) \
555
	$(qa_scripts)
556

    
557
srclink_files = \
558
	man/footer.rst \
559
	test/check-cert-expired_unittest.bash \
560
	test/daemon-util_unittest.bash \
561
	test/ganeti-cleaner_unittest.bash \
562
	test/import-export_unittest.bash \
563
	$(all_python_code)
564

    
565
check_python_code = \
566
	$(BUILD_BASH_COMPLETION) \
567
	$(all_python_code)
568

    
569
lint_python_code = \
570
	ganeti \
571
	ganeti/http/server.py \
572
	$(dist_sbin_SCRIPTS) \
573
	$(dist_tools_SCRIPTS) \
574
	$(pkglib_python_scripts) \
575
	$(BUILD_BASH_COMPLETION) \
576
	$(PYTHON_BOOTSTRAP)
577

    
578
test/daemon-util_unittest.bash: daemons/daemon-util
579

    
580
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
581

    
582
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
583
	sed -f $(REPLACE_VARS_SED) < $< > $@
584
	chmod +x $@
585

    
586
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
587
	sed -f $(REPLACE_VARS_SED) < $< > $@
588
	chmod u+x $@
589

    
590
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
591
	sed -f $(REPLACE_VARS_SED) < $< > $@
592
	chmod +x $@
593

    
594
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
595
	sed -f $(REPLACE_VARS_SED) < $< > $@
596

    
597
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
598
	sed -f $(REPLACE_VARS_SED) < $< > $@
599

    
600
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
601
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
602
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
603

    
604
doc/%.png: doc/%.dot
605
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
606
	$(DOT) -Tpng -o $@ $<
607

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

    
613
man/footer.html: man/footer.rst
614
	@test -n "$(PANDOC)" || \
615
	  { echo 'pandoc' not found during configure; exit 1; }
616
	$(PANDOC) -f rst -t html -o $@ $<
617

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

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

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

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

    
637
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
638
	sed -f $(REPLACE_VARS_SED) < $< > $@
639

    
640
epydoc.conf: epydoc.conf.in
641
	sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@
642

    
643
vcs-version:
644
	if test -d .git; then \
645
	  git describe > $@; \
646
	elif test ! -f $@ ; then \
647
	  echo "Cannot auto-generate $@ file"; exit 1; \
648
	fi
649

    
650
.PHONY: regen-vcs-version
651
regen-vcs-version:
652
	set -e; \
653
	cd $(srcdir); \
654
	if test -d .git; then \
655
	  rm -f vcs-version; \
656
	  $(MAKE) vcs-version; \
657
	fi
658

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

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

    
744
# Using deferred evaluation
745
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
746
daemons/ganeti-watcher: MODULE = ganeti.watcher
747
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
748

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

    
774
# We need to create symlinks because "make distcheck" will not install Python
775
# files when building.
776
stamp-srclinks: Makefile | $(all_dirfiles)
777
	set -e; \
778
	for i in $(srclink_files); do \
779
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
780
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
781
		fi; \
782
	done
783
	touch $@
784

    
785
.PHONY: ganeti
786
ganeti:
787
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
788

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

    
812
check-local: check-dirs
813
	$(CHECK_PYTHON_CODE) $(check_python_code)
814
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
815
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
816

    
817
.PHONY: lint
818
lint: $(BUILT_SOURCES)
819
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
820
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
821
	cd $(top_srcdir)/qa && \
822
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
823
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
824

    
825
# a dist hook rule for updating the vcs-version file; this is
826
# hardcoded due to where it needs to build the file...
827
dist-hook:
828
	$(MAKE) regen-vcs-version && \
829
	rm -f $(top_distdir)/vcs-version && \
830
	cp -p $(srcdir)/vcs-version $(top_distdir)
831

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

    
861
# When building a release, stricter checks should be used
862
distcheck-release dist-release: export BUILD_RELEASE = 1
863
distcheck-release: distcheck
864

    
865
dist-release: dist
866
	set -e; \
867
	for i in $(DIST_ARCHIVES); do \
868
		echo -n "Checking $$i ... "; \
869
		autotools/check-tar < $$i; \
870
		echo OK; \
871
	done
872

    
873
install-exec-local:
874
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
875
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
876
	  "$(DESTDIR)${localstatedir}/run/ganeti"
877

    
878
# To avoid conflicts between directory names and other targets, a file inside
879
# the directory is used to ensure its existence.
880
%.dir:
881
	@mkdir_p@ $* && touch $@
882

    
883
.PHONY: apidoc
884
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
885
	$(RUN_IN_TEMPDIR) epydoc -v \
886
		--conf $(CURDIR)/epydoc.conf \
887
		--output $(CURDIR)/doc/api
888

    
889
.PHONY: TAGS
890
TAGS: $(BUILT_SOURCES)
891
	rm -f TAGS
892
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
893
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
894
	  -path './qa/*.py' | \
895
	  etags -l python -
896

    
897
.PHONY: coverage
898
coverage: $(BUILT_SOURCES) $(python_tests)
899
	set -e; \
900
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
901
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
902
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
903
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
904
	$(python_tests)
905

    
906
commit-check: distcheck lint apidoc
907

    
908
-include ./Makefile.local
909

    
910
# vim: set noet :