Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 33231500

History | View | Annotate | Download (17.3 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/netutils.py \
123
	lib/objects.py \
124
	lib/opcodes.py \
125
	lib/rpc.py \
126
	lib/serializer.py \
127
	lib/ssconf.py \
128
	lib/ssh.py \
129
	lib/storage.py \
130
	lib/utils.py \
131
	lib/uidpool.py \
132
	lib/workerpool.py
133

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

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

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

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

    
163
masterd_PYTHON = \
164
	lib/masterd/__init__.py \
165
	lib/masterd/instance.py
166

    
167
impexpd_PYTHON = \
168
	lib/impexpd/__init__.py
169

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

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

    
201
doc/html: doc/html/.stamp
202

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

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

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

    
224
docpng = $(patsubst %.dot,%.png,$(docdot))
225

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

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

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

    
255
nodist_sbin_SCRIPTS = \
256
	daemons/ganeti-cleaner
257

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

    
268
pkglib_python_scripts = \
269
	daemons/import-export \
270
	tools/check-cert-expired
271

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

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

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

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

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

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

    
403
dist_TESTS = \
404
	test/check-cert-expired_unittest.bash \
405
	test/daemon-util_unittest.bash \
406
	test/ganeti-cleaner_unittest.bash \
407
	test/import-export_unittest.bash \
408
	$(python_tests)
409

    
410
nodist_TESTS =
411

    
412
TESTS = $(dist_TESTS) $(nodist_TESTS)
413

    
414
# Environment for all tests
415
PLAIN_TESTS_ENVIRONMENT = \
416
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
417

    
418
# Environment for tests run by automake
419
TESTS_ENVIRONMENT = \
420
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
421

    
422
all_python_code = \
423
	$(dist_sbin_SCRIPTS) \
424
	$(dist_tools_SCRIPTS) \
425
	$(pkglib_python_scripts) \
426
	$(python_tests) \
427
	$(pkgpython_PYTHON) \
428
	$(hypervisor_PYTHON) \
429
	$(rapi_PYTHON) \
430
	$(http_PYTHON) \
431
	$(confd_PYTHON) \
432
	$(masterd_PYTHON) \
433
	$(impexpd_PYTHON) \
434
	$(noinst_PYTHON)
435

    
436
srclink_files = \
437
	man/footer.sgml \
438
	test/check-cert-expired_unittest.bash \
439
	test/daemon-util_unittest.bash \
440
	test/ganeti-cleaner_unittest.bash \
441
	test/import-export_unittest.bash \
442
	$(all_python_code)
443

    
444
check_python_code = \
445
	$(BUILD_BASH_COMPLETION) \
446
	$(all_python_code)
447

    
448
lint_python_code = \
449
	ganeti \
450
	$(dist_sbin_SCRIPTS) \
451
	$(dist_tools_SCRIPTS) \
452
	$(pkglib_python_scripts) \
453
	$(BUILD_BASH_COMPLETION)
454

    
455
test/daemon-util_unittest.bash: daemons/daemon-util
456

    
457
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
458

    
459
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
460
	sed -f $(REPLACE_VARS_SED) < $< > $@
461
	chmod u+x $@
462

    
463
daemons/%: daemons/%.in \
464
		$(REPLACE_VARS_SED)
465
	sed -f $(REPLACE_VARS_SED) < $< > $@
466
	chmod +x $@
467

    
468
doc/examples/%: doc/examples/%.in \
469
		$(REPLACE_VARS_SED)
470
	sed -f $(REPLACE_VARS_SED) < $< > $@
471

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

    
476
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
477
	lib/cli.py $(gnt_scripts) tools/burnin
478
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
479

    
480
doc/%.png: doc/%.dot
481
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
482
	$(DOT) -Tpng -o $@ $<
483

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

    
490
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
491
	@test -n "$(DOCBOOK2HTML)" || \
492
	  { echo 'docbook2html' not found during configure; exit 1; }
493
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
494

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

    
498
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
499
	sed -f $(REPLACE_VARS_SED) < $< > $@
500

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

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

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

    
577
# We need to create symlinks because "make distcheck" will not install Python
578
# files when building.
579
stamp-srclinks: Makefile stamp-directories
580
	set -e; \
581
	for i in $(srclink_files); do \
582
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
583
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
584
		fi; \
585
	done
586
	touch $@
587

    
588
.PHONY: ganeti
589
ganeti:
590
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
591

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

    
615
check-local: check-dirs
616
	$(CHECK_PYTHON_CODE) $(check_python_code)
617

    
618
.PHONY: lint
619
lint: ganeti $(BUILT_SOURCES)
620
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
621
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
622

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

    
638
install-exec-local:
639
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
640
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
641
	  "$(DESTDIR)${localstatedir}/run/ganeti"
642

    
643
stamp-directories: Makefile
644
	@mkdir_p@ $(DIRS)
645
	touch $@
646

    
647
.PHONY: apidoc
648
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
649
	test -e doc/api || mkdir doc/api
650
	$(RUN_IN_TEMPDIR) epydoc -v \
651
		--conf $(CURDIR)/epydoc.conf \
652
		--output $(CURDIR)/doc/api
653

    
654
.PHONY: TAGS
655
TAGS: $(BUILT_SOURCES)
656
	rm -f TAGS
657
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
658
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
659
	  etags -
660

    
661
.PHONY: coverage
662
coverage: $(BUILT_SOURCES) $(python_tests)
663
	set -e; \
664
	mkdir -p doc/coverage; \
665
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
666
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
667
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
668
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
669
	$(python_tests)
670

    
671
commit-check: distcheck lint apidoc
672

    
673
-include ./Makefile.local
674

    
675
# vim: set noet :