Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 5a672c30

History | View | Annotate | Download (17.1 kB)

1
# Ganeti makefile
2
# - Indent with tabs only.
3
# - Keep files sorted; one line per file.
4
# - Directories in lib/ must have their own *dir variable (see hypervisor).
5
# - All directories must be listed DIRS.
6
# - Use autogen.sh to generate Makefile.in and configure script.
7

    
8
# Automake doesn't export these variables before version 1.10.
9
abs_top_builddir = @abs_top_builddir@
10
abs_top_srcdir = @abs_top_srcdir@
11

    
12
ACLOCAL_AMFLAGS = -I autotools
13
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

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

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

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

    
98
nodist_pkgpython_PYTHON = \
99
	lib/_autoconf.py
100

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

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

    
133
hypervisor_PYTHON = \
134
	lib/hypervisor/__init__.py \
135
	lib/hypervisor/hv_base.py \
136
	lib/hypervisor/hv_chroot.py \
137
	lib/hypervisor/hv_fake.py \
138
	lib/hypervisor/hv_kvm.py \
139
	lib/hypervisor/hv_xen.py
140

    
141
rapi_PYTHON = \
142
	lib/rapi/__init__.py \
143
	lib/rapi/baserlib.py \
144
	lib/rapi/client.py \
145
	lib/rapi/client_utils.py \
146
	lib/rapi/connector.py \
147
	lib/rapi/rlib2.py
148

    
149
http_PYTHON = \
150
	lib/http/__init__.py \
151
	lib/http/auth.py \
152
	lib/http/client.py \
153
	lib/http/server.py
154

    
155
confd_PYTHON = \
156
	lib/confd/__init__.py \
157
	lib/confd/client.py \
158
	lib/confd/querylib.py \
159
	lib/confd/server.py
160

    
161
masterd_PYTHON = \
162
	lib/masterd/__init__.py \
163
	lib/masterd/instance.py
164

    
165
impexpd_PYTHON = \
166
	lib/impexpd/__init__.py
167

    
168
docrst = \
169
	doc/admin.rst \
170
	doc/design-2.0.rst \
171
	doc/design-2.1.rst \
172
	doc/design-2.2.rst \
173
	doc/design-cluster-merger.rst \
174
	doc/devnotes.rst \
175
	doc/glossary.rst \
176
	doc/hooks.rst \
177
	doc/iallocator.rst \
178
	doc/index.rst \
179
	doc/install-quick.rst \
180
	doc/install.rst \
181
	doc/locking.rst \
182
	doc/move-instance.rst \
183
	doc/news.rst \
184
	doc/rapi.rst \
185
	doc/security.rst \
186
	doc/walkthrough.rst
187

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

    
199
doc/html: doc/html/.stamp
200

    
201
doc/news.rst: NEWS
202
	set -e; \
203
	{ echo '.. This file is automatically updated at build time from $<.'; \
204
	  echo '.. Do not edit.'; \
205
	  echo; \
206
	  cat $<; \
207
	} > $@
208

    
209
doc/install-quick.rst: INSTALL
210
	set -e; \
211
	{ echo '.. This file is automatically updated at build time from $<.'; \
212
	  echo '.. Do not edit.'; \
213
	  echo; \
214
	  cat $<; \
215
	} > $@
216

    
217
docdot = \
218
	doc/arch-2.0.dot \
219
	doc/design-2.1-lock-acquire.dot \
220
	doc/design-2.1-lock-release.dot
221

    
222
docpng = $(patsubst %.dot,%.png,$(docdot))
223

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

    
236
gnt_scripts = \
237
	scripts/gnt-backup \
238
	scripts/gnt-cluster \
239
	scripts/gnt-debug \
240
	scripts/gnt-instance \
241
	scripts/gnt-job \
242
	scripts/gnt-node \
243
	scripts/gnt-os
244

    
245
dist_sbin_SCRIPTS = \
246
	daemons/ganeti-noded \
247
	daemons/ganeti-watcher \
