Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ e695efbf

History | View | Annotate | Download (21.9 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
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
14
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
15
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
16
CHECK_MAN = $(top_srcdir)/autotools/check-man
17
REPLACE_VARS_SED = autotools/replace_vars.sed
18

    
19
clientdir = $(pkgpythondir)/client
20
hypervisordir = $(pkgpythondir)/hypervisor
21
httpdir = $(pkgpythondir)/http
22
masterddir = $(pkgpythondir)/masterd
23
confddir = $(pkgpythondir)/confd
24
rapidir = $(pkgpythondir)/rapi
25
serverdir = $(pkgpythondir)/server
26
watcherdir = $(pkgpythondir)/watcher
27
impexpddir = $(pkgpythondir)/impexpd
28
toolsdir = $(pkglibdir)/tools
29
docdir = $(datadir)/doc/$(PACKAGE)
30

    
31
# Delete output file if an error occurred while building it
32
.DELETE_ON_ERROR:
33

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

    
59
BUILDTIME_DIR_AUTOCREATE = \
60
	scripts \
61
	doc/api \
62
	doc/coverage
63

    
64
BUILDTIME_DIRS = \
65
	$(BUILDTIME_DIR_AUTOCREATE) \
66
	doc/html
67

    
68
DIRCHECK_EXCLUDE = \
69
	$(BUILDTIME_DIRS) \
70
	ganeti-[0-9]*.[0-9]*.[0-9]* \
71
	doc/html/_*
72

    
73
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
74

    
75
MAINTAINERCLEANFILES = \
76
	$(docpng) \
77
	$(maninput) \
78
	doc/install-quick.rst \
79
	doc/news.rst \
80
	vcs-version
81

    
82
maintainer-clean-local:
83
	rm -rf $(BUILDTIME_DIRS)
84

    
85
CLEANFILES = \
86
	$(addsuffix /*.py[co],$(DIRS)) \
87
	$(all_dirfiles) \
88
	$(PYTHON_BOOTSTRAP) \
89
	autotools/replace_vars.sed \
90
	daemons/daemon-util \
91
	daemons/ensure-dirs \
92
	daemons/ganeti-cleaner \
93
	devel/upload \
94
	doc/examples/bash_completion \
95
	doc/examples/ganeti.initd \
96
	doc/examples/ganeti.cron \
97
	doc/examples/gnt-config-backup \
98
	doc/examples/hooks/ipsec \
99
	$(man_MANS) \
100
	$(manhtml) \
101
	stamp-srclinks \
102
	$(nodist_pkgpython_PYTHON)
103

    
104
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
105
# it'll cause the target to rebuild every time.
106
BUILT_SOURCES = \
107
	ganeti \
108
	stamp-srclinks \
109
	lib/_autoconf.py \
110
	$(all_dirfiles) \
111
	$(PYTHON_BOOTSTRAP)
112

    
113
nodist_pkgpython_PYTHON = \
114
	lib/_autoconf.py
115

    
116
noinst_PYTHON = \
117
	lib/build/__init__.py
118

    
119
pkgpython_PYTHON = \
120
	lib/__init__.py \
121
	lib/asyncnotifier.py \
122
	lib/backend.py \
123
	lib/bdev.py \
124
	lib/bootstrap.py \
125
	lib/cli.py \
126
	lib/cmdlib.py \
127
	lib/compat.py \
128
	lib/config.py \
129
	lib/constants.py \
130
	lib/daemon.py \
131
	lib/errors.py \
132
	lib/ht.py \
133
	lib/jqueue.py \
134
	lib/jstore.py \
135
	lib/locking.py \
136
	lib/luxi.py \
137
	lib/mcpu.py \
138
	lib/netutils.py \
139
	lib/objects.py \
140
	lib/opcodes.py \
141
	lib/rpc.py \
142
	lib/runtime.py \
143
	lib/serializer.py \
144
	lib/ssconf.py \
145
	lib/ssh.py \
146
	lib/storage.py \
147
	lib/utils.py \
148
	lib/uidpool.py \
149
	lib/workerpool.py
150

    
151
client_PYTHON = \
152
	lib/client/__init__.py \
153
	lib/client/gnt_backup.py \
154
	lib/client/gnt_cluster.py \
155
	lib/client/gnt_debug.py \
156
	lib/client/gnt_instance.py \
157
	lib/client/gnt_job.py \
158
	lib/client/gnt_node.py \
159
	lib/client/gnt_os.py
160

    
161
hypervisor_PYTHON = \
162
	lib/hypervisor/__init__.py \
163
	lib/hypervisor/hv_base.py \
164
	lib/hypervisor/hv_chroot.py \
165
	lib/hypervisor/hv_fake.py \
166
	lib/hypervisor/hv_kvm.py \
167
	lib/hypervisor/hv_lxc.py \
168
	lib/hypervisor/hv_xen.py
169

    
170
rapi_PYTHON = \
171
	lib/rapi/__init__.py \
172
	lib/rapi/baserlib.py \
173
	lib/rapi/client.py \
174
	lib/rapi/client_utils.py \
175
	lib/rapi/connector.py \
176
	lib/rapi/rlib2.py
177

    
178
http_PYTHON = \
179
	lib/http/__init__.py \
180
	lib/http/auth.py \
181
	lib/http/client.py \
182
	lib/http/server.py
183

    
184
confd_PYTHON = \
185
	lib/confd/__init__.py \
186
	lib/confd/client.py \
187
	lib/confd/querylib.py \
188
	lib/confd/server.py
189

    
190
masterd_PYTHON = \
191
	lib/masterd/__init__.py \
192
	lib/masterd/instance.py
193

    
194
impexpd_PYTHON = \
195
	lib/impexpd/__init__.py
196

    
197
watcher_PYTHON = \
198
	lib/watcher/__init__.py
199

    
200
server_PYTHON = \
201
	lib/server/__init__.py \
202
	lib/server/confd.py \
203
	lib/server/masterd.py \
204
	lib/server/noded.py \
205
	lib/server/rapi.py
206

    
207
docrst = \
208
	doc/admin.rst \
209
	doc/design-2.0.rst \
210
	doc/design-2.1.rst \
211
	doc/design-2.2.rst \
212
	doc/design-2.3.rst \
213
	doc/design-oob.rst \
214
	doc/design-query2.rst \
215
	doc/cluster-merge.rst \
216
	doc/devnotes.rst \
217
	doc/glossary.rst \
218
	doc/hooks.rst \
219
	doc/iallocator.rst \
220
	doc/index.rst \
221
	doc/install-quick.rst \
222
	doc/install.rst \
223
	doc/locking.rst \
224
	doc/move-instance.rst \
225
	doc/news.rst \
226
	doc/rapi.rst \
227
	doc/security.rst \
228
	doc/walkthrough.rst
229

    
230
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
231

    
232
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
233
	$(RUN_IN_TEMPDIR)
234
	@test -n "$(SPHINX)" || \
235
	    { echo 'sphinx-build' not found during configure; exit 1; }
236
	@mkdir_p@ $(dir $@)
237
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
238
	    -d . \
239
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
240
	    -D release="$(PACKAGE_VERSION)" \
241
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
242
	rm -f doc/html/.buildinfo doc/html/objects.inv
243
	touch $@
244

    
245
doc/html: doc/html/index.html
246

    
247
doc/news.rst: NEWS
248
	set -e; \
249
	{ echo '.. This file is automatically updated at build time from $<.'; \
250
	  echo '.. Do not edit.'; \
251
	  echo; \
252
	  cat $<; \
253
	} > $@
254

    
255
doc/install-quick.rst: INSTALL
256
	set -e; \
257
	{ echo '.. This file is automatically updated at build time from $<.'; \
258
	  echo '.. Do not edit.'; \
259
	  echo; \
260
	  cat $<; \
261
	} > $@
262

    
263
docdot = \
264
	doc/arch-2.0.dot \
265
	doc/design-2.1-lock-acquire.dot \
266
	doc/design-2.1-lock-release.dot
267

    
268
docpng = $(patsubst %.dot,%.png,$(docdot))
269

    
270
# Things to build but not to install (add it to EXTRA_DIST if it should be
271
# distributed)
272
noinst_DATA = \
273
	devel/upload \
274
	doc/html \
275
	doc/examples/bash_completion \
276
	doc/examples/ganeti.cron \
277
	doc/examples/ganeti.initd \
278
	doc/examples/gnt-config-backup \
279
	doc/examples/hooks/ipsec \
280
	$(manhtml)
281

    
282
gnt_scripts = \
283
	scripts/gnt-backup \
284
	scripts/gnt-cluster \
285
	scripts/gnt-debug \
286
	scripts/gnt-instance \
287
	scripts/gnt-job \
288
	scripts/gnt-node \
289
	scripts/gnt-os
290

    
291
PYTHON_BOOTSTRAP = \
292
	daemons/ganeti-confd \
293
	daemons/ganeti-masterd \
294
	daemons/ganeti-noded \
295
	daemons/ganeti-watcher \
296
	daemons/ganeti-rapi \
297
	scripts/gnt-backup \
298
	scripts/gnt-cluster \
299
	scripts/gnt-debug \
300
	scripts/gnt-instance \
301
	scripts/gnt-job \
302
	scripts/gnt-node \
303
	scripts/gnt-os
304

    
305
dist_sbin_SCRIPTS =
306

    
307
nodist_sbin_SCRIPTS = \
308
	$(PYTHON_BOOTSTRAP) \
309
	daemons/ganeti-cleaner
310

    
311
dist_tools_SCRIPTS = \
312
	tools/burnin \
313
	tools/cfgshell \
314
	tools/cfgupgrade \
315
	tools/cfgupgrade12 \
316
	tools/cluster-merge \
317
	tools/lvmstrap \
318
	tools/move-instance \
319
	tools/setup-ssh \
320
	tools/sanitize-config
321

    
322
pkglib_python_scripts = \
323
	daemons/import-export \
324
	tools/check-cert-expired
325

    
326
pkglib_SCRIPTS = \
327
	daemons/daemon-util \
328
	daemons/ensure-dirs \
329
	$(pkglib_python_scripts)
330

    
331
EXTRA_DIST = \
332
	NEWS \
333
	pylintrc \
334
	autotools/build-bash-completion \
335
	autotools/check-python-code \
336
	autotools/check-man \
337
	autotools/check-tar \
338
	autotools/gen-coverage \
339
	autotools/testrunner \
340
	$(RUN_IN_TEMPDIR) \
341
	daemons/daemon-util.in \
342
	daemons/ensure-dirs.in \
343
	daemons/ganeti-cleaner.in \
344
	$(pkglib_python_scripts) \
345
	devel/upload.in \
346
	$(docdot) \
347
	$(docpng) \
348
	$(docrst) \
349
	doc/conf.py \
350
	doc/html \
351
	doc/examples/ganeti.initd.in \
352
	doc/examples/ganeti.cron.in \
353
	doc/examples/gnt-config-backup.in \
354
	doc/examples/dumb-allocator \
355
	doc/examples/ganeti.default \
356
	doc/examples/ganeti.default-debug \
357
	doc/examples/hooks/ethers \
358
	doc/examples/hooks/ipsec.in \
359
	doc/examples/gnt-debug/README \
360
	doc/examples/gnt-debug/delay0.json \
361
	doc/examples/gnt-debug/delay50.json \
362
	test/testutils.py \
363
	test/mocks.py \
364
	$(dist_TESTS) \
365
	$(TEST_FILES) \
366
	man/footer.rst \
367
	$(manrst) \
368
	$(maninput) \
369
	qa/ganeti-qa.py \
370
	qa/qa-sample.json \
371
	qa/qa_cluster.py \
372
	qa/qa_config.py \
373
	qa/qa_daemon.py \
374
	qa/qa_env.py \
375
	qa/qa_error.py \
376
	qa/qa_instance.py \
377
	qa/qa_node.py \
378
	qa/qa_os.py \
379
	qa/qa_rapi.py \
380
	qa/qa_tags.py \
381
	qa/qa_utils.py
382

    
383
man_MANS = \
384
	man/ganeti.7 \
385
	man/ganeti-cleaner.8 \
386
	man/ganeti-confd.8 \
387
	man/ganeti-masterd.8 \
388
	man/ganeti-noded.8 \
389
	man/ganeti-os-interface.7 \
390
	man/ganeti-rapi.8 \
391
	man/ganeti-watcher.8 \
392
	man/gnt-backup.8 \
393
	man/gnt-cluster.8 \
394
	man/gnt-debug.8 \
395
	man/gnt-instance.8 \
396
	man/gnt-job.8 \
397
	man/gnt-node.8 \
398
	man/gnt-os.8
399

    
400
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
401
manhtml = $(patsubst %.rst,%.html,$(manrst))
402
maninput = \
403
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
404
	$(patsubst %.html,%.html.in,$(manhtml)) \
405
	man/footer.man man/footer.html
406

    
407
TEST_FILES = \
408
	test/data/bdev-drbd-8.0.txt \
409
	test/data/bdev-drbd-8.3.txt \
410
	test/data/bdev-drbd-disk.txt \
411
	test/data/bdev-drbd-net-ip4.txt \
412
	test/data/bdev-drbd-net-ip6.txt \
413
	test/data/cert1.pem \
414
	test/data/proc_drbd8.txt \
415
	test/data/proc_drbd80-emptyline.txt \
416
	test/data/proc_drbd83.txt \
417
	test/data/sys_drbd_usermode_helper.txt \
418
	test/import-export_unittest-helper
419

    
420
python_tests = \
421
	test/ganeti.asyncnotifier_unittest.py \
422
	test/ganeti.backend_unittest.py \
423
	test/ganeti.bdev_unittest.py \
424
	test/ganeti.cli_unittest.py \
425
	test/ganeti.daemon_unittest.py \
426
	test/ganeti.cmdlib_unittest.py \
427
	test/ganeti.compat_unittest.py \
428
	test/ganeti.confd.client_unittest.py \
429
	test/ganeti.config_unittest.py \
430
	test/ganeti.constants_unittest.py \
431
	test/ganeti.errors_unittest.py \
432
	test/ganeti.hooks_unittest.py \
433
	test/ganeti.http_unittest.py \
434
	test/ganeti.hypervisor.py \
435
	test/ganeti.hypervisor.hv_kvm_unittest.py \
436
	test/ganeti.impexpd_unittest.py \
437
	test/ganeti.jqueue_unittest.py \
438
	test/ganeti.locking_unittest.py \
439
	test/ganeti.luxi_unittest.py \
440
	test/ganeti.masterd.instance_unittest.py \
441
	test/ganeti.mcpu_unittest.py \
442
	test/ganeti.netutils_unittest.py \
443
	test/ganeti.objects_unittest.py \
444
	test/ganeti.opcodes_unittest.py \
445
	test/ganeti.rapi.client_unittest.py \
446
	test/ganeti.rapi.resources_unittest.py \
447
	test/ganeti.rapi.rlib2_unittest.py \
448
	test/ganeti.rpc_unittest.py \
449
	test/ganeti.runtime_unittest.py \
450
	test/ganeti.serializer_unittest.py \
451
	test/ganeti.ssh_unittest.py \
452
	test/ganeti.uidpool_unittest.py \
453
	test/ganeti.utils_unittest.py \
454
	test/ganeti.utils_mlockall_unittest.py \
455
	test/ganeti.workerpool_unittest.py \
456
	test/cfgupgrade_unittest.py \
457
	test/docs_unittest.py \
458
	test/tempfile_fork_unittest.py
459

    
460
dist_TESTS = \
461
	test/check-cert-expired_unittest.bash \
462
	test/daemon-util_unittest.bash \
463
	test/ganeti-cleaner_unittest.bash \
464
	test/import-export_unittest.bash \
465
	$(python_tests)
466

    
467
nodist_TESTS =
468

    
469
TESTS = $(dist_TESTS) $(nodist_TESTS)
470

    
471
# Environment for all tests
472
PLAIN_TESTS_ENVIRONMENT = \
473
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
474

    
475
# Environment for tests run by automake
476
TESTS_ENVIRONMENT = \
477
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
478

    
479
all_python_code = \
480
	$(dist_sbin_SCRIPTS) \
481
	$(dist_tools_SCRIPTS) \
482
	$(pkglib_python_scripts) \
483
	$(python_tests) \
484
	$(pkgpython_PYTHON) \
485
	$(client_PYTHON) \
486
	$(hypervisor_PYTHON) \
487
	$(rapi_PYTHON) \
488
	$(server_PYTHON) \
489
	$(http_PYTHON) \
490
	$(confd_PYTHON) \
491
	$(masterd_PYTHON) \
492
	$(impexpd_PYTHON) \
493
	$(watcher_PYTHON) \
494
	$(noinst_PYTHON)
495

    
496
srclink_files = \
497
	man/footer.rst \
498
	test/check-cert-expired_unittest.bash \
499
	test/daemon-util_unittest.bash \
500
	test/ganeti-cleaner_unittest.bash \
501
	test/import-export_unittest.bash \
502
	$(all_python_code)
503

    
504
check_python_code = \
505
	$(BUILD_BASH_COMPLETION) \
506
	$(all_python_code)
507

    
508
lint_python_code = \
509
	ganeti \
510
	ganeti/http/server.py \
511
	$(dist_sbin_SCRIPTS) \
512
	$(dist_tools_SCRIPTS) \
513
	$(pkglib_python_scripts) \
514
	$(BUILD_BASH_COMPLETION) \
515
	$(PYTHON_BOOTSTRAP)
516

    
517
test/daemon-util_unittest.bash: daemons/daemon-util
518

    
519
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
520

    
521
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
522
	sed -f $(REPLACE_VARS_SED) < $< > $@
523
	chmod u+x $@
524

    
525
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
526
	sed -f $(REPLACE_VARS_SED) < $< > $@
527
	chmod +x $@
528

    
529
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
530
	sed -f $(REPLACE_VARS_SED) < $< > $@
531

    
532
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
533
	sed -f $(REPLACE_VARS_SED) < $< > $@
534

    
535
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
536
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
537
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
538

    
539
doc/%.png: doc/%.dot
540
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
541
	$(DOT) -Tpng -o $@ $<
542

    
543
man/footer.man: man/footer.rst
544
	@test -n "$(PANDOC)" || \
545
	  { echo 'pandoc' not found during configure; exit 1; }
546
	$(PANDOC) -f rst -t man -o $@ $<
547

    
548
man/footer.html: man/footer.rst
549
	@test -n "$(PANDOC)" || \
550
	  { echo 'pandoc' not found during configure; exit 1; }
551
	$(PANDOC) -f rst -t html -o $@ $<
552

    
553
man/%.7.in man/%.8.in: man/%.rst man/footer.man
554
	@test -n "$(PANDOC)" || \
555
	  { echo 'pandoc' not found during configure; exit 1; }
556
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
557
	  sed -e 's/\\@/@/g' > $@
558
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
559

    
560
man/%.html.in: man/%.rst man/footer.html
561
	@test -n "$(PANDOC)" || \
562
	  { echo 'pandoc' not found during configure; exit 1; }
563
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
564
	  sed -e 's/\\@/@/g' > $@
565

    
566

    
567
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
568
	sed -f $(REPLACE_VARS_SED) < $< > $@
569

    
570
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
571
	sed -f $(REPLACE_VARS_SED) < $< > $@
572

    
573
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
574
	sed -f $(REPLACE_VARS_SED) < $< > $@
575

    
576
vcs-version:
577
	if test -d .git; then \
578
	  git describe > $@; \
579
	elif test ! -f $@ ; then \
580
	  echo "Cannot auto-generate $@ file"; exit 1; \
581
	fi
582

    
583
.PHONY: regen-vcs-version
584
regen-vcs-version:
585
	set -e; \
586
	cd $(srcdir); \
587
	if test -d .git; then \
588
	  rm -f vcs-version; \
589
	  $(MAKE) vcs-version; \
590
	fi
591

    
592
lib/_autoconf.py: Makefile vcs-version | lib/.dir
593
	set -e; \
594
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
595
	{ echo '# This file is automatically generated, do not edit!'; \
596
	  echo '#'; \
597
	  echo ''; \
598
	  echo '"""Build-time configuration for Ganeti.'; \
599
	  echo '';\
600
	  echo 'This file is autogenerated by the build process.'; \
601
	  echo 'For any changes you need to re-run ./configure (and'; \
602
	  echo 'not edit by hand).'; \
603
	  echo ''; \
604
	  echo '"""'; \
605
	  echo ''; \
606
	  echo '# pylint: disable-msg=C0301,C0324'; \
607
	  echo '# because this is autogenerated, we do not want'; \
608
	  echo '# style warnings' ; \
609
	  echo ''; \
610
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
611
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
612
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
613
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
614
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
615
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
616
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
617
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
618
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
619
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
620
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
621
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
622
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
623
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
624
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
625
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
626
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
627
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
628
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
629
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
630
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
631
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
632
	  echo "TOOLSDIR = '$(toolsdir)'"; \
633
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
634
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
635
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
636
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
637
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
638
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
639
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
640
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
641
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
642
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
643
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
644
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
645
	  echo "NODED_USER = '$(NODED_USER)'"; \
646
	  echo "VCS_VERSION = '$$VCSVER'"; \
647
	} > $@
648

    
649
$(REPLACE_VARS_SED): Makefile
650
	set -e; \
651
	{ echo 's#@PREFIX@#$(prefix)#g'; \
652
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
653
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
654
	  echo 's#@BINDIR@#$(bindir)#g'; \
655
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
656
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
657
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
658
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
659
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
660
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
661
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
662
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
663
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
664
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
665
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
666
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
667
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
668
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
669
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
670
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
671
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
672
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
673
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
674
	} > $@
675

    
676
# Using deferred evaluation
677
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
678
daemons/ganeti-watcher: MODULE = ganeti.watcher
679
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
680

    
681
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
682
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
683
	set -e; \
684
	{ echo '#!/usr/bin/python'; \
685
	  echo '# This file is automatically generated, do not edit!'; \
686
	  echo "# Edit $(MODULE) instead."; \
687
	  echo; \
688
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
689
	  echo; \
690
	  echo '# pylint: disable-msg=C0103'; \
691
	  echo '# C0103: Invalid name'; \
692
	  echo; \
693
	  echo 'import sys'; \
694
	  echo 'import $(MODULE) as main'; \
695
	  echo; \
696
	  echo '# Temporarily alias commands until bash completion'; \
697
	  echo '# generator is changed'; \
698
	  echo 'if hasattr(main, "commands"):'; \
699
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
700
	  echo; \
701
	  echo 'if __name__ == "__main__":'; \
702
	  echo '  sys.exit(main.Main())'; \
703
	} > $@
704
	chmod u+x $@
705

    
706
# We need to create symlinks because "make distcheck" will not install Python
707
# files when building.
708
stamp-srclinks: Makefile | $(all_dirfiles)
709
	set -e; \
710
	for i in $(srclink_files); do \
711
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
712
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
713
		fi; \
714
	done
715
	touch $@
716

    
717
.PHONY: ganeti
718
ganeti:
719
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
720

    
721
.PHONY: check-dirs
722
check-dirs: $(BUILT_SOURCES)
723
	@set -e; \
724
	find . -type d \( \( -name . \) -o \( \
725
		-name .git -o \
726
		-name autom4te.cache \
727
		\) -prune -o -print \) | { \
728
		error=; \
729
		while read dir; do \
730
			case "$$dir" in \
731
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
732
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
733
			esac; \
734
		done; \
735
		for dir in $(DIRS); do \
736
			if ! test -d "$$dir"; then \
737
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
738
				error=1; \
739
			fi \
740
		done; \
741
		if test -n "$$error"; then exit 1; else exit 0; fi; \
742
	}
743

    
744
check-local: check-dirs
745
	$(CHECK_PYTHON_CODE) $(check_python_code)
746

    
747
.PHONY: lint
748
lint: $(BUILT_SOURCES)
749
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
750
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
751

    
752
# a dist hook rule for updating the vcs-version file; this is
753
# hardcoded due to where it needs to build the file...
754
dist-hook:
755
	$(MAKE) regen-vcs-version && \
756
	rm -f $(top_distdir)/vcs-version && \
757
	cp -p $(srcdir)/vcs-version $(top_distdir)
758

    
759
# a distcheck hook rule for catching revision control directories
760
distcheck-hook:
761
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
762
		echo "Found revision control files in final archive." 1>&2; \
763
		exit 1; \
764
	fi
765
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
766
		echo "Found Python byte code in final archive." 1>&2; \
767
		exit 1; \
768
	fi
769
	if find $(top_distdir) -name '*~' | grep .; then \
770
		echo "Found backup files in final archive." 1>&2; \
771
		exit 1; \
772
	fi
773
# Empty files or directories should not be distributed. They can cause
774
# unnecessary warnings for packagers. Directories used by automake during
775
# distcheck must be excluded.
776
	if find $(top_distdir) -empty -and -not \( \
777
			-path $(top_distdir)/_build -or \
778
			-path $(top_distdir)/_inst \) | grep .; then \
779
		echo "Found empty files or directories in final archive." 1>&2; \
780
		exit 1; \
781
	fi
782
	if test -n "$(BUILD_RELEASE)" && \
783
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
784
		echo "Found unreleased version in NEWS." >&2; \
785
		exit 1; \
786
	fi
787

    
788
# When building a release, stricter checks should be used
789
distcheck-release dist-release: export BUILD_RELEASE = 1
790
distcheck-release: distcheck
791

    
792
dist-release: dist
793
	set -e; \
794
	for i in $(DIST_ARCHIVES); do \
795
		echo -n "Checking $$i ... "; \
796
		autotools/check-tar < $$i; \
797
		echo OK; \
798
	done
799

    
800
install-exec-local:
801
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
802
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
803
	  "$(DESTDIR)${localstatedir}/run/ganeti"
804

    
805
# To avoid conflicts between directory names and other targets, a file inside
806
# the directory is used to ensure its existence.
807
%.dir:
808
	@mkdir_p@ $* && touch $@
809

    
810
.PHONY: apidoc
811
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
812
	$(RUN_IN_TEMPDIR) epydoc -v \
813
		--conf $(CURDIR)/epydoc.conf \
814
		--output $(CURDIR)/doc/api
815

    
816
.PHONY: TAGS
817
TAGS: $(BUILT_SOURCES)
818
	rm -f TAGS
819
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
820
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
821
	  -path './qa/*.py' | \
822
	  etags -l python -
823

    
824
.PHONY: coverage
825
coverage: $(BUILT_SOURCES) $(python_tests)
826
	set -e; \
827
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
828
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
829
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
830
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
831
	$(python_tests)
832

    
833
commit-check: distcheck lint apidoc
834

    
835
-include ./Makefile.local
836

    
837
# vim: set noet :