Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 7a03d293

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
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
CHECK_VERSION = $(top_srcdir)/autotools/check-version
19
REPLACE_VARS_SED = autotools/replace_vars.sed
20

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

    
33
# Delete output file if an error occurred while building it
34
.DELETE_ON_ERROR:
35

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

    
61
BUILDTIME_DIR_AUTOCREATE = \
62
	scripts \
63
	doc/api \
64
	doc/coverage
65

    
66
BUILDTIME_DIRS = \
67
	$(BUILDTIME_DIR_AUTOCREATE) \
68
	doc/html
69

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

    
75
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
76

    
77
MAINTAINERCLEANFILES = \
78
	$(docpng) \
79
	$(maninput) \
80
	doc/install-quick.rst \
81
	doc/news.rst \
82
	doc/upgrade.rst \
83
	vcs-version
84

    
85
maintainer-clean-local:
86
	rm -rf $(BUILDTIME_DIRS)
87

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

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

    
116
nodist_pkgpython_PYTHON = \
117
	lib/_autoconf.py
118

    
119
noinst_PYTHON = \
120
	lib/build/__init__.py
121

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

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

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

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

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

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

    
193
masterd_PYTHON = \
194
	lib/masterd/__init__.py \
195
	lib/masterd/instance.py
196

    
197
impexpd_PYTHON = \
198
	lib/impexpd/__init__.py
199

    
200
watcher_PYTHON = \
201
	lib/watcher/__init__.py
202

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

    
210
docrst = \
211
	doc/admin.rst \
212
	doc/design-2.0.rst \
213
	doc/design-2.1.rst \
214
	doc/design-2.2.rst \
215
	doc/design-2.3.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/upgrade.rst \
230
	doc/walkthrough.rst
231

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

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

    
247
doc/html: doc/html/index.html
248

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

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

    
265
doc/upgrade.rst: UPGRADE
266
	set -e; \
267
	{ echo '.. This file is automatically updated at build time from $<.'; \
268
	  echo '.. Do not edit.'; \
269
	  echo; \
270
	  cat $<; \
271
	} > $@
272

    
273
docdot = \
274
	doc/arch-2.0.dot \
275
	doc/design-2.1-lock-acquire.dot \
276
	doc/design-2.1-lock-release.dot
277

    
278
docpng = $(patsubst %.dot,%.png,$(docdot))
279

    
280
# Things to build but not to install (add it to EXTRA_DIST if it should be
281
# distributed)
282
noinst_DATA = \
283
	devel/upload \
284
	doc/html \
285
	doc/examples/bash_completion \
286
	doc/examples/ganeti.cron \
287
	doc/examples/ganeti.initd \
288
	doc/examples/gnt-config-backup \
289
	doc/examples/hooks/ipsec \
290
	$(manhtml)
291

    
292
gnt_scripts = \
293
	scripts/gnt-backup \
294
	scripts/gnt-cluster \
295
	scripts/gnt-debug \
296
	scripts/gnt-instance \
297
	scripts/gnt-job \
298
	scripts/gnt-node \
299
	scripts/gnt-os
300

    
301
PYTHON_BOOTSTRAP = \
302
	daemons/ganeti-confd \
303
	daemons/ganeti-masterd \
304
	daemons/ganeti-noded \
305
	daemons/ganeti-watcher \
306
	daemons/ganeti-rapi \
307
	scripts/gnt-backup \
308
	scripts/gnt-cluster \
309
	scripts/gnt-debug \
310
	scripts/gnt-instance \
311
	scripts/gnt-job \
312
	scripts/gnt-node \
313
	scripts/gnt-os
314

    
315
dist_sbin_SCRIPTS =
316

    
317
nodist_sbin_SCRIPTS = \
318
	$(PYTHON_BOOTSTRAP) \
319
	daemons/ganeti-cleaner
320

    
321
dist_tools_SCRIPTS = \
322
	tools/burnin \
323
	tools/cfgshell \
324
	tools/cfgupgrade \
325
	tools/cfgupgrade12 \
326
	tools/cluster-merge \