248
	daemons/ganeti-masterd \
249
	daemons/ganeti-confd \
250
	daemons/ganeti-rapi \
251
	$(gnt_scripts)
252

    
253
nodist_sbin_SCRIPTS = \
254
	daemons/ganeti-cleaner
255

    
256
dist_tools_SCRIPTS = \
257
	tools/burnin \
258
	tools/cfgshell \
259
	tools/cfgupgrade \
260
	tools/cfgupgrade12 \
261
	tools/cluster-merge \
262
	tools/lvmstrap \
263
	tools/move-instance \
264
	tools/sanitize-config
265

    
266
pkglib_python_scripts = \
267
	daemons/import-export \
268
	tools/check-cert-expired
269

    
270
pkglib_SCRIPTS = \
271
	daemons/daemon-util \
272
	daemons/ensure-dirs \
273
	$(pkglib_python_scripts)
274

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

    
327
man_MANS = \
328
	man/ganeti.7 \
329
	man/ganeti-cleaner.8 \
330
	man/ganeti-confd.8 \
331
	man/ganeti-masterd.8 \
332
	man/ganeti-noded.8 \
333
	man/ganeti-os-interface.7 \
334
	man/ganeti-rapi.8 \
335
	man/ganeti-watcher.8 \
336
	man/gnt-backup.8 \
337
	man/gnt-cluster.8 \
338
	man/gnt-debug.8 \
339
	man/gnt-instance.8 \
340
	man/gnt-job.8 \
341
	man/gnt-node.8 \
342
	man/gnt-os.8
343

    
344
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
345
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
346
maninput = \
347
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
348
	$(patsubst %.html,%.html.in,$(manhtml))
349

    
350
TEST_FILES = \
351
	test/data/bdev-drbd-8.0.txt \
352
	test/data/bdev-drbd-8.3.txt \
353
	test/data/bdev-drbd-disk.txt \
354
	test/data/bdev-drbd-net-ip4.txt \
355
	test/data/bdev-drbd-net-ip6.txt \
356
	test/data/cert1.pem \
357
	test/data/proc_drbd8.txt \
358
	test/data/proc_drbd80-emptyline.txt \
359
	test/data/proc_drbd83.txt \
360
	test/import-export_unittest-helper
361

    
362
python_tests = \
363
	test/ganeti.asyncnotifier_unittest.py \
364
	test/ganeti.backend_unittest.py \
365
	test/ganeti.bdev_unittest.py \
366
	test/ganeti.cli_unittest.py \
367
	test/ganeti.daemon_unittest.py \
368
	test/ganeti.cmdlib_unittest.py \
369
	test/ganeti.compat_unittest.py \
370
	test/ganeti.confd.client_unittest.py \
371
	test/ganeti.config_unittest.py \
372
	test/ganeti.constants_unittest.py \
373
	test/ganeti.errors_unittest.py \
374
	test/ganeti.hooks_unittest.py \
375
	test/ganeti.http_unittest.py \
376
	test/ganeti.impexpd_unittest.py \
377
	test/ganeti.locking_unittest.py \
378
	test/ganeti.luxi_unittest.py \
379
	test/ganeti.masterd.instance_unittest.py \
380
	test/ganeti.mcpu_unittest.py \
381
	test/ganeti.objects_unittest.py \
382
	test/ganeti.opcodes_unittest.py \
383
	test/ganeti.rapi.client_unittest.py \
384
	test/ganeti.rapi.resources_unittest.py \
385
	test/ganeti.rapi.rlib2_unittest.py \
386
	test/ganeti.serializer_unittest.py \
387
	test/ganeti.ssh_unittest.py \
388
	test/ganeti.uidpool_unittest.py \
389
	test/ganeti.utils_unittest.py \
390
	test/ganeti.utils_mlockall_unittest.py \
391
	test/ganeti.workerpool_unittest.py \
392
	test/cfgupgrade_unittest.py \
393
	test/docs_unittest.py \
394
	test/tempfile_fork_unittest.py
