Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 2d48a3a2

History | View | Annotate | Download (19.4 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

    
143
hypervisor_PYTHON = \
144
	lib/hypervisor/__init__.py \
145
	lib/hypervisor/hv_base.py \
146
	lib/hypervisor/hv_chroot.py \
147
	lib/hypervisor/hv_fake.py \
148
	lib/hypervisor/hv_kvm.py \
149
	lib/hypervisor/hv_lxc.py \
150
	lib/hypervisor/hv_xen.py
151

    
152
rapi_PYTHON = \
153
	lib/rapi/__init__.py \
154
	lib/rapi/baserlib.py \
155
	lib/rapi/client.py \
156
	lib/rapi/client_utils.py \
157
	lib/rapi/connector.py \
158
	lib/rapi/rlib2.py
159

    
160
http_PYTHON = \
161
	lib/http/__init__.py \
162
	lib/http/auth.py \
163
	lib/http/client.py \
164
	lib/http/server.py
165

    
166
confd_PYTHON = \
167
	lib/confd/__init__.py \
168
	lib/confd/client.py \
169
	lib/confd/querylib.py \
170
	lib/confd/server.py
171

    
172
masterd_PYTHON = \
173
	lib/masterd/__init__.py \
174
	lib/masterd/instance.py
175

    
176
impexpd_PYTHON = \
177
	lib/impexpd/__init__.py
178

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

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

    
211
doc/html: doc/html/.stamp
212

    
213
doc/news.rst: NEWS
214
	set -e; \
215
	{ echo '.. This file is automatically updated at build time from $<.'; \
216
	  echo '.. Do not edit.'; \
217
	  echo; \
218
	  cat $<; \
219
	} > $@
220

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

    
229
docdot = \
230
	doc/arch-2.0.dot \
231
	doc/design-2.1-lock-acquire.dot \
232
	doc/design-2.1-lock-release.dot
233

    
234
docpng = $(patsubst %.dot,%.png,$(docdot))
235

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

    
248
gnt_scripts = \
249
	scripts/gnt-backup \
250
	scripts/gnt-cluster \
251
	scripts/gnt-debug \
252
	scripts/gnt-instance \
253
	scripts/gnt-job \
254
	scripts/gnt-node \
255
	scripts/gnt-os
256

    
257
PYTHON_BOOTSTRAP =
258

    
259
dist_sbin_SCRIPTS = \
260
	daemons/ganeti-noded \
261
	daemons/ganeti-watcher \
262
	daemons/ganeti-masterd \
263
	daemons/ganeti-confd \
264
	daemons/ganeti-rapi \
265
	$(gnt_scripts)
266

    
267
nodist_sbin_SCRIPTS = \
268
	$(PYTHON_BOOTSTRAP) \
269
	daemons/ganeti-cleaner
270

    
271
dist_tools_SCRIPTS = \
272
	tools/burnin \
273
	tools/cfgshell \
274
	tools/cfgupgrade \
275
	tools/cfgupgrade12 \
276
	tools/cluster-merge \
277
	tools/lvmstrap \
278
	tools/move-instance \
279
	tools/setup-ssh \
280
	tools/sanitize-config
281

    
282
pkglib_python_scripts = \
283
	daemons/import-export \
284
	tools/check-cert-expired
285

    
286
pkglib_SCRIPTS = \
287
	daemons/daemon-util \
288
	daemons/ensure-dirs \
289
	$(pkglib_python_scripts)
290

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

    
343
man_MANS = \
344
	man/ganeti.7 \
345
	man/ganeti-cleaner.8 \
346
	man/ganeti-confd.8 \
347
	man/ganeti-masterd.8 \
348
	man/ganeti-noded.8 \
349
	man/ganeti-os-interface.7 \
350
	man/ganeti-rapi.8 \
351
	man/ganeti-watcher.8 \
352
	man/gnt-backup.8 \
353
	man/gnt-cluster.8 \
354
	man/gnt-debug.8 \
355
	man/gnt-instance.8 \
356
	man/gnt-job.8 \
357
	man/gnt-node.8 \
358
	man/gnt-os.8
359

    
360
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
361
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
362
maninput = \
363
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
364
	$(patsubst %.html,%.html.in,$(manhtml))
365

    
366
TEST_FILES = \
367
	test/data/bdev-drbd-8.0.txt \
368
	test/data/bdev-drbd-8.3.txt \
369
	test/data/bdev-drbd-disk.txt \
370
	test/data/bdev-drbd-net-ip4.txt \
371
	test/data/bdev-drbd-net-ip6.txt \
372
	test/data/cert1.pem \
373
	test/data/proc_drbd8.txt \
374
	test/data/proc_drbd80-emptyline.txt \
375
	test/data/proc_drbd83.txt \
376
	test/data/sys_drbd_usermode_helper.txt \
377
	test/import-export_unittest-helper
378

    
379
python_tests = \
380
	test/ganeti.asyncnotifier_unittest.py \
381
	test/ganeti.backend_unittest.py \
382
	test/ganeti.bdev_unittest.py \
383
	test/ganeti.cli_unittest.py \
384
	test/ganeti.daemon_unittest.py \
385
	test/ganeti.cmdlib_unittest.py \
386
	test/ganeti.compat_unittest.py \
387
	test/ganeti.confd.client_unittest.py \
388
	test/ganeti.config_unittest.py \
389
	test/ganeti.constants_unittest.py \
390
	test/ganeti.errors_unittest.py \
391
	test/ganeti.hooks_unittest.py \
392
	test/ganeti.http_unittest.py \
393
	test/ganeti.hypervisor.hv_kvm_unittest.py \
394
	test/ganeti.impexpd_unittest.py \
395
	test/ganeti.jqueue_unittest.py \
396
	test/ganeti.locking_unittest.py \
397
	test/ganeti.luxi_unittest.py \
398
	test/ganeti.masterd.instance_unittest.py \
399
	test/ganeti.mcpu_unittest.py \
400
	test/ganeti.netutils_unittest.py \
401
	test/ganeti.objects_unittest.py \
402
	test/ganeti.opcodes_unittest.py \
403
	test/ganeti.rapi.client_unittest.py \
404
	test/ganeti.rapi.resources_unittest.py \
405
	test/ganeti.rapi.rlib2_unittest.py \
406
	test/ganeti.rpc_unittest.py \
407
	test/ganeti.runtime_unittest.py \
408
	test/ganeti.serializer_unittest.py \
409
	test/ganeti.ssh_unittest.py \
410
	test/ganeti.uidpool_unittest.py \
411
	test/ganeti.utils_unittest.py \
412
	test/ganeti.utils_mlockall_unittest.py \
413
	test/ganeti.workerpool_unittest.py \
414
	test/cfgupgrade_unittest.py \
415
	test/docs_unittest.py \
416
	test/tempfile_fork_unittest.py
417

    
418
dist_TESTS = \
419
	test/check-cert-expired_unittest.bash \
420
	test/daemon-util_unittest.bash \
421
	test/ganeti-cleaner_unittest.bash \
422
	test/import-export_unittest.bash \
423
	$(python_tests)
424

    
425
nodist_TESTS =
426

    
427
TESTS = $(dist_TESTS) $(nodist_TESTS)
428

    
429
# Environment for all tests
430
PLAIN_TESTS_ENVIRONMENT = \
431
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
432

    
433
# Environment for tests run by automake
434
TESTS_ENVIRONMENT = \
435
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
436

    
437
all_python_code = \
438
	$(dist_sbin_SCRIPTS) \
439
	$(dist_tools_SCRIPTS) \
440
	$(pkglib_python_scripts) \
441
	$(python_tests) \
442
	$(pkgpython_PYTHON) \
443
	$(client_PYTHON) \
444
	$(hypervisor_PYTHON) \
445
	$(rapi_PYTHON) \
446
	$(http_PYTHON) \
447
	$(confd_PYTHON) \
448
	$(masterd_PYTHON) \
449
	$(impexpd_PYTHON) \
450
	$(noinst_PYTHON)
451

    
452
srclink_files = \
453
	man/footer.sgml \
454
	test/check-cert-expired_unittest.bash \
455
	test/daemon-util_unittest.bash \
456
	test/ganeti-cleaner_unittest.bash \
457
	test/import-export_unittest.bash \
458
	$(all_python_code)
459

    
460
check_python_code = \
461
	$(BUILD_BASH_COMPLETION) \
462
	$(all_python_code)
463

    
464
lint_python_code = \
465
	ganeti \
466
	ganeti/http/server.py \
467
	$(dist_sbin_SCRIPTS) \
468
	$(dist_tools_SCRIPTS) \
469
	$(pkglib_python_scripts) \
470
	$(BUILD_BASH_COMPLETION)
471

    
472
test/daemon-util_unittest.bash: daemons/daemon-util
473

    
474
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
475

    
476
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
477
	sed -f $(REPLACE_VARS_SED) < $< > $@
478
	chmod u+x $@
479

    
480
daemons/%: daemons/%.in \
481
		$(REPLACE_VARS_SED)
482
	sed -f $(REPLACE_VARS_SED) < $< > $@
483
	chmod +x $@
484

    
485
doc/examples/%: doc/examples/%.in \
486
		$(REPLACE_VARS_SED)
487
	sed -f $(REPLACE_VARS_SED) < $< > $@
488

    
489
doc/examples/hooks/%: doc/examples/hooks/%.in \
490
		$(REPLACE_VARS_SED)
491
	sed -f $(REPLACE_VARS_SED) < $< > $@
492

    
493
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
494
	lib/cli.py $(gnt_scripts) tools/burnin
495
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
496

    
497
doc/%.png: doc/%.dot
498
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
499
	$(DOT) -Tpng -o $@ $<
500

    
501
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
502
	@test -n "$(DOCBOOK2MAN)" || \
503
	  { echo 'docbook2man' not found during configure; exit 1; }
504
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
505
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
506

    
507
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
508
	@test -n "$(DOCBOOK2HTML)" || \
509
	  { echo 'docbook2html' not found during configure; exit 1; }
510
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
511

    
512
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
513
	sed -f $(REPLACE_VARS_SED) < $< > $@
514

    
515
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
516
	sed -f $(REPLACE_VARS_SED) < $< > $@
517

    
518
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
519
	sed -f $(REPLACE_VARS_SED) < $< > $@
520

    
521
vcs-version:
522
	if test -d .git; then \
523
	  git describe > $@; \
524
	elif test ! -f $@ ; then \
525
	  echo "Cannot auto-generate $@ file"; exit 1; \
526
	fi
527

    
528
.PHONY: regen-vcs-version
529
regen-vcs-version:
530
	set -e; \
531
	cd $(srcdir); \
532
	if test -d .git; then \
533
	  rm -f vcs-version; \
534
	  $(MAKE) vcs-version; \
535
	fi
536

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

    
593
$(REPLACE_VARS_SED): Makefile
594
	set -e; \
595
	{ echo 's#@PREFIX@#$(prefix)#g'; \
596
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
597
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
598
	  echo 's#@BINDIR@#$(bindir)#g'; \
599
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
600
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
601
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
602
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
603
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
604
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
605
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
606
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
607
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
608
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
609
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
610
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
611
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
612
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
613
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
614
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
615
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
616
	} > $@
617

    
618
$(PYTHON_BOOTSTRAP): Makefile
619
	set -e; \
620
	module='$(subst -,_,$(notdir $@))'; \
621
	{ echo "#!$(PYTHON)"; \
622
	  echo '# This file is automatically generated, do not edit!'; \
623
	  echo "# Edit ganeti.client.$$module instead."; \
624
	  echo; \
625
	  echo '"""Bootstrap script for L{ganeti.client.'"$$module"'}"""'; \
626
	  echo; \
627
	  echo '# pylint: disable-msg=C0103'; \
628
	  echo '# C0103: Invalid name'; \
629
	  echo; \
630
	  echo 'import sys'; \
631
	  echo "from ganeti.client import $$module"; \
632
	  echo; \
633
	  echo '# Temporarily alias commands until bash completion'; \
634
	  echo '# generator is changed'; \
635
	  echo "if hasattr($$module, \"commands\"):"; \
636
	  echo "  commands = $$module.commands"; \
637
	  echo; \
638
	  echo 'if __name__ == "__main__":'; \
639
	  echo "  sys.exit($$module.Main())"; \
640
	} > $@
641
	chmod u+x $@
642

    
643
# We need to create symlinks because "make distcheck" will not install Python
644
# files when building.
645
stamp-srclinks: Makefile stamp-directories
646
	set -e; \
647
	for i in $(srclink_files); do \
648
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
649
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
650
		fi; \
651
	done
652
	touch $@
653

    
654
.PHONY: ganeti
655
ganeti:
656
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
657

    
658
.PHONY: check-dirs
659
check-dirs: $(BUILT_SOURCES)
660
	@set -e; \
661
	find . -type d \( \( -name . \) -o \( \
662
		-name .git -o \
663
		-name autom4te.cache \
664
		\) -prune -o -print \) | { \
665
		error=; \
666
		while read dir; do \
667
			case "$$dir" in \
668
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
669
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
670
			esac; \
671
		done; \
672
		for dir in $(DIRS); do \
673
			if ! test -d "$$dir"; then \
674
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
675
				error=1; \
676
			fi \
677
		done; \
678
		if test -n "$$error"; then exit 1; else exit 0; fi; \
679
	}
680

    
681
check-local: check-dirs
682
	$(CHECK_PYTHON_CODE) $(check_python_code)
683

    
684
.PHONY: lint
685
lint: ganeti $(BUILT_SOURCES)
686
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
687
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
688

    
689
# a dist hook rule for updating the vcs-version file; this is
690
# hardcoded due to where it needs to build the file...
691
dist-hook:
692
	$(MAKE) regen-vcs-version && \
693
	rm -f $(top_distdir)/vcs-version && \
694
	cp -p $(srcdir)/vcs-version $(top_distdir)
695

    
696
# a distcheck hook rule for catching revision control directories
697
distcheck-hook:
698
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
699
		echo "Found revision control files in final archive." 1>&2; \
700
		exit 1; \
701
	fi
702
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
703
		echo "Found Python byte code in final archive." 1>&2; \
704
		exit 1; \
705
	fi
706
	if find $(top_distdir) -name '*~' | grep .; then \
707
		echo "Found backup files in final archive." 1>&2; \
708
		exit 1; \
709
	fi
710

    
711
install-exec-local:
712
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
713
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
714
	  "$(DESTDIR)${localstatedir}/run/ganeti"
715

    
716
stamp-directories: Makefile
717
	@mkdir_p@ $(DIRS)
718
	touch $@
719

    
720
.PHONY: apidoc
721
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
722
	test -e doc/api || mkdir doc/api
723
	$(RUN_IN_TEMPDIR) epydoc -v \
724
		--conf $(CURDIR)/epydoc.conf \
725
		--output $(CURDIR)/doc/api
726

    
727
.PHONY: TAGS
728
TAGS: $(BUILT_SOURCES)
729
	rm -f TAGS
730
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
731
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
732
	  -path './qa/*.py' | \
733
	  etags -l python -
734

    
735
.PHONY: coverage
736
coverage: $(BUILT_SOURCES) $(python_tests)
737
	set -e; \
738
	mkdir -p doc/coverage; \
739
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
740
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
741
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
742
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
743
	$(python_tests)
744

    
745
commit-check: distcheck lint apidoc
746

    
747
-include ./Makefile.local
748

    
749
# vim: set noet :