327
	tools/lvmstrap \
328
	tools/move-instance \
329
	tools/setup-ssh \
330
	tools/sanitize-config
331

    
332
pkglib_python_scripts = \
333
	daemons/import-export \
334
	tools/check-cert-expired
335

    
336
pkglib_SCRIPTS = \
337
	daemons/daemon-util \
338
	daemons/ensure-dirs \
339
	$(pkglib_python_scripts)
340

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

    
396
man_MANS = \
397
	man/ganeti.7 \
398
	man/ganeti-cleaner.8 \
399
	man/ganeti-confd.8 \
400
	man/ganeti-masterd.8 \
401
	man/ganeti-noded.8 \
402
	man/ganeti-os-interface.7 \
403
	man/ganeti-rapi.8 \
404
	man/ganeti-watcher.8 \
405
	man/gnt-backup.8 \
406
	man/gnt-cluster.8 \
407
	man/gnt-debug.8 \
408
	man/gnt-instance.8 \
409
	man/gnt-job.8 \
410
	man/gnt-node.8 \
411
	man/gnt-os.8
412

    
413
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
414
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
415
maninput = \
416
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
417
	$(patsubst %.html,%.html.in,$(manhtml))
418

    
419
TEST_FILES = \
420
	test/data/bdev-drbd-8.0.txt \
421
	test/data/bdev-drbd-8.3.txt \
422
	test/data/bdev-drbd-disk.txt \
423
	test/data/bdev-drbd-net-ip4.txt \
424
	test/data/bdev-drbd-net-ip6.txt \
425
	test/data/cert1.pem \
426
	test/data/proc_drbd8.txt \
427
	test/data/proc_drbd80-emptyline.txt \
428
	test/data/proc_drbd83.txt \
429
	test/data/sys_drbd_usermode_helper.txt \
430
	test/import-export_unittest-helper
431

    
432
python_tests = \
433
	test/ganeti.asyncnotifier_unittest.py \
434
	test/ganeti.backend_unittest.py \
435
	test/ganeti.bdev_unittest.py \
436
	test/ganeti.cli_unittest.py \
437
	test/ganeti.daemon_unittest.py \
438
	test/ganeti.cmdlib_unittest.py \
439
	test/ganeti.compat_unittest.py \
440
	test/ganeti.confd.client_unittest.py \
441
	test/ganeti.config_unittest.py \
442
	test/ganeti.constants_unittest.py \
443
	test/ganeti.errors_unittest.py \
444
	test/ganeti.hooks_unittest.py \
445
	test/ganeti.http_unittest.py \
446
	test/ganeti.hypervisor.hv_kvm_unittest.py \
447
	test/ganeti.impexpd_unittest.py \
448
	test/ganeti.jqueue_unittest.py \
449
	test/ganeti.locking_unittest.py \
450
	test/ganeti.luxi_unittest.py \
451
	test/ganeti.masterd.instance_unittest.py \
452
	test/ganeti.mcpu_unittest.py \
453
	test/ganeti.netutils_unittest.py \
454
	test/ganeti.objects_unittest.py \
455
	test/ganeti.opcodes_unittest.py \
456
	test/ganeti.rapi.client_unittest.py \
457
	test/ganeti.rapi.resources_unittest.py \
458
	test/ganeti.rapi.rlib2_unittest.py \
459
	test/ganeti.rpc_unittest.py \
460
	test/ganeti.runtime_unittest.py \
461
	test/ganeti.serializer_unittest.py \
462
	test/ganeti.ssh_unittest.py \
463
	test/ganeti.uidpool_unittest.py \
464
	test/ganeti.utils_unittest.py \
465
	test/ganeti.utils_mlockall_unittest.py \
466
	test/ganeti.workerpool_unittest.py \
467
	test/cfgupgrade_unittest.py \
468
	test/docs_unittest.py \
469
	test/tempfile_fork_unittest.py
470

    
471
dist_TESTS = \
472
	test/check-cert-expired_unittest.bash \
473
	test/daemon-util_unittest.bash \
