Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 4ca96421

History | View | Annotate | Download (22 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/query.py \
142
	lib/rpc.py \
143
	lib/runtime.py \
144
	lib/serializer.py \
145
	lib/ssconf.py \
146
	lib/ssh.py \
147
	lib/storage.py \
148
	lib/utils.py \
149
	lib/uidpool.py \
150
	lib/workerpool.py
151

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

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

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

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

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

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

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

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

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

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

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

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

    
246
doc/html: doc/html/index.html
247

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

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

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

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

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

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

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

    
306
dist_sbin_SCRIPTS =
307

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

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

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

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

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

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

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

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

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

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

    
469
nodist_TESTS =
470

    
471
TESTS = $(dist_TESTS) $(nodist_TESTS)
472

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

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

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

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

    
506
check_python_code = \
507
	$(BUILD_BASH_COMPLETION) \
508
	$(all_python_code)
509

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

    
519
test/daemon-util_unittest.bash: daemons/daemon-util
520

    
521
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
522

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

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

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

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

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

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

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

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

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

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

    
568

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

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

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

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

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

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

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

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

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

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

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

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

    
746
check-local: check-dirs
747
	$(CHECK_PYTHON_CODE) $(check_python_code)
748

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

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

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

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

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

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

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

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

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

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

    
835
commit-check: distcheck lint apidoc
836

    
837
-include ./Makefile.local
838

    
839
# vim: set noet :