Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 667dbd6b

History | View | Annotate | Download (22.2 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
CHECK_VERSION = $(top_srcdir)/autotools/check-version
18
REPLACE_VARS_SED = autotools/replace_vars.sed
19

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

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

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

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

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

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

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

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

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

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

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

    
114
nodist_pkgpython_PYTHON = \
115
	lib/_autoconf.py
116

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

    
120
pkgpython_PYTHON = \
121
	lib/__init__.py \
122
	lib/asyncnotifier.py \
123
	lib/backend.py \
124
	lib/bdev.py \
125
	lib/bootstrap.py \
126
	lib/cli.py \
127
	lib/cmdlib.py \
128
	lib/compat.py \
129
	lib/config.py \
130
	lib/constants.py \
131
	lib/daemon.py \
132
	lib/errors.py \
133
	lib/ht.py \
134
	lib/jqueue.py \
135
	lib/jstore.py \
136
	lib/locking.py \
137
	lib/luxi.py \
138
	lib/mcpu.py \
139
	lib/netutils.py \
140
	lib/objects.py \
141
	lib/opcodes.py \
142
	lib/qlang.py \
143
	lib/query.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_group.py \
160
	lib/client/gnt_instance.py \
161
	lib/client/gnt_job.py \
162
	lib/client/gnt_node.py \
163
	lib/client/gnt_os.py
164

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

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

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

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

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

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

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

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

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

    
234
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
235

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

    
249
doc/html: doc/html/index.html
250

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

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

    
267
docdot = \
268
	doc/arch-2.0.dot \
269
	doc/design-2.1-lock-acquire.dot \
270
	doc/design-2.1-lock-release.dot
271

    
272
docpng = $(patsubst %.dot,%.png,$(docdot))
273

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

    
286
gnt_scripts = \
287
	scripts/gnt-backup \
288
	scripts/gnt-cluster \
289
	scripts/gnt-debug \
290
	scripts/gnt-group \
291
	scripts/gnt-instance \
292
	scripts/gnt-job \
293
	scripts/gnt-node \
294
	scripts/gnt-os
295

    
296
PYTHON_BOOTSTRAP = \
297
	daemons/ganeti-confd \
298
	daemons/ganeti-masterd \
299
	daemons/ganeti-noded \
300
	daemons/ganeti-watcher \
301
	daemons/ganeti-rapi \
302
	scripts/gnt-backup \
303
	scripts/gnt-cluster \
304
	scripts/gnt-debug \
305
	scripts/gnt-group \
306
	scripts/gnt-instance \
307
	scripts/gnt-job \
308
	scripts/gnt-node \
309
	scripts/gnt-os
310

    
311
dist_sbin_SCRIPTS =
312

    
313
nodist_sbin_SCRIPTS = \
314
	$(PYTHON_BOOTSTRAP) \
315
	daemons/ganeti-cleaner
316

    
317
dist_tools_SCRIPTS = \
318
	tools/burnin \
319
	tools/cfgshell \
320
	tools/cfgupgrade \
321
	tools/cfgupgrade12 \
322
	tools/cluster-merge \
323
	tools/lvmstrap \
324
	tools/move-instance \
325
	tools/setup-ssh \
326
	tools/sanitize-config
327

    
328
pkglib_python_scripts = \
329
	daemons/import-export \
330
	tools/check-cert-expired
331

    
332
pkglib_SCRIPTS = \
333
	daemons/daemon-util \
334
	daemons/ensure-dirs \
335
	$(pkglib_python_scripts)
336

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

    
390
man_MANS = \
391
	man/ganeti.7 \
392
	man/ganeti-cleaner.8 \
393
	man/ganeti-confd.8 \
394
	man/ganeti-masterd.8 \
395
	man/ganeti-noded.8 \
396
	man/ganeti-os-interface.7 \
397
	man/ganeti-rapi.8 \
398
	man/ganeti-watcher.8 \
399
	man/gnt-backup.8 \
400
	man/gnt-cluster.8 \
401
	man/gnt-debug.8 \
402
	man/gnt-group.8 \
403
	man/gnt-instance.8 \
404
	man/gnt-job.8 \
405
	man/gnt-node.8 \
406
	man/gnt-os.8
407

    
408
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
409
manhtml = $(patsubst %.rst,%.html,$(manrst))
410
maninput = \
411
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
412
	$(patsubst %.html,%.html.in,$(manhtml)) \
413
	man/footer.man man/footer.html
414

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

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

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

    
477
nodist_TESTS =
478

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
558
man/footer.html: man/footer.rst
559
	@test -n "$(PANDOC)" || \
560
	  { echo 'pandoc' not found during configure; exit 1; }
561
	$(PANDOC) -f rst -t html -o $@ $<
562

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

    
570
man/%.html.in: man/%.rst man/footer.html
571
	@test -n "$(PANDOC)" || \
572
	  { echo 'pandoc' not found during configure; exit 1; }
573
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
574
	  sed -e 's/\\@/@/g' > $@
575

    
576

    
577
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
578
	sed -f $(REPLACE_VARS_SED) < $< > $@
579

    
580
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
581
	sed -f $(REPLACE_VARS_SED) < $< > $@
582

    
583
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
584
	sed -f $(REPLACE_VARS_SED) < $< > $@
585

    
586
vcs-version:
587
	if test -d .git; then \
588
	  git describe > $@; \
589
	elif test ! -f $@ ; then \
590
	  echo "Cannot auto-generate $@ file"; exit 1; \
591
	fi
592

    
593
.PHONY: regen-vcs-version
594
regen-vcs-version:
595
	set -e; \
596
	cd $(srcdir); \
597
	if test -d .git; then \
598
	  rm -f vcs-version; \
599
	  $(MAKE) vcs-version; \
600
	fi
601

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

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

    
686
# Using deferred evaluation
687
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
688
daemons/ganeti-watcher: MODULE = ganeti.watcher
689
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
690

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

    
716
# We need to create symlinks because "make distcheck" will not install Python
717
# files when building.
718
stamp-srclinks: Makefile | $(all_dirfiles)
719
	set -e; \
720
	for i in $(srclink_files); do \
721
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
722
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
723
		fi; \
724
	done
725
	touch $@
726

    
727
.PHONY: ganeti
728
ganeti:
729
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
730

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

    
754
check-local: check-dirs
755
	$(CHECK_PYTHON_CODE) $(check_python_code)
756
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
757

    
758
.PHONY: lint
759
lint: $(BUILT_SOURCES)
760
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
761
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
762

    
763
# a dist hook rule for updating the vcs-version file; this is
764
# hardcoded due to where it needs to build the file...
765
dist-hook:
766
	$(MAKE) regen-vcs-version && \
767
	rm -f $(top_distdir)/vcs-version && \
768
	cp -p $(srcdir)/vcs-version $(top_distdir)
769

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

    
799
# When building a release, stricter checks should be used
800
distcheck-release dist-release: export BUILD_RELEASE = 1
801
distcheck-release: distcheck
802

    
803
dist-release: dist
804
	set -e; \
805
	for i in $(DIST_ARCHIVES); do \
806
		echo -n "Checking $$i ... "; \
807
		autotools/check-tar < $$i; \
808
		echo OK; \
809
	done
810

    
811
install-exec-local:
812
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
813
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
814
	  "$(DESTDIR)${localstatedir}/run/ganeti"
815

    
816
# To avoid conflicts between directory names and other targets, a file inside
817
# the directory is used to ensure its existence.
818
%.dir:
819
	@mkdir_p@ $* && touch $@
820

    
821
.PHONY: apidoc
822
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
823
	$(RUN_IN_TEMPDIR) epydoc -v \
824
		--conf $(CURDIR)/epydoc.conf \
825
		--output $(CURDIR)/doc/api
826

    
827
.PHONY: TAGS
828
TAGS: $(BUILT_SOURCES)
829
	rm -f TAGS
830
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
831
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
832
	  -path './qa/*.py' | \
833
	  etags -l python -
834

    
835
.PHONY: coverage
836
coverage: $(BUILT_SOURCES) $(python_tests)
837
	set -e; \
838
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
839
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
840
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
841
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
842
	$(python_tests)
843

    
844
commit-check: distcheck lint apidoc
845

    
846
-include ./Makefile.local
847

    
848
# vim: set noet :