Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ de8eea3e

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

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

    
402
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
403
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
404
maninput = \
405
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
406
	$(patsubst %.html,%.html.in,$(manhtml)) \
407
	man/footer.man
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 man/footer.rst \
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/footer.man: man/footer.rst
545
	@test -n "$(PANDOC)" || \
546
	  { echo 'pandoc' not found during configure; exit 1; }
547
	$(PANDOC) -f rst -t man -o $@ $<
548

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

    
555
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
556
	@test -n "$(DOCBOOK2HTML)" || \
557
	  { echo 'docbook2html' not found during configure; exit 1; }
558
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
559

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

    
563
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
564
	sed -f $(REPLACE_VARS_SED) < $< > $@
565

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

    
569
vcs-version:
570
	if test -d .git; then \
571
	  git describe > $@; \
572
	elif test ! -f $@ ; then \
573
	  echo "Cannot auto-generate $@ file"; exit 1; \
574
	fi
575

    
576
.PHONY: regen-vcs-version
577
regen-vcs-version:
578
	set -e; \
579
	cd $(srcdir); \
580
	if test -d .git; then \
581
	  rm -f vcs-version; \
582
	  $(MAKE) vcs-version; \
583
	fi
584

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

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

    
667
# Using deferred evaluation
668
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
669
daemons/ganeti-watcher: MODULE = ganeti.watcher
670
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
671

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

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

    
708
.PHONY: ganeti
709
ganeti:
710
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
711

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

    
735
check-local: check-dirs
736
	$(CHECK_PYTHON_CODE) $(check_python_code)
737

    
738
.PHONY: lint
739
lint: $(BUILT_SOURCES)
740
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
741
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
742

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

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

    
779
# When building a release, stricter checks should be used
780
distcheck-release dist-release: export BUILD_RELEASE = 1
781
distcheck-release: distcheck
782

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

    
791
install-exec-local:
792
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
793
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
794
	  "$(DESTDIR)${localstatedir}/run/ganeti"
795

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

    
801
.PHONY: apidoc
802
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
803
	$(RUN_IN_TEMPDIR) epydoc -v \
804
		--conf $(CURDIR)/epydoc.conf \
805
		--output $(CURDIR)/doc/api
806

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

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

    
824
commit-check: distcheck lint apidoc
825

    
826
-include ./Makefile.local
827

    
828
# vim: set noet :