395

    
396
dist_TESTS = \
397
	test/check-cert-expired_unittest.bash \
398
	test/daemon-util_unittest.bash \
399
	test/ganeti-cleaner_unittest.bash \
400
	test/import-export_unittest.bash \
401
	$(python_tests)
402

    
403
nodist_TESTS =
404

    
405
TESTS = $(dist_TESTS) $(nodist_TESTS)
406

    
407
# Environment for all tests
408
PLAIN_TESTS_ENVIRONMENT = \
409
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
410

    
411
# Environment for tests run by automake
412
TESTS_ENVIRONMENT = \
413
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
414

    
415
all_python_code = \
416
	$(dist_sbin_SCRIPTS) \
417
	$(dist_tools_SCRIPTS) \
418
	$(pkglib_python_scripts) \
419
	$(python_tests) \
420
	$(pkgpython_PYTHON) \
421
	$(hypervisor_PYTHON) \
422
	$(rapi_PYTHON) \
423
	$(http_PYTHON) \
424
	$(confd_PYTHON) \
425
	$(masterd_PYTHON) \
426
	$(impexpd_PYTHON) \
427
	$(noinst_PYTHON)
428

    
429
srclink_files = \
430
	man/footer.sgml \
431
	test/check-cert-expired_unittest.bash \
432
	test/daemon-util_unittest.bash \
433
	test/ganeti-cleaner_unittest.bash \
434
	test/import-export_unittest.bash \
435
	$(all_python_code)
436

    
437
check_python_code = \
438
	$(BUILD_BASH_COMPLETION) \
439
	$(all_python_code)
440

    
441
lint_python_code = \
442
	ganeti \
443
	$(dist_sbin_SCRIPTS) \
444
	$(dist_tools_SCRIPTS) \
445
	$(pkglib_python_scripts) \
446
	$(BUILD_BASH_COMPLETION)
447

    
448
test/daemon-util_unittest.bash: daemons/daemon-util
449

    
450
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
451

    
452
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
453
	sed -f $(REPLACE_VARS_SED) < $< > $@
454
	chmod u+x $@
455

    
456
daemons/%: daemons/%.in \
457
		$(REPLACE_VARS_SED)
458
	sed -f $(REPLACE_VARS_SED) < $< > $@
459
	chmod +x $@
460

    
461
doc/examples/%: doc/examples/%.in \
462
		$(REPLACE_VARS_SED)
463
	sed -f $(REPLACE_VARS_SED) < $< > $@
464

    
465
doc/examples/hooks/%: doc/examples/hooks/%.in \
466
		$(REPLACE_VARS_SED)
467
	sed -f $(REPLACE_VARS_SED) < $< > $@
468

    
469
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
470
	lib/cli.py $(gnt_scripts) tools/burnin
471
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
472

    
473
doc/%.png: doc/%.dot
474
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
475
	$(DOT) -Tpng -o $@ $<
476

    
477
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
478
	@test -n "$(DOCBOOK2MAN)" || \
479
	  { echo 'docbook2man' not found during configure; exit 1; }
480
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
481
	$(CHECK_MAN) $@
482

    
483
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
484
	@test -n "$(DOCBOOK2HTML)" || \
485
	  { echo 'docbook2html' not found during configure; exit 1; }
486
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
487

    
488
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
489
	sed -f $(REPLACE_VARS_SED) < $< > $@
490

    
491
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
492
	sed -f $(REPLACE_VARS_SED) < $< > $@
493

    
494
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
495
	sed -f $(REPLACE_VARS_SED) < $< > $@
496

    
497
lib/_autoconf.py: Makefile stamp-directories
498
	set -e; \
