Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ a09b9e3d

History | View | Annotate | Download (19.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
ACLOCAL_AMFLAGS = -I autotools
13
DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
14
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
15
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
16
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
17
CHECK_MAN = $(top_srcdir)/autotools/check-man
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
impexpddir = $(pkgpythondir)/impexpd
27
toolsdir = $(pkglibdir)/tools
28
docdir = $(datadir)/doc/$(PACKAGE)
29

    
30
# Delete output file if an error occurred while building it
31
.DELETE_ON_ERROR:
32

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

    
57
BUILDTIME_DIRS = \
58
	doc/api \
59
	doc/coverage \
60
	doc/html
61

    
62
DIRCHECK_EXCLUDE = \
63
	$(BUILDTIME_DIRS) \
64
	ganeti-[0-9]*.[0-9]*.[0-9]* \
65
	doc/html/_*
66

    
67
MAINTAINERCLEANFILES = \
68
	$(docpng) \
69
	$(maninput) \
70
	doc/install-quick.rst \
71
	doc/news.rst \
72
	vcs-version
73

    
74
maintainer-clean-local:
75
	rm -rf $(BUILDTIME_DIRS)
76

    
77
CLEANFILES = \
78
	$(addsuffix /*.py[co],$(DIRS)) \
79
	$(PYTHON_BOOTSTRAP) \
80
	autotools/replace_vars.sed \
81
	daemons/daemon-util \
82
	daemons/ensure-dirs \
83
	daemons/ganeti-cleaner \
84
	devel/upload \
85
	doc/examples/bash_completion \
86
	doc/examples/ganeti.initd \
87
	doc/examples/ganeti.cron \
88
	doc/examples/gnt-config-backup \
89
	doc/examples/hooks/ipsec \
90
	$(man_MANS) \
91
	$(manhtml) \
92
	stamp-directories \
93
	stamp-srclinks \
94
	$(nodist_pkgpython_PYTHON)
95

    
96
BUILT_SOURCES = \
97
	ganeti \
98
	stamp-srclinks \
99
	stamp-directories \
100
	lib/_autoconf.py
101

    
102
nodist_pkgpython_PYTHON = \
103
	lib/_autoconf.py
104

    
105
noinst_PYTHON = \
106
	lib/build/__init__.py
107

    
108
pkgpython_PYTHON = \
109
	lib/__init__.py \
110
	lib/asyncnotifier.py \
111
	lib/backend.py \
112
	lib/bdev.py \
113
	lib/bootstrap.py \
114
	lib/cli.py \
115
	lib/cmdlib.py \
116
	lib/compat.py \
117
	lib/config.py \
118
	lib/constants.py \
119
	lib/daemon.py \
120
	lib/errors.py \
121
	lib/ht.py \
122
	lib/jqueue.py \
123
	lib/jstore.py \
124
	lib/locking.py \
125
	lib/luxi.py \
126
	lib/mcpu.py \
127
	lib/netutils.py \
128
	lib/objects.py \
129
	lib/opcodes.py \
130
	lib/rpc.py \
131
	lib/runtime.py \
132
	lib/serializer.py \
133
	lib/ssconf.py \
134
	lib/ssh.py \
135
	lib/storage.py \
136
	lib/utils.py \
137
	lib/uidpool.py \
138
	lib/workerpool.py
139

    
140
client_PYTHON = \
141
	lib/client/__init__.py \
142
	lib/client/gnt_cluster.py \
143
	lib/client/gnt_debug.py \
144
	lib/client/gnt_job.py \
145
	lib/client/gnt_node.py \
146
	lib/client/gnt_os.py
147

    
148
hypervisor_PYTHON = \
149
	lib/hypervisor/__init__.py \
150
	lib/hypervisor/hv_base.py \
151
	lib/hypervisor/hv_chroot.py \
152
	lib/hypervisor/hv_fake.py \
153
	lib/hypervisor/hv_kvm.py \
154
	lib/hypervisor/hv_lxc.py \
155
	lib/hypervisor/hv_xen.py
156

    
157
rapi_PYTHON = \
158
	lib/rapi/__init__.py \
159
	lib/rapi/baserlib.py \
160
	lib/rapi/client.py \
161
	lib/rapi/client_utils.py \
162
	lib/rapi/connector.py \
163
	lib/rapi/rlib2.py
164

    
165
http_PYTHON = \
166
	lib/http/__init__.py \
167
	lib/http/auth.py \
168
	lib/http/client.py \
169
	lib/http/server.py
170

    
171
confd_PYTHON = \
172
	lib/confd/__init__.py \
173
	lib/confd/client.py \
174
	lib/confd/querylib.py \
175
	lib/confd/server.py
176

    
177
masterd_PYTHON = \
178
	lib/masterd/__init__.py \
179
	lib/masterd/instance.py
180

    
181
impexpd_PYTHON = \
182
	lib/impexpd/__init__.py
183

    
184
docrst = \
185
	doc/admin.rst \
186
	doc/design-2.0.rst \
187
	doc/design-2.1.rst \
188
	doc/design-2.2.rst \
189
	doc/design-2.3.rst \
190
	doc/cluster-merge.rst \
191
	doc/devnotes.rst \
192
	doc/glossary.rst \
193
	doc/hooks.rst \
194
	doc/iallocator.rst \
195
	doc/index.rst \
196
	doc/install-quick.rst \
197
	doc/install.rst \
198
	doc/locking.rst \
199
	doc/move-instance.rst \
200
	doc/news.rst \
201
	doc/rapi.rst \
202
	doc/security.rst \
203
	doc/walkthrough.rst
204

    
205
doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
206
	@test -n "$(SPHINX)" || \
207
	    { echo 'sphinx-build' not found during configure; exit 1; }
208
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
209
	    -d . \
210
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
211
	    -D release="$(PACKAGE_VERSION)" \
212
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
213
	rm -f doc/html/.buildinfo doc/html/objects.inv
214
	touch $@
215

    
216
doc/html: doc/html/.stamp
217

    
218
doc/news.rst: NEWS
219
	set -e; \
220
	{ echo '.. This file is automatically updated at build time from $<.'; \
221
	  echo '.. Do not edit.'; \
222
	  echo; \
223
	  cat $<; \
224
	} > $@
225

    
226
doc/install-quick.rst: INSTALL
227
	set -e; \
228
	{ echo '.. This file is automatically updated at build time from $<.'; \
229
	  echo '.. Do not edit.'; \
230
	  echo; \
231
	  cat $<; \
232
	} > $@
233

    
234
docdot = \
235
	doc/arch-2.0.dot \
236
	doc/design-2.1-lock-acquire.dot \
237
	doc/design-2.1-lock-release.dot
238

    
239
docpng = $(patsubst %.dot,%.png,$(docdot))
240

    
241
# Things to build but not to install (add it to EXTRA_DIST if it should be
242
# distributed)
243
noinst_DATA = \
244
	devel/upload \
245
	doc/html \
246
	doc/examples/bash_completion \
247
	doc/examples/ganeti.cron \
248
	doc/examples/ganeti.initd \
249
	doc/examples/gnt-config-backup \
250
	doc/examples/hooks/ipsec \
251
	$(manhtml)
252

    
253
gnt_scripts = \
254
	scripts/gnt-backup \
255
	scripts/gnt-cluster \
256
	scripts/gnt-debug \
257
	scripts/gnt-instance \
258
	scripts/gnt-job \
259
	scripts/gnt-node \
260
	scripts/gnt-os
261

    
262
PYTHON_BOOTSTRAP = \
263
	scripts/gnt-cluster \
264
	scripts/gnt-debug \
265
	scripts/gnt-job \
266
	scripts/gnt-node \
267
	scripts/gnt-os
268

    
269
dist_sbin_SCRIPTS = \
270
	daemons/ganeti-noded \
271
	daemons/ganeti-watcher \
272
	daemons/ganeti-masterd \
273
	daemons/ganeti-confd \
274
	daemons/ganeti-rapi \
275
	scripts/gnt-backup \
276
	scripts/gnt-instance
277

    
278
nodist_sbin_SCRIPTS = \
279
	$(PYTHON_BOOTSTRAP) \
280
	daemons/ganeti-cleaner
281

    
282
dist_tools_SCRIPTS = \
283
	tools/burnin \
284
	tools/cfgshell \
285
	tools/cfgupgrade \
286
	tools/cfgupgrade12 \
287
	tools/cluster-merge \
288
	tools/lvmstrap \
289
	tools/move-instance \
290
	tools/setup-ssh \
291
	tools/sanitize-config
292

    
293
pkglib_python_scripts = \
294
	daemons/import-export \
295
	tools/check-cert-expired
296

    
297
pkglib_SCRIPTS = \
298
	daemons/daemon-util \
299
	daemons/ensure-dirs \
300
	$(pkglib_python_scripts)
301

    
302
EXTRA_DIST = \
303
	NEWS \
304
	pylintrc \
305
	autotools/build-bash-completion \
306
	autotools/check-python-code \
307
	autotools/check-man \
308
	autotools/docbook-wrapper \
309
	autotools/gen-coverage \
310
	autotools/testrunner \
311
	$(RUN_IN_TEMPDIR) \
312
	daemons/daemon-util.in \
313
	daemons/ensure-dirs.in \
314
	daemons/ganeti-cleaner.in \
315
	$(pkglib_python_scripts) \
316
	devel/upload.in \
317
	$(docdot) \
318
	$(docpng) \
319
	$(docrst) \
320
	doc/conf.py \
321
	doc/html \
322
	doc/examples/ganeti.initd.in \
323
	doc/examples/ganeti.cron.in \
324
	doc/examples/gnt-config-backup.in \
325
	doc/examples/dumb-allocator \
326
	doc/examples/ganeti.default \
327
	doc/examples/ganeti.default-debug \
328
	doc/examples/hooks/ethers \
329
	doc/examples/hooks/ipsec.in \
330
	doc/examples/gnt-debug/README \
331
	doc/examples/gnt-debug/delay0.json \
332
	doc/examples/gnt-debug/delay50.json \
333
	test/testutils.py \
334
	test/mocks.py \
335
	$(dist_TESTS) \
336
	$(TEST_FILES) \
337
	man/footer.sgml \
338
	$(mansgml) \
339
	$(maninput) \
340
	qa/ganeti-qa.py \
341
	qa/qa-sample.json \
342
	qa/qa_cluster.py \
343
	qa/qa_config.py \
344
	qa/qa_daemon.py \
345
	qa/qa_env.py \
346
	qa/qa_error.py \
347
	qa/qa_instance.py \
348
	qa/qa_node.py \
349
	qa/qa_os.py \
350
	qa/qa_rapi.py \
351
	qa/qa_tags.py \
352
	qa/qa_utils.py
353

    
354
man_MANS = \
355
	man/ganeti.7 \
356
	man/ganeti-cleaner.8 \
357
	man/ganeti-confd.8 \
358
	man/ganeti-masterd.8 \
359
	man/ganeti-noded.8 \
360
	man/ganeti-os-interface.7 \
361
	man/ganeti-rapi.8 \
362
	man/ganeti-watcher.8 \
363
	man/gnt-backup.8 \
364
	man/gnt-cluster.8 \
365
	man/gnt-debug.8 \
366
	man/gnt-instance.8 \
367
	man/gnt-job.8 \
368
	man/gnt-node.8 \
369
	man/gnt-os.8
370

    
371
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
372
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
373
maninput = \
374
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
375
	$(patsubst %.html,%.html.in,$(manhtml))
376

    
377
TEST_FILES = \
378
	test/data/bdev-drbd-8.0.txt \
379
	test/data/bdev-drbd-8.3.txt \
380
	test/data/bdev-drbd-disk.txt \
381
	test/data/bdev-drbd-net-ip4.txt \
382
	test/data/bdev-drbd-net-ip6.txt \
383
	test/data/cert1.pem \
384
	test/data/proc_drbd8.txt \
385
	test/data/proc_drbd80-emptyline.txt \
386
	test/data/proc_drbd83.txt \
387
	test/data/sys_drbd_usermode_helper.txt \
388
	test/import-export_unittest-helper
389

    
390
python_tests = \
391
	test/ganeti.asyncnotifier_unittest.py \
392
	test/ganeti.backend_unittest.py \
393
	test/ganeti.bdev_unittest.py \
394
	test/ganeti.cli_unittest.py \
395
	test/ganeti.daemon_unittest.py \
396
	test/ganeti.cmdlib_unittest.py \
397
	test/ganeti.compat_unittest.py \
398
	test/ganeti.confd.client_unittest.py \
399
	test/ganeti.config_unittest.py \
400
	test/ganeti.constants_unittest.py \
401
	test/ganeti.errors_unittest.py \
402
	test/ganeti.hooks_unittest.py \
403
	test/ganeti.http_unittest.py \
404
	test/ganeti.hypervisor.hv_kvm_unittest.py \
405
	test/ganeti.impexpd_unittest.py \
406
	test/ganeti.jqueue_unittest.py \
407
	test/ganeti.locking_unittest.py \
408
	test/ganeti.luxi_unittest.py \
409
	test/ganeti.masterd.instance_unittest.py \
410
	test/ganeti.mcpu_unittest.py \
411
	test/ganeti.netutils_unittest.py \
412
	test/ganeti.objects_unittest.py \
413
	test/ganeti.opcodes_unittest.py \
414
	test/ganeti.rapi.client_unittest.py \
415
	test/ganeti.rapi.resources_unittest.py \
416
	test/ganeti.rapi.rlib2_unittest.py \
417
	test/ganeti.rpc_unittest.py \
418
	test/ganeti.runtime_unittest.py \
419
	test/ganeti.serializer_unittest.py \
420
	test/ganeti.ssh_unittest.py \
421
	test/ganeti.uidpool_unittest.py \
422
	test/ganeti.utils_unittest.py \
423
	test/ganeti.utils_mlockall_unittest.py \
424
	test/ganeti.workerpool_unittest.py \
425
	test/cfgupgrade_unittest.py \
426
	test/docs_unittest.py \
427
	test/tempfile_fork_unittest.py
428

    
429
dist_TESTS = \
430
	test/check-cert-expired_unittest.bash \
431
	test/daemon-util_unittest.bash \
432
	test/ganeti-cleaner_unittest.bash \
433
	test/import-export_unittest.bash \
434
	$(python_tests)
435

    
436
nodist_TESTS =
437

    
438
TESTS = $(dist_TESTS) $(nodist_TESTS)
439

    
440
# Environment for all tests
441
PLAIN_TESTS_ENVIRONMENT = \
442
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
443

    
444
# Environment for tests run by automake
445
TESTS_ENVIRONMENT = \
446
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
447

    
448
all_python_code = \
449
	$(dist_sbin_SCRIPTS) \
450
	$(dist_tools_SCRIPTS) \
451
	$(pkglib_python_scripts) \
452
	$(python_tests) \
453
	$(pkgpython_PYTHON) \
454
	$(client_PYTHON) \
455
	$(hypervisor_PYTHON) \
456
	$(rapi_PYTHON) \
457
	$(http_PYTHON) \
458
	$(confd_PYTHON) \
459
	$(masterd_PYTHON) \
460
	$(impexpd_PYTHON) \
461
	$(noinst_PYTHON)
462

    
463
srclink_files = \
464
	man/footer.sgml \
465
	test/check-cert-expired_unittest.bash \
466
	test/daemon-util_unittest.bash \
467
	test/ganeti-cleaner_unittest.bash \
468
	test/import-export_unittest.bash \
469
	$(all_python_code)
470

    
471
check_python_code = \
472
	$(BUILD_BASH_COMPLETION) \
473
	$(all_python_code)
474

    
475
lint_python_code = \
476
	ganeti \
477
	ganeti/http/server.py \
478
	$(dist_sbin_SCRIPTS) \
479
	$(dist_tools_SCRIPTS) \
480
	$(pkglib_python_scripts) \
481
	$(BUILD_BASH_COMPLETION)
482

    
483
test/daemon-util_unittest.bash: daemons/daemon-util
484

    
485
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
486

    
487
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
488
	sed -f $(REPLACE_VARS_SED) < $< > $@
489
	chmod u+x $@
490

    
491
daemons/%: daemons/%.in \
492
		$(REPLACE_VARS_SED)
493
	sed -f $(REPLACE_VARS_SED) < $< > $@
494
	chmod +x $@
495

    
496
doc/examples/%: doc/examples/%.in \
497
		$(REPLACE_VARS_SED)
498
	sed -f $(REPLACE_VARS_SED) < $< > $@
499

    
500
doc/examples/hooks/%: doc/examples/hooks/%.in \
501
		$(REPLACE_VARS_SED)
502
	sed -f $(REPLACE_VARS_SED) < $< > $@
503

    
504
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
505
	lib/cli.py $(gnt_scripts) tools/burnin
506
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
507

    
508
doc/%.png: doc/%.dot
509
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
510
	$(DOT) -Tpng -o $@ $<
511

    
512
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
513
	@test -n "$(DOCBOOK2MAN)" || \
514
	  { echo 'docbook2man' not found during configure; exit 1; }
515
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
516
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
517

    
518
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
519
	@test -n "$(DOCBOOK2HTML)" || \
520
	  { echo 'docbook2html' not found during configure; exit 1; }
521
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
522

    
523
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
524
	sed -f $(REPLACE_VARS_SED) < $< > $@
525

    
526
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
527
	sed -f $(REPLACE_VARS_SED) < $< > $@
528

    
529
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
530
	sed -f $(REPLACE_VARS_SED) < $< > $@
531

    
532
vcs-version:
533
	if test -d .git; then \
534
	  git describe > $@; \
535
	elif test ! -f $@ ; then \
536
	  echo "Cannot auto-generate $@ file"; exit 1; \
537
	fi
538

    
539
.PHONY: regen-vcs-version
540
regen-vcs-version:
541
	set -e; \
542
	cd $(srcdir); \
543
	if test -d .git; then \
544
	  rm -f vcs-version; \
545
	  $(MAKE) vcs-version; \
546
	fi
547

    
548
lib/_autoconf.py: Makefile stamp-directories vcs-version
549
	set -e; \
550
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
551
	{ echo '# This file is automatically generated, do not edit!'; \
552
	  echo '#'; \
553
	  echo ''; \
554
	  echo '"""Build-time configuration for Ganeti.'; \
555
	  echo '';\
556
	  echo 'This file is autogenerated by the build process.'; \
557
	  echo 'For any changes you need to re-run ./configure (and'; \
558
	  echo 'not edit by hand).'; \
559
	  echo ''; \
560
	  echo '"""'; \
561
	  echo ''; \
562
	  echo '# pylint: disable-msg=C0301,C0324'; \
563
	  echo '# because this is autogenerated, we do not want'; \
564
	  echo '# style warnings' ; \
565
	  echo ''; \
566
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
567
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
568
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
569
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
570
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
571
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
572
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
573
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
574
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
575
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
576
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
577
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
578
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
579
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
580
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
581
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
582
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
583
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
584
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
585
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
586
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
587
	  echo "TOOLSDIR = '$(toolsdir)'"; \
588
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
589
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
590
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
591
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
592
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
593
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
594
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
595
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
596
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
597
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
598
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
599
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
600
	  echo "NODED_USER = '$(NODED_USER)'"; \
601
	  echo "VCS_VERSION = '$$VCSVER'"; \
602
	} > $@
603

    
604
$(REPLACE_VARS_SED): Makefile
605
	set -e; \
606
	{ echo 's#@PREFIX@#$(prefix)#g'; \
607
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
608
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
609
	  echo 's#@BINDIR@#$(bindir)#g'; \
610
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
611
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
612
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
613
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
614
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
615
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
616
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
617
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
618
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
619
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
620
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
621
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
622
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
623
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
624
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
625
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
626
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
627
	} > $@
628

    
629
$(PYTHON_BOOTSTRAP): Makefile
630
	set -e; \
631
	module='$(subst -,_,$(notdir $@))'; \
632
	{ echo '#!/usr/bin/python'; \
633
	  echo '# This file is automatically generated, do not edit!'; \
634
	  echo "# Edit ganeti.client.$$module instead."; \
635
	  echo; \
636
	  echo '"""Bootstrap script for L{ganeti.client.'"$$module"'}"""'; \
637
	  echo; \
638
	  echo '# pylint: disable-msg=C0103'; \
639
	  echo '# C0103: Invalid name'; \
640
	  echo; \
641
	  echo 'import sys'; \
642
	  echo "from ganeti.client import $$module"; \
643
	  echo; \
644
	  echo '# Temporarily alias commands until bash completion'; \
645
	  echo '# generator is changed'; \
646
	  echo "if hasattr($$module, \"commands\"):"; \
647
	  echo "  commands = $$module.commands"; \
648
	  echo; \
649
	  echo 'if __name__ == "__main__":'; \
650
	  echo "  sys.exit($$module.Main())"; \
651
	} > $@
652
	chmod u+x $@
653

    
654
# We need to create symlinks because "make distcheck" will not install Python
655
# files when building.
656
stamp-srclinks: Makefile stamp-directories
657
	set -e; \
658
	for i in $(srclink_files); do \
659
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
660
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
661
		fi; \
662
	done
663
	touch $@
664

    
665
.PHONY: ganeti
666
ganeti:
667
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
668

    
669
.PHONY: check-dirs
670
check-dirs: $(BUILT_SOURCES)
671
	@set -e; \
672
	find . -type d \( \( -name . \) -o \( \
673
		-name .git -o \
674
		-name autom4te.cache \
675
		\) -prune -o -print \) | { \
676
		error=; \
677
		while read dir; do \
678
			case "$$dir" in \
679
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
680
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
681
			esac; \
682
		done; \
683
		for dir in $(DIRS); do \
684
			if ! test -d "$$dir"; then \
685
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
686
				error=1; \
687
			fi \
688
		done; \
689
		if test -n "$$error"; then exit 1; else exit 0; fi; \
690
	}
691

    
692
check-local: check-dirs
693
	$(CHECK_PYTHON_CODE) $(check_python_code)
694

    
695
.PHONY: lint
696
lint: ganeti $(BUILT_SOURCES)
697
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
698
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
699

    
700
# a dist hook rule for updating the vcs-version file; this is
701
# hardcoded due to where it needs to build the file...
702
dist-hook:
703
	$(MAKE) regen-vcs-version && \
704
	rm -f $(top_distdir)/vcs-version && \
705
	cp -p $(srcdir)/vcs-version $(top_distdir)
706

    
707
# a distcheck hook rule for catching revision control directories
708
distcheck-hook:
709
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
710
		echo "Found revision control files in final archive." 1>&2; \
711
		exit 1; \
712
	fi
713
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
714
		echo "Found Python byte code in final archive." 1>&2; \
715
		exit 1; \
716
	fi
717
	if find $(top_distdir) -name '*~' | grep .; then \
718
		echo "Found backup files in final archive." 1>&2; \
719
		exit 1; \
720
	fi
721

    
722
install-exec-local:
723
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
724
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
725
	  "$(DESTDIR)${localstatedir}/run/ganeti"
726

    
727
stamp-directories: Makefile
728
	@mkdir_p@ $(DIRS)
729
	touch $@
730

    
731
.PHONY: apidoc
732
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
733
	test -e doc/api || mkdir doc/api
734
	$(RUN_IN_TEMPDIR) epydoc -v \
735
		--conf $(CURDIR)/epydoc.conf \
736
		--output $(CURDIR)/doc/api
737

    
738
.PHONY: TAGS
739
TAGS: $(BUILT_SOURCES)
740
	rm -f TAGS
741
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
742
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
743
	  -path './qa/*.py' | \
744
	  etags -l python -
745

    
746
.PHONY: coverage
747
coverage: $(BUILT_SOURCES) $(python_tests)
748
	set -e; \
749
	mkdir -p doc/coverage; \
750
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
751
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
752
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
753
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
754
	$(python_tests)
755

    
756
commit-check: distcheck lint apidoc
757

    
758
-include ./Makefile.local
759

    
760
# vim: set noet :