Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 02266fe0

History | View | Annotate | Download (19.7 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_backup.py \
143
	lib/client/gnt_cluster.py \
144
	lib/client/gnt_debug.py \
145
	lib/client/gnt_instance.py \
146
	lib/client/gnt_job.py \
147
	lib/client/gnt_node.py \
148
	lib/client/gnt_os.py
149

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

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

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

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

    
179
masterd_PYTHON = \
180
	lib/masterd/__init__.py \
181
	lib/masterd/instance.py
182

    
183
impexpd_PYTHON = \
184
	lib/impexpd/__init__.py
185

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

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

    
218
doc/html: doc/html/.stamp
219

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

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

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

    
241
docpng = $(patsubst %.dot,%.png,$(docdot))
242

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

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

    
264
PYTHON_BOOTSTRAP = \
265
	scripts/gnt-backup \
266
	scripts/gnt-cluster \
267
	scripts/gnt-debug \
268
	scripts/gnt-instance \
269
	scripts/gnt-job \
270
	scripts/gnt-node \
271
	scripts/gnt-os
272

    
273
dist_sbin_SCRIPTS = \
274
	daemons/ganeti-noded \
275
	daemons/ganeti-watcher \
276
	daemons/ganeti-masterd \
277
	daemons/ganeti-confd \
278
	daemons/ganeti-rapi
279

    
280
nodist_sbin_SCRIPTS = \
281
	$(PYTHON_BOOTSTRAP) \
282
	daemons/ganeti-cleaner
283

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

    
295
pkglib_python_scripts = \
296
	daemons/import-export \
297
	tools/check-cert-expired
298

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

    
304
EXTRA_DIST = \
305
	NEWS \
306
	pylintrc \
307
	autotools/build-bash-completion \
308
	autotools/check-python-code \
309
	autotools/check-man \
310
	autotools/docbook-wrapper \
311
	autotools/gen-coverage \
312
	autotools/testrunner \
313
	$(RUN_IN_TEMPDIR) \
314
	daemons/daemon-util.in \
315
	daemons/ensure-dirs.in \
316
	daemons/ganeti-cleaner.in \
317
	$(pkglib_python_scripts) \
318
	devel/upload.in \
319
	$(docdot) \
320
	$(docpng) \
321
	$(docrst) \
322
	doc/conf.py \
323
	doc/html \
324
	doc/examples/ganeti.initd.in \
325
	doc/examples/ganeti.cron.in \
326
	doc/examples/gnt-config-backup.in \
327
	doc/examples/dumb-allocator \
328
	doc/examples/ganeti.default \
329
	doc/examples/ganeti.default-debug \
330
	doc/examples/hooks/ethers \
331
	doc/examples/hooks/ipsec.in \
332
	doc/examples/gnt-debug/README \
333
	doc/examples/gnt-debug/delay0.json \
334
	doc/examples/gnt-debug/delay50.json \
335
	test/testutils.py \
336
	test/mocks.py \
337
	$(dist_TESTS) \
338
	$(TEST_FILES) \
339
	man/footer.sgml \
340
	$(mansgml) \
341
	$(maninput) \
342
	qa/ganeti-qa.py \
343
	qa/qa-sample.json \
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
man_MANS = \
357
	man/ganeti.7 \
358
	man/ganeti-cleaner.8 \
359
	man/ganeti-confd.8 \
360
	man/ganeti-masterd.8 \
361
	man/ganeti-noded.8 \
362
	man/ganeti-os-interface.7 \
363
	man/ganeti-rapi.8 \
364
	man/ganeti-watcher.8 \
365
	man/gnt-backup.8 \
366
	man/gnt-cluster.8 \
367
	man/gnt-debug.8 \
368
	man/gnt-instance.8 \
369
	man/gnt-job.8 \
370
	man/gnt-node.8 \
371
	man/gnt-os.8
372

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

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

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

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

    
438
nodist_TESTS =
439

    
440
TESTS = $(dist_TESTS) $(nodist_TESTS)
441

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

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

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

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

    
473
check_python_code = \
474
	$(BUILD_BASH_COMPLETION) \
475
	$(all_python_code)
476

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

    
485
test/daemon-util_unittest.bash: daemons/daemon-util
486

    
487
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
488

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
694
check-local: check-dirs
695
	$(CHECK_PYTHON_CODE) $(check_python_code)
696

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

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

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

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

    
729
stamp-directories: Makefile
730
	@mkdir_p@ $(DIRS)
731
	touch $@
732

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

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

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

    
758
commit-check: distcheck lint apidoc
759

    
760
-include ./Makefile.local
761

    
762
# vim: set noet :