Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 35dd762d

History | View | Annotate | Download (21.7 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
	vcs-version
83

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

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

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

    
115
nodist_pkgpython_PYTHON = \
116
	lib/_autoconf.py
117

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

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

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

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

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

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

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

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

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

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

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

    
209
docrst = \
210
	doc/admin.rst \
211
	doc/design-2.0.rst \
212
	doc/design-2.1.rst \
213
	doc/design-2.2.rst \
214
	doc/design-2.3.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/upgrade.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/check-version \
340
	autotools/docbook-wrapper \
341
	autotools/gen-coverage \
342
	autotools/testrunner \
343
	$(RUN_IN_TEMPDIR) \
344
	daemons/daemon-util.in \
345
	daemons/ensure-dirs.in \
346
	daemons/ganeti-cleaner.in \
347
	$(pkglib_python_scripts) \
348
	devel/upload.in \
349
	$(docdot) \
350
	$(docpng) \
351
	$(docrst) \
352
	doc/conf.py \
353
	doc/html \
354
	doc/examples/ganeti.initd.in \
355
	doc/examples/ganeti.cron.in \
356
	doc/examples/gnt-config-backup.in \
357
	doc/examples/dumb-allocator \
358
	doc/examples/ganeti.default \
359
	doc/examples/ganeti.default-debug \
360
	doc/examples/hooks/ethers \
361
	doc/examples/hooks/ipsec.in \
362
	doc/examples/gnt-debug/README \
363
	doc/examples/gnt-debug/delay0.json \
364
	doc/examples/gnt-debug/delay50.json \
365
	test/testutils.py \
366
	test/mocks.py \
367
	$(dist_TESTS) \
368
	$(TEST_FILES) \
369
	man/footer.sgml \
370
	$(mansgml) \
371
	$(maninput) \
372
	qa/ganeti-qa.py \
373
	qa/qa-sample.json \
374
	qa/qa_cluster.py \
375
	qa/qa_config.py \
376
	qa/qa_daemon.py \
377
	qa/qa_env.py \
378
	qa/qa_error.py \
379
	qa/qa_instance.py \
380
	qa/qa_node.py \
381
	qa/qa_os.py \
382
	qa/qa_rapi.py \
383
	qa/qa_tags.py \
384
	qa/qa_utils.py
385

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

    
403
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
404
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
405
maninput = \
406
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
407
	$(patsubst %.html,%.html.in,$(manhtml))
408

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

    
422
python_tests = \
423
	test/ganeti.asyncnotifier_unittest.py \
424
	test/ganeti.backend_unittest.py \
425
	test/ganeti.bdev_unittest.py \
426
	test/ganeti.cli_unittest.py \
427
	test/ganeti.daemon_unittest.py \
428
	test/ganeti.cmdlib_unittest.py \
429
	test/ganeti.compat_unittest.py \
430
	test/ganeti.confd.client_unittest.py \
431
	test/ganeti.config_unittest.py \
432
	test/ganeti.constants_unittest.py \
433
	test/ganeti.errors_unittest.py \
434
	test/ganeti.hooks_unittest.py \
435
	test/ganeti.http_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.rapi.client_unittest.py \
447
	test/ganeti.rapi.resources_unittest.py \
448
	test/ganeti.rapi.rlib2_unittest.py \
449
	test/ganeti.rpc_unittest.py \
450
	test/ganeti.runtime_unittest.py \
451
	test/ganeti.serializer_unittest.py \
452
	test/ganeti.ssh_unittest.py \
453
	test/ganeti.uidpool_unittest.py \
454
	test/ganeti.utils_unittest.py \
455
	test/ganeti.utils_mlockall_unittest.py \
456
	test/ganeti.workerpool_unittest.py \
457
	test/cfgupgrade_unittest.py \
458
	test/docs_unittest.py \
459
	test/tempfile_fork_unittest.py
460

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

    
468
nodist_TESTS =
469

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
544
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
545
	@test -n "$(DOCBOOK2MAN)" || \
546
	  { echo 'docbook2man' not found during configure; exit 1; }
547
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
548
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
549

    
550
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
551
	@test -n "$(DOCBOOK2HTML)" || \
552
	  { echo 'docbook2html' not found during configure; exit 1; }
553
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
554

    
555
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
556
	sed -f $(REPLACE_VARS_SED) < $< > $@
557

    
558
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
559
	sed -f $(REPLACE_VARS_SED) < $< > $@
560

    
561
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
562
	sed -f $(REPLACE_VARS_SED) < $< > $@
563

    
564
vcs-version:
565
	if test -d .git; then \
566
	  git describe > $@; \
567
	elif test ! -f $@ ; then \
568
	  echo "Cannot auto-generate $@ file"; exit 1; \
569
	fi
570

    
571
.PHONY: regen-vcs-version
572
regen-vcs-version:
573
	set -e; \
574
	cd $(srcdir); \
575
	if test -d .git; then \
576
	  rm -f vcs-version; \
577
	  $(MAKE) vcs-version; \
578
	fi
579

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

    
637
$(REPLACE_VARS_SED): Makefile
638
	set -e; \
639
	{ echo 's#@PREFIX@#$(prefix)#g'; \
640
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
641
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
642
	  echo 's#@BINDIR@#$(bindir)#g'; \
643
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
644
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
645
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
646
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
647
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
648
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
649
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
650
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
651
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
652
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
653
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
654
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
655
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
656
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
657
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
658
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
659
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
660
	} > $@
661

    
662
# Using deferred evaluation
663
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
664
daemons/ganeti-watcher: MODULE = ganeti.watcher
665
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
666

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

    
692
# We need to create symlinks because "make distcheck" will not install Python
693
# files when building.
694
stamp-srclinks: Makefile | $(all_dirfiles)
695
	set -e; \
696
	for i in $(srclink_files); do \
697
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
698
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
699
		fi; \
700
	done
701
	touch $@
702

    
703
.PHONY: ganeti
704
ganeti:
705
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
706

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

    
730
check-local: check-dirs
731
	$(CHECK_PYTHON_CODE) $(check_python_code)
732
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
733

    
734
.PHONY: lint
735
lint: $(BUILT_SOURCES)
736
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
737
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
738

    
739
# a dist hook rule for updating the vcs-version file; this is
740
# hardcoded due to where it needs to build the file...
741
dist-hook:
742
	$(MAKE) regen-vcs-version && \
743
	rm -f $(top_distdir)/vcs-version && \
744
	cp -p $(srcdir)/vcs-version $(top_distdir)
745

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

    
775
# When building a release, stricter checks should be used
776
distcheck-release dist-release: export BUILD_RELEASE = 1
777
distcheck-release: distcheck
778

    
779
dist-release: dist
780
	set -e; \
781
	for i in $(DIST_ARCHIVES); do \
782
		echo -n "Checking $$i ... "; \
783
		autotools/check-tar < $$i; \
784
		echo OK; \
785
	done
786

    
787
install-exec-local:
788
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
789
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
790
	  "$(DESTDIR)${localstatedir}/run/ganeti"
791

    
792
# To avoid conflicts between directory names and other targets, a file inside
793
# the directory is used to ensure its existence.
794
%.dir:
795
	@mkdir_p@ $* && touch $@
796

    
797
.PHONY: apidoc
798
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
799
	$(RUN_IN_TEMPDIR) epydoc -v \
800
		--conf $(CURDIR)/epydoc.conf \
801
		--output $(CURDIR)/doc/api
802

    
803
.PHONY: TAGS
804
TAGS: $(BUILT_SOURCES)
805
	rm -f TAGS
806
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
807
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
808
	  -path './qa/*.py' | \
809
	  etags -l python -
810

    
811
.PHONY: coverage
812
coverage: $(BUILT_SOURCES) $(python_tests)
813
	set -e; \
814
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
815
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
816
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
817
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
818
	$(python_tests)
819

    
820
commit-check: distcheck lint apidoc
821

    
822
-include ./Makefile.local
823

    
824
# vim: set noet :