474
	test/ganeti-cleaner_unittest.bash \
475
	test/import-export_unittest.bash \
476
	$(python_tests)
477

    
478
nodist_TESTS =
479

    
480
TESTS = $(dist_TESTS) $(nodist_TESTS)
481

    
482
# Environment for all tests
483
PLAIN_TESTS_ENVIRONMENT = \
484
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
485

    
486
# Environment for tests run by automake
487
TESTS_ENVIRONMENT = \
488
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
489

    
490
all_python_code = \
491
	$(dist_sbin_SCRIPTS) \
492
	$(dist_tools_SCRIPTS) \
493
	$(pkglib_python_scripts) \
494
	$(python_tests) \
495
	$(pkgpython_PYTHON) \
496
	$(client_PYTHON) \
497
	$(hypervisor_PYTHON) \
498
	$(rapi_PYTHON) \
499
	$(server_PYTHON) \
500
	$(http_PYTHON) \
501
	$(confd_PYTHON) \
502
	$(masterd_PYTHON) \
503
	$(impexpd_PYTHON) \
504
	$(watcher_PYTHON) \
505
	$(noinst_PYTHON)
506

    
507
srclink_files = \
508
	man/footer.sgml \
509
	test/check-cert-expired_unittest.bash \
510
	test/daemon-util_unittest.bash \
511
	test/ganeti-cleaner_unittest.bash \
512
	test/import-export_unittest.bash \
513
	$(all_python_code)
514

    
515
check_python_code = \
516
	$(BUILD_BASH_COMPLETION) \
517
	$(all_python_code)
518

    
519
lint_python_code = \
520
	ganeti \
521
	ganeti/http/server.py \
522
	$(dist_sbin_SCRIPTS) \
523
	$(dist_tools_SCRIPTS) \
524
	$(pkglib_python_scripts) \
525
	$(BUILD_BASH_COMPLETION) \
526
	$(PYTHON_BOOTSTRAP)
527

    
528
test/daemon-util_unittest.bash: daemons/daemon-util
529

    
530
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
531

    
532
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
533
	sed -f $(REPLACE_VARS_SED) < $< > $@
534
	chmod u+x $@
535

    
536
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
537
	sed -f $(REPLACE_VARS_SED) < $< > $@
538
	chmod +x $@
539

    
540
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
541
	sed -f $(REPLACE_VARS_SED) < $< > $@
542

    
543
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
544
	sed -f $(REPLACE_VARS_SED) < $< > $@
545

    
546
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
547
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
548
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
549

    
550
doc/%.png: doc/%.dot
551
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
552
	$(DOT) -Tpng -o $@ $<
553

    
554
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
555
	@test -n "$(DOCBOOK2MAN)" || \
556
	  { echo 'docbook2man' not found during configure; exit 1; }
557
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
558
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
559

    
560
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
561
	@test -n "$(DOCBOOK2HTML)" || \
562
	  { echo 'docbook2html' not found during configure; exit 1; }
563
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
564

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

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

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

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

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

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

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

    
672
# Using deferred evaluation
673
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
674
daemons/ganeti-watcher: MODULE = ganeti.watcher
675
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
676

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

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

    
713
.PHONY: ganeti
714
ganeti:
715
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
716

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

    
740
check-local: check-dirs
741
	$(CHECK_PYTHON_CODE) $(check_python_code)
742
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
743

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

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

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

    
785
# When building a release, stricter checks should be used
786
distcheck-release dist-release: export BUILD_RELEASE = 1
787
distcheck-release: distcheck
788

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

    
797
install-exec-local:
798
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
799
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
800
	  "$(DESTDIR)${localstatedir}/run/ganeti"
801

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

    
807
.PHONY: apidoc
808
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
809
	$(RUN_IN_TEMPDIR) epydoc -v \
810
		--conf $(CURDIR)/epydoc.conf \
811
		--output $(CURDIR)/doc/api
812

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

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

    
830
commit-check: distcheck lint apidoc
831

    
832
-include ./Makefile.local
833

    
834
# vim: set noet :