499
	{ echo '# This file is automatically generated, do not edit!'; \
500
	  echo '#'; \
501
	  echo ''; \
502
	  echo '"""Build-time configuration for Ganeti.'; \
503
	  echo '';\
504
	  echo 'This file is autogenerated by the build process.'; \
505
	  echo 'For any changes you need to re-run ./configure (and'; \
506
	  echo 'not edit by hand).'; \
507
	  echo ''; \
508
	  echo '"""'; \
509
	  echo ''; \
510
	  echo '# pylint: disable-msg=C0301,C0324'; \
511
	  echo '# because this is autogenerated, we do not want'; \
512
	  echo '# style warnings' ; \
513
	  echo ''; \
514
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
515
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
516
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
517
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
518
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
519
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
520
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
521
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
522
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
523
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
524
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
525
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
526
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
527
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
528
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
529
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
530
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
531
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
532
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
533
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
534
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
535
	  echo "TOOLSDIR = '$(toolsdir)'"; \
536
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
537
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
538
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
539
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
540
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
541
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
542
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
543
	} > $@
544

    
545
$(REPLACE_VARS_SED): Makefile
546
	set -e; \
547
	{ echo 's#@PREFIX@#$(prefix)#g'; \
548
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
549
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
550
	  echo 's#@BINDIR@#$(bindir)#g'; \
551
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
552
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
553
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
554
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
555
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
556
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
557
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
558
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
559
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
560
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
561
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
562
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
563
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
564
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
565
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
566
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
567
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
568
	} > $@
569

    
570
# We need to create symlinks because "make distcheck" will not install Python
571
# files when building.
572
stamp-srclinks: Makefile stamp-directories
573
	set -e; \
574
	for i in $(srclink_files); do \
575
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
576
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
577
		fi; \
578
	done
579
	touch $@
580

    
581
.PHONY: ganeti
582
ganeti:
583
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
584

    
585
.PHONY: check-dirs
586
check-dirs: $(BUILT_SOURCES)
587
	set -e; \
588
	find . -type d \( \( -name . \) -o \( \
589
		-name .git -o \
590
		-name autom4te.cache \
591
		\) -prune -o -print \) | { \
592
		error=; \
593
		while read dir; do \
594
			case "$$dir" in \
595
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
596
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
597
			esac; \
598
		done; \
599
		for dir in $(DIRS); do \
600
			if ! test -d "$$dir"; then \
601
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
602
				error=1; \
603
			fi \
604
		done; \
605
		if test -n "$$error"; then exit 1; else exit 0; fi; \
606
	}
607

    
608
check-local: check-dirs
609
	$(CHECK_PYTHON_CODE) $(check_python_code)
610

    
611
.PHONY: lint
612
lint: ganeti $(BUILT_SOURCES)
613
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
614
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
615

    
616
# a dist hook rule for catching revision control directories
617
distcheck-hook:
618
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
619
		echo "Found revision control files in final archive." 1>&2; \
620
		exit 1; \
621
	fi
622
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
623
		echo "Found Python byte code in final archive." 1>&2; \
624
		exit 1; \
625
	fi
626
	if find $(top_distdir) -name '*~' | grep .; then \
627
		echo "Found backup files in final archive." 1>&2; \
628
		exit 1; \
629
	fi
630

    
631
install-exec-local:
632
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
633
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
634
	  "$(DESTDIR)${localstatedir}/run/ganeti"
635

    
636
stamp-directories: Makefile
637
	@mkdir_p@ $(DIRS)
638
	touch $@
639

    
640
.PHONY: apidoc
641
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
642
	test -e doc/api || mkdir doc/api
643
	$(RUN_IN_TEMPDIR) epydoc -v \
644
		--conf $(CURDIR)/epydoc.conf \
645
		--output $(CURDIR)/doc/api
646

    
647
.PHONY: TAGS
648
TAGS: $(BUILT_SOURCES)
649
	rm -f TAGS
650
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
651
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
652
	  etags -
653

    
654
.PHONY: coverage
655
coverage: $(BUILT_SOURCES) $(python_tests)
656
	set -e; \
657
	mkdir -p doc/coverage; \
658
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
659
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
660
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
661
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
662
	$(python_tests)
663

    
664
commit-check: distcheck lint apidoc
665

    
666
-include ./Makefile.local
667

    
668
# vim: set noet :