Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ f12e1736

History | View | Annotate | Download (18.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
hypervisordir = $(pkgpythondir)/hypervisor
21
httpdir = $(pkgpythondir)/http
22
masterddir = $(pkgpythondir)/masterd
23
confddir = $(pkgpythondir)/confd
24
rapidir = $(pkgpythondir)/rapi
25
impexpddir = $(pkgpythondir)/impexpd
26
toolsdir = $(pkglibdir)/tools
27
docdir = $(datadir)/doc/$(PACKAGE)
28

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

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

    
55
BUILDTIME_DIRS = \
56
	doc/api \
57
	doc/coverage \
58
	doc/html
59

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

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

    
72
maintainer-clean-local:
73
	rm -rf $(BUILDTIME_DIRS)
74

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

    
93
BUILT_SOURCES = \
94
	ganeti \
95
	stamp-srclinks \
96
	stamp-directories \
97
	lib/_autoconf.py
98

    
99
nodist_pkgpython_PYTHON = \
100
	lib/_autoconf.py
101

    
102
noinst_PYTHON = \
103
	lib/build/__init__.py
104

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

    
136
hypervisor_PYTHON = \
137
	lib/hypervisor/__init__.py \
138
	lib/hypervisor/hv_base.py \
139
	lib/hypervisor/hv_chroot.py \
140
	lib/hypervisor/hv_fake.py \
141
	lib/hypervisor/hv_kvm.py \
142
	lib/hypervisor/hv_lxc.py \
143
	lib/hypervisor/hv_xen.py
144

    
145
rapi_PYTHON = \
146
	lib/rapi/__init__.py \
147
	lib/rapi/baserlib.py \
148
	lib/rapi/client.py \
149
	lib/rapi/client_utils.py \
150
	lib/rapi/connector.py \
151
	lib/rapi/rlib2.py
152

    
153
http_PYTHON = \
154
	lib/http/__init__.py \
155
	lib/http/auth.py \
156
	lib/http/client.py \
157
	lib/http/server.py
158

    
159
confd_PYTHON = \
160
	lib/confd/__init__.py \
161
	lib/confd/client.py \
162
	lib/confd/querylib.py \
163
	lib/confd/server.py
164

    
165
masterd_PYTHON = \
166
	lib/masterd/__init__.py \
167
	lib/masterd/instance.py
168

    
169
impexpd_PYTHON = \
170
	lib/impexpd/__init__.py
171

    
172
docrst = \
173
	doc/admin.rst \
174
	doc/design-2.0.rst \
175
	doc/design-2.1.rst \
176
	doc/design-2.2.rst \
177
	doc/design-2.3.rst \
178
	doc/cluster-merge.rst \
179
	doc/devnotes.rst \
180
	doc/glossary.rst \
181
	doc/hooks.rst \
182
	doc/iallocator.rst \
183
	doc/index.rst \
184
	doc/install-quick.rst \
185
	doc/install.rst \
186
	doc/locking.rst \
187
	doc/move-instance.rst \
188
	doc/news.rst \
189
	doc/rapi.rst \
190
	doc/security.rst \
191
	doc/walkthrough.rst
192

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

    
204
doc/html: doc/html/.stamp
205

    
206
doc/news.rst: NEWS
207
	set -e; \
208
	{ echo '.. This file is automatically updated at build time from $<.'; \
209
	  echo '.. Do not edit.'; \
210
	  echo; \
211
	  cat $<; \
212
	} > $@
213

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

    
222
docdot = \
223
	doc/arch-2.0.dot \
224
	doc/design-2.1-lock-acquire.dot \
225
	doc/design-2.1-lock-release.dot
226

    
227
docpng = $(patsubst %.dot,%.png,$(docdot))
228

    
229
# Things to build but not to install (add it to EXTRA_DIST if it should be
230
# distributed)
231
noinst_DATA = \
232
	devel/upload \
233
	doc/html \
234
	doc/examples/bash_completion \
235
	doc/examples/ganeti.cron \
236
	doc/examples/ganeti.initd \
237
	doc/examples/gnt-config-backup \
238
	doc/examples/hooks/ipsec \
239
	$(manhtml)
240

    
241
gnt_scripts = \
242
	scripts/gnt-backup \
243
	scripts/gnt-cluster \
244
	scripts/gnt-debug \
245
	scripts/gnt-instance \
246
	scripts/gnt-job \
247
	scripts/gnt-node \
248
	scripts/gnt-os
249

    
250
dist_sbin_SCRIPTS = \
251
	daemons/ganeti-noded \
252
	daemons/ganeti-watcher \
253
	daemons/ganeti-masterd \
254
	daemons/ganeti-confd \
255
	daemons/ganeti-rapi \
256
	$(gnt_scripts)
257

    
258
nodist_sbin_SCRIPTS = \
259
	daemons/ganeti-cleaner
260

    
261
dist_tools_SCRIPTS = \
262
	tools/burnin \
263
	tools/cfgshell \
264
	tools/cfgupgrade \
265
	tools/cfgupgrade12 \
266
	tools/cluster-merge \
267
	tools/lvmstrap \
268
	tools/move-instance \
269
	tools/setup-ssh \
270
	tools/sanitize-config
271

    
272
pkglib_python_scripts = \
273
	daemons/import-export \
274
	tools/check-cert-expired
275

    
276
pkglib_SCRIPTS = \
277
	daemons/daemon-util \
278
	daemons/ensure-dirs \
279
	$(pkglib_python_scripts)
280

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

    
333
man_MANS = \
334
	man/ganeti.7 \
335
	man/ganeti-cleaner.8 \
336
	man/ganeti-confd.8 \
337
	man/ganeti-masterd.8 \
338
	man/ganeti-noded.8 \
339
	man/ganeti-os-interface.7 \
340
	man/ganeti-rapi.8 \
341
	man/ganeti-watcher.8 \
342
	man/gnt-backup.8 \
343
	man/gnt-cluster.8 \
344
	man/gnt-debug.8 \
345
	man/gnt-instance.8 \
346
	man/gnt-job.8 \
347
	man/gnt-node.8 \
348
	man/gnt-os.8
349

    
350
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
351
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
352
maninput = \
353
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
354
	$(patsubst %.html,%.html.in,$(manhtml))
355

    
356
TEST_FILES = \
357
	test/data/bdev-drbd-8.0.txt \
358
	test/data/bdev-drbd-8.3.txt \
359
	test/data/bdev-drbd-disk.txt \
360
	test/data/bdev-drbd-net-ip4.txt \
361
	test/data/bdev-drbd-net-ip6.txt \
362
	test/data/cert1.pem \
363
	test/data/proc_drbd8.txt \
364
	test/data/proc_drbd80-emptyline.txt \
365
	test/data/proc_drbd83.txt \
366
	test/data/sys_drbd_usermode_helper.txt \
367
	test/import-export_unittest-helper
368

    
369
python_tests = \
370
	test/ganeti.asyncnotifier_unittest.py \
371
	test/ganeti.backend_unittest.py \
372
	test/ganeti.bdev_unittest.py \
373
	test/ganeti.cli_unittest.py \
374
	test/ganeti.daemon_unittest.py \
375
	test/ganeti.cmdlib_unittest.py \
376
	test/ganeti.compat_unittest.py \
377
	test/ganeti.confd.client_unittest.py \
378
	test/ganeti.config_unittest.py \
379
	test/ganeti.constants_unittest.py \
380
	test/ganeti.errors_unittest.py \
381
	test/ganeti.hooks_unittest.py \
382
	test/ganeti.http_unittest.py \
383
	test/ganeti.hypervisor.hv_kvm_unittest.py \
384
	test/ganeti.impexpd_unittest.py \
385
	test/ganeti.jqueue_unittest.py \
386
	test/ganeti.locking_unittest.py \
387
	test/ganeti.luxi_unittest.py \
388
	test/ganeti.masterd.instance_unittest.py \
389
	test/ganeti.mcpu_unittest.py \
390
	test/ganeti.netutils_unittest.py \
391
	test/ganeti.objects_unittest.py \
392
	test/ganeti.opcodes_unittest.py \
393
	test/ganeti.rapi.client_unittest.py \
394
	test/ganeti.rapi.resources_unittest.py \
395
	test/ganeti.rapi.rlib2_unittest.py \
396
	test/ganeti.rpc_unittest.py \
397
	test/ganeti.runtime_unittest.py \
398
	test/ganeti.serializer_unittest.py \
399
	test/ganeti.ssh_unittest.py \
400
	test/ganeti.uidpool_unittest.py \
401
	test/ganeti.utils_unittest.py \
402
	test/ganeti.utils_mlockall_unittest.py \
403
	test/ganeti.workerpool_unittest.py \
404
	test/cfgupgrade_unittest.py \
405
	test/docs_unittest.py \
406
	test/tempfile_fork_unittest.py
407

    
408
dist_TESTS = \
409
	test/check-cert-expired_unittest.bash \
410
	test/daemon-util_unittest.bash \
411
	test/ganeti-cleaner_unittest.bash \
412
	test/import-export_unittest.bash \
413
	$(python_tests)
414

    
415
nodist_TESTS =
416

    
417
TESTS = $(dist_TESTS) $(nodist_TESTS)
418

    
419
# Environment for all tests
420
PLAIN_TESTS_ENVIRONMENT = \
421
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
422

    
423
# Environment for tests run by automake
424
TESTS_ENVIRONMENT = \
425
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
426

    
427
all_python_code = \
428
	$(dist_sbin_SCRIPTS) \
429
	$(dist_tools_SCRIPTS) \
430
	$(pkglib_python_scripts) \
431
	$(python_tests) \
432
	$(pkgpython_PYTHON) \
433
	$(hypervisor_PYTHON) \
434
	$(rapi_PYTHON) \
435
	$(http_PYTHON) \
436
	$(confd_PYTHON) \
437
	$(masterd_PYTHON) \
438
	$(impexpd_PYTHON) \
439
	$(noinst_PYTHON)
440

    
441
srclink_files = \
442
	man/footer.sgml \
443
	test/check-cert-expired_unittest.bash \
444
	test/daemon-util_unittest.bash \
445
	test/ganeti-cleaner_unittest.bash \
446
	test/import-export_unittest.bash \
447
	$(all_python_code)
448

    
449
check_python_code = \
450
	$(BUILD_BASH_COMPLETION) \
451
	$(all_python_code)
452

    
453
lint_python_code = \
454
	ganeti \
455
	$(dist_sbin_SCRIPTS) \
456
	$(dist_tools_SCRIPTS) \
457
	$(pkglib_python_scripts) \
458
	$(BUILD_BASH_COMPLETION)
459

    
460
test/daemon-util_unittest.bash: daemons/daemon-util
461

    
462
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
463

    
464
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
465
	sed -f $(REPLACE_VARS_SED) < $< > $@
466
	chmod u+x $@
467

    
468
daemons/%: daemons/%.in \
469
		$(REPLACE_VARS_SED)
470
	sed -f $(REPLACE_VARS_SED) < $< > $@
471
	chmod +x $@
472

    
473
doc/examples/%: doc/examples/%.in \
474
		$(REPLACE_VARS_SED)
475
	sed -f $(REPLACE_VARS_SED) < $< > $@
476

    
477
doc/examples/hooks/%: doc/examples/hooks/%.in \
478
		$(REPLACE_VARS_SED)
479
	sed -f $(REPLACE_VARS_SED) < $< > $@
480

    
481
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
482
	lib/cli.py $(gnt_scripts) tools/burnin
483
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
484

    
485
doc/%.png: doc/%.dot
486
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
487
	$(DOT) -Tpng -o $@ $<
488

    
489
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
490
	@test -n "$(DOCBOOK2MAN)" || \
491
	  { echo 'docbook2man' not found during configure; exit 1; }
492
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
493
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
494

    
495
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
496
	@test -n "$(DOCBOOK2HTML)" || \
497
	  { echo 'docbook2html' not found during configure; exit 1; }
498
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
499

    
500
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
501
	sed -f $(REPLACE_VARS_SED) < $< > $@
502

    
503
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
504
	sed -f $(REPLACE_VARS_SED) < $< > $@
505

    
506
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
507
	sed -f $(REPLACE_VARS_SED) < $< > $@
508

    
509
vcs-version:
510
	if test -d .git; then \
511
	  git describe > $@; \
512
	elif test ! -f $@ ; then \
513
	  echo "Cannot auto-generate $@ file"; exit 1; \
514
	fi
515

    
516
.PHONY: regen-vcs-version
517
regen-vcs-version:
518
	set -e; \
519
	cd $(srcdir); \
520
	if test -d .git; then \
521
	  rm -f vcs-version; \
522
	  $(MAKE) vcs-version; \
523
	fi
524

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

    
581
$(REPLACE_VARS_SED): Makefile
582
	set -e; \
583
	{ echo 's#@PREFIX@#$(prefix)#g'; \
584
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
585
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
586
	  echo 's#@BINDIR@#$(bindir)#g'; \
587
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
588
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
589
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
590
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
591
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
592
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
593
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
594
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
595
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
596
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
597
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
598
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
599
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
600
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
601
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
602
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
603
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
604
	} > $@
605

    
606
# We need to create symlinks because "make distcheck" will not install Python
607
# files when building.
608
stamp-srclinks: Makefile stamp-directories
609
	set -e; \
610
	for i in $(srclink_files); do \
611
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
612
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
613
		fi; \
614
	done
615
	touch $@
616

    
617
.PHONY: ganeti
618
ganeti:
619
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
620

    
621
.PHONY: check-dirs
622
check-dirs: $(BUILT_SOURCES)
623
	@set -e; \
624
	find . -type d \( \( -name . \) -o \( \
625
		-name .git -o \
626
		-name autom4te.cache \
627
		\) -prune -o -print \) | { \
628
		error=; \
629
		while read dir; do \
630
			case "$$dir" in \
631
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
632
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
633
			esac; \
634
		done; \
635
		for dir in $(DIRS); do \
636
			if ! test -d "$$dir"; then \
637
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
638
				error=1; \
639
			fi \
640
		done; \
641
		if test -n "$$error"; then exit 1; else exit 0; fi; \
642
	}
643

    
644
check-local: check-dirs
645
	$(CHECK_PYTHON_CODE) $(check_python_code)
646

    
647
.PHONY: lint
648
lint: ganeti $(BUILT_SOURCES)
649
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
650
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
651

    
652
# a dist hook rule for updating the vcs-version file; this is
653
# hardcoded due to where it needs to build the file...
654
dist-hook:
655
	$(MAKE) regen-vcs-version && \
656
	rm -f $(top_distdir)/vcs-version && \
657
	cp -p $(srcdir)/vcs-version $(top_distdir)
658

    
659
# a distcheck hook rule for catching revision control directories
660
distcheck-hook:
661
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
662
		echo "Found revision control files in final archive." 1>&2; \
663
		exit 1; \
664
	fi
665
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
666
		echo "Found Python byte code in final archive." 1>&2; \
667
		exit 1; \
668
	fi
669
	if find $(top_distdir) -name '*~' | grep .; then \
670
		echo "Found backup files in final archive." 1>&2; \
671
		exit 1; \
672
	fi
673

    
674
install-exec-local:
675
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
676
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
677
	  "$(DESTDIR)${localstatedir}/run/ganeti"
678

    
679
stamp-directories: Makefile
680
	@mkdir_p@ $(DIRS)
681
	touch $@
682

    
683
.PHONY: apidoc
684
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
685
	test -e doc/api || mkdir doc/api
686
	$(RUN_IN_TEMPDIR) epydoc -v \
687
		--conf $(CURDIR)/epydoc.conf \
688
		--output $(CURDIR)/doc/api
689

    
690
.PHONY: TAGS
691
TAGS: $(BUILT_SOURCES)
692
	rm -f TAGS
693
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
694
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
695
	  -path './qa/*.py' | \
696
	  etags -l python -
697

    
698
.PHONY: coverage
699
coverage: $(BUILT_SOURCES) $(python_tests)
700
	set -e; \
701
	mkdir -p doc/coverage; \
702
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
703
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
704
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
705
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
706
	$(python_tests)
707

    
708
commit-check: distcheck lint apidoc
709

    
710
-include ./Makefile.local
711

    
712
# vim: set noet :