Makefile.am 14.7 KB
Newer Older
1
2
3
4
5
# Ganeti makefile
# - Indent with tabs only.
# - Keep files sorted; one line per file.
# - Directories in lib/ must have their own *dir variable (see hypervisor).
# - All directories must be listed DIRS.
Michael Hanselmann's avatar
Michael Hanselmann committed
6
# - Use autogen.sh to generate Makefile.in and configure script.
7
8
9
10
11

# Automake doesn't export these variables before version 1.10.
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@

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
19
20
REPLACE_VARS_SED = autotools/replace_vars.sed

hypervisordir = $(pkgpythondir)/hypervisor
21
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
22
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
23
confddir = $(pkgpythondir)/confd
24
rapidir = $(pkgpythondir)/rapi
25
26
27
toolsdir = $(pkglibdir)/tools
docdir = $(datadir)/doc/$(PACKAGE)

28
29
30
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

31
32
33
34
35
36
DIRS = \
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
Guido Trotter's avatar
Guido Trotter committed
37
	doc/examples/hooks \
38
	lib \
39
	lib/build \
40
	lib/confd \
41
	lib/http \
42
	lib/hypervisor \
Michael Hanselmann's avatar
Michael Hanselmann committed
43
	lib/masterd \
44
	lib/rapi \
45
46
47
48
49
50
51
	man \
	qa \
	scripts \
	test \
	test/data \
	tools

Iustin Pop's avatar
Iustin Pop committed
52
MAINTAINERCLEANFILES = \
53
	$(docpng) \
54
	$(maninput) \
55
	doc/install-quick.rst \
56
	doc/news.rst
Iustin Pop's avatar
Iustin Pop committed
57

58
maintainer-clean-local:
59
	rm -rf doc/api doc/html doc/coverage
60

61
CLEANFILES = \
62
	$(addsuffix /*.py[co],$(DIRS)) \
63
	autotools/replace_vars.sed \
64
	daemons/daemon-util \
65
	daemons/ganeti-cleaner \
66
	devel/upload \
67
	doc/examples/bash_completion \
68
69
	doc/examples/ganeti.initd \
	doc/examples/ganeti.cron \
70
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
71
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
72
73
	$(man_MANS) \
	$(manhtml) \
74
	stamp-directories \
75
	stamp-srclinks \
76
77
	$(nodist_pkgpython_PYTHON)

78
79
BUILT_SOURCES = \
	ganeti \
80
	stamp-srclinks \
81
	stamp-directories \
82
83
	lib/_autoconf.py

84
85
86
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

87
88
89
noinst_PYTHON = \
	lib/build/__init__.py

90
91
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
92
	lib/asyncnotifier.py \
93
94
95
96
97
98
99
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
	lib/config.py \
	lib/constants.py \
100
	lib/daemon.py \
101
102
	lib/errors.py \
	lib/jqueue.py \
103
	lib/jstore.py \
104
105
106
107
108
109
110
111
112
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
	lib/objects.py \
	lib/opcodes.py \
	lib/rpc.py \
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
113
	lib/storage.py \
114
	lib/utils.py \
115
	lib/uidpool.py \
116
	lib/workerpool.py
117
118
119
120

hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
121
	lib/hypervisor/hv_chroot.py \
122
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
123
	lib/hypervisor/hv_kvm.py \
124
125
	lib/hypervisor/hv_xen.py

126
127
rapi_PYTHON = \
	lib/rapi/__init__.py \
128
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
129
	lib/rapi/client.py \
130
131
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
132

133
http_PYTHON = \
134
	lib/http/__init__.py \
135
	lib/http/auth.py \
136
137
	lib/http/client.py \
	lib/http/server.py
138

Guido Trotter's avatar
Guido Trotter committed
139
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
140
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
141
	lib/confd/client.py \
142
143
	lib/confd/querylib.py \
	lib/confd/server.py
144

Michael Hanselmann's avatar
Michael Hanselmann committed
145
146
147
masterd_PYTHON = \
	lib/masterd/__init__.py

Michael Hanselmann's avatar
Michael Hanselmann committed
148
docrst = \
149
	doc/admin.rst \
150
	doc/design-2.0.rst \
151
	doc/design-2.1.rst \
152
	doc/design-2.2.rst \
153
	doc/design-cluster-merger.rst \
154
	doc/devnotes.rst \
155
	doc/glossary.rst \
156
	doc/hooks.rst \
157
	doc/iallocator.rst \
158
	doc/index.rst \
159
	doc/install-quick.rst \
160
	doc/install.rst \
161
	doc/locking.rst \
Iustin Pop's avatar
Iustin Pop committed
162
	doc/news.rst \
163
	doc/rapi.rst \
164
	doc/security.rst \
Iustin Pop's avatar
Iustin Pop committed
165
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
166

167
doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
168
169
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
170
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
171
	    -d . \
172
173
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
174
175
176
177
178
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

doc/html: doc/html/.stamp
Iustin Pop's avatar
Iustin Pop committed
179

180
181
182
183
184
185
186
187
doc/news.rst: NEWS
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

188
189
190
191
192
193
194
195
doc/install-quick.rst: INSTALL
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

196
docdot = \
197
198
199
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
200

201
docpng = $(patsubst %.dot,%.png,$(docdot))
202

203
204
205
206
207
208
209
210
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
	doc/examples/bash_completion \
	doc/examples/ganeti.cron \
	doc/examples/ganeti.initd \
211
	doc/examples/gnt-config-backup \
212
213
	doc/examples/hooks/ipsec \
	$(manhtml)
214

215
gnt_scripts = \
216
217
218
219
220
221
222
223
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

224
225
226
227
228
229
230
231
dist_sbin_SCRIPTS = \
	daemons/ganeti-noded \
	daemons/ganeti-watcher \
	daemons/ganeti-masterd \
	daemons/ganeti-confd \
	daemons/ganeti-rapi \
	$(gnt_scripts)

232
233
234
nodist_sbin_SCRIPTS = \
	daemons/ganeti-cleaner

235
236
237
238
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
239
	tools/cfgupgrade12 \
240
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
241
242
	tools/lvmstrap \
	tools/sanitize-config
243

244
245
246
pkglib_python_scripts = \
	daemons/import-export

247
pkglib_SCRIPTS = \
248
249
	daemons/daemon-util \
	$(pkglib_python_scripts)
250

251
252
EXTRA_DIST = \
	NEWS \
Michael Hanselmann's avatar
Michael Hanselmann committed
253
	pylintrc \
254
	autotools/build-bash-completion \
255
	autotools/check-python-code \
256
	autotools/check-man \
257
	autotools/docbook-wrapper \
258
	autotools/gen-coverage \
259
	autotools/testrunner \
260
	$(RUN_IN_TEMPDIR) \
261
	daemons/daemon-util.in \
262
	daemons/ganeti-cleaner.in \
263
	$(pkglib_python_scripts) \
264
	devel/upload.in \
265
	$(docdot) \
266
	$(docpng) \
267
268
269
	$(docrst) \
	doc/conf.py \
	doc/html \
270
271
	doc/examples/ganeti.initd.in \
	doc/examples/ganeti.cron.in \
272
	doc/examples/gnt-config-backup.in \
273
	doc/examples/dumb-allocator \
274
275
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
276
	doc/examples/hooks/ethers \
Luca Bigliardi's avatar
Luca Bigliardi committed
277
	doc/examples/hooks/ipsec.in \
278
279
280
281
282
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
	man/footer.sgml \
283
284
	$(mansgml) \
	$(maninput) \
285
	qa/ganeti-qa.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
286
	qa/qa-sample.json \
287
288
289
290
291
292
293
294
	qa/qa_cluster.py \
	qa/qa_config.py \
	qa/qa_daemon.py \
	qa/qa_env.py \
	qa/qa_error.py \
	qa/qa_instance.py \
	qa/qa_node.py \
	qa/qa_os.py \
Oleksiy Mishchenko's avatar
Oleksiy Mishchenko committed
295
	qa/qa_rapi.py \
296
297
298
299
300
	qa/qa_tags.py \
	qa/qa_utils.py

man_MANS = \
	man/ganeti.7 \
301
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
302
	man/ganeti-confd.8 \
303
	man/ganeti-masterd.8 \
304
305
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
306
	man/ganeti-rapi.8 \
307
308
309
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
310
	man/gnt-debug.8 \
311
	man/gnt-instance.8 \
312
	man/gnt-job.8 \
313
314
315
	man/gnt-node.8 \
	man/gnt-os.8

Iustin Pop's avatar
Iustin Pop committed
316
317
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
318
319
320
maninput = \
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
	$(patsubst %.html,%.html.in,$(manhtml))
321
322
323

TEST_FILES = \
	test/data/bdev-both.txt \
324
	test/data/bdev-8.3-both.txt \
325
326
	test/data/bdev-disk.txt \
	test/data/bdev-net.txt \
327
	test/data/cert1.pem \
328
	test/data/proc_drbd8.txt \
329
	test/data/proc_drbd80-emptyline.txt \
330
331
	test/data/proc_drbd83.txt \
	test/import-export_unittest-helper
332

333
python_tests = \
334
	test/ganeti.backend_unittest.py \
335
336
337
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
	test/ganeti.cmdlib_unittest.py \
338
	test/ganeti.confd.client_unittest.py \
339
	test/ganeti.config_unittest.py \
340
	test/ganeti.constants_unittest.py \
341
	test/ganeti.errors_unittest.py \
342
	test/ganeti.hooks_unittest.py \
343
	test/ganeti.http_unittest.py \
344
	test/ganeti.locking_unittest.py \
345
	test/ganeti.luxi_unittest.py \
346
	test/ganeti.mcpu_unittest.py \
347
	test/ganeti.objects_unittest.py \
348
	test/ganeti.opcodes_unittest.py \
David Knowles's avatar
David Knowles committed
349
	test/ganeti.rapi.client_unittest.py \
350
	test/ganeti.rapi.resources_unittest.py \
351
352
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
353
	test/ganeti.uidpool_unittest.py \
354
	test/ganeti.utils_unittest.py \
355
	test/ganeti.workerpool_unittest.py \
356
357
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
358

359
dist_TESTS = \
360
	test/daemon-util_unittest.bash \
361
	test/import-export_unittest.bash \
362
363
	$(python_tests)

364
365
366
367
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

368
369
370
371
372
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
373
TESTS_ENVIRONMENT = \
374
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
375

376
all_python_code = \
377
378
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
379
	$(pkglib_python_scripts) \
380
	$(python_tests) \
381
382
383
384
385
	$(pkgpython_PYTHON) \
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
386
	$(masterd_PYTHON) \
387
388
	$(noinst_PYTHON)

389
390
srclink_files = \
	man/footer.sgml \
391
	test/daemon-util_unittest.bash \
392
	test/import-export_unittest.bash \
393
394
395
	$(all_python_code)

check_python_code = \
396
	$(BUILD_BASH_COMPLETION) \
397
398
	$(all_python_code)

399
lint_python_code = \
400
401
402
	ganeti \
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
403
	$(pkglib_python_scripts) \
404
	$(BUILD_BASH_COMPLETION)
405

406
407
test/daemon-util_unittest.bash: daemons/daemon-util

408
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
409
410
411
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

412
daemons/%: daemons/%.in \
413
414
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
415
	chmod +x $@
416

417
doc/examples/%: doc/examples/%.in \
418
419
420
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

421
doc/examples/hooks/%: doc/examples/hooks/%.in \
Luca Bigliardi's avatar
Luca Bigliardi committed
422
423
424
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

425
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
426
	lib/cli.py $(gnt_scripts) tools/burnin
427
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
428

429
doc/%.png: doc/%.dot
Iustin Pop's avatar
Iustin Pop committed
430
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
431
432
	$(DOT) -Tpng -o $@ $<

Iustin Pop's avatar
Iustin Pop committed
433
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
434
435
	@test -n "$(DOCBOOK2MAN)" || \
	  { echo 'docbook2man' not found during configure; exit 1; }
Michael Hanselmann's avatar
Michael Hanselmann committed
436
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
437
	$(CHECK_MAN) $@
Iustin Pop's avatar
Iustin Pop committed
438
439

man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
440
441
	@test -n "$(DOCBOOK2HTML)" || \
	  { echo 'docbook2html' not found during configure; exit 1; }
Michael Hanselmann's avatar
Michael Hanselmann committed
442
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
Iustin Pop's avatar
Iustin Pop committed
443

444
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
445
	sed -f $(REPLACE_VARS_SED) < $< > $@
446

447
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
448
	sed -f $(REPLACE_VARS_SED) < $< > $@
449

450
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
451
	sed -f $(REPLACE_VARS_SED) < $< > $@
452

453
454
455
456
lib/_autoconf.py: Makefile stamp-directories
	set -e; \
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
457
458
459
460
461
462
463
464
465
	  echo ''; \
	  echo '"""Build-time configuration for Ganeti.'; \
	  echo '';\
	  echo 'This file is autogenerated by the build process.'; \
	  echo 'For any changes you need to re-run ./configure (and'; \
	  echo 'not edit by hand).'; \
	  echo ''; \
	  echo '"""'; \
	  echo ''; \
466
467
468
469
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
470
471
472
473
474
475
476
477
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
478
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
479
480
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
481
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
482
483
484
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
485
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
486
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
487
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
488
489
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
490
491
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
	  echo "TOOLSDIR = '$(toolsdir)'"; \
492
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
493
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
494
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
495
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
496
497
	} > $@

498
$(REPLACE_VARS_SED): Makefile
499
500
501
502
	set -e; \
	{ echo 's#@PREFIX@#$(prefix)#g'; \
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
503
	  echo 's#@BINDIR@#$(bindir)#g'; \
504
505
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
506
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
507
508
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
509
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
510
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
Iustin Pop's avatar
Iustin Pop committed
511
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
512
513
514
515
	} > $@

# We need to create symlinks because "make distcheck" will not install Python
# files when building.
516
stamp-srclinks: Makefile stamp-directories
517
	set -e; \
518
	for i in $(srclink_files); do \
519
520
521
522
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
		fi; \
	done
523
	touch $@
524

Michael Hanselmann's avatar
Michael Hanselmann committed
525
526
.PHONY: ganeti
ganeti:
527
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
Michael Hanselmann's avatar
Michael Hanselmann committed
528

529
530
531
check-local:
	$(CHECK_PYTHON_CODE) $(check_python_code)

Iustin Pop's avatar
Iustin Pop committed
532
.PHONY: lint
533
lint: ganeti $(BUILT_SOURCES)
534
535
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
Iustin Pop's avatar
Iustin Pop committed
536

Iustin Pop's avatar
Iustin Pop committed
537
538
# a dist hook rule for catching revision control directories
distcheck-hook:
539
540
541
542
543
544
545
546
547
548
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
		echo "Found revision control files in final archive." 1>&2; \
		exit 1; \
	fi
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
		echo "Found Python byte code in final archive." 1>&2; \
		exit 1; \
	fi
	if find $(top_distdir) -name '*~' | grep .; then \
		echo "Found backup files in final archive." 1>&2; \
Iustin Pop's avatar
Iustin Pop committed
549
550
551
		exit 1; \
	fi

Iustin Pop's avatar
Iustin Pop committed
552
install-exec-local:
553
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
554
555
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
	  "$(DESTDIR)${localstatedir}/run/ganeti"
556
557
558
559
560

stamp-directories: Makefile
	@mkdir_p@ $(DIRS)
	touch $@

Iustin Pop's avatar
Iustin Pop committed
561
.PHONY: apidoc
562
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
Iustin Pop's avatar
Iustin Pop committed
563
	test -e doc/api || mkdir doc/api
564
565
566
	$(RUN_IN_TEMPDIR) epydoc -v \
		--conf $(CURDIR)/epydoc.conf \
		--output $(CURDIR)/doc/api
Iustin Pop's avatar
Iustin Pop committed
567

568
.PHONY: TAGS
569
TAGS: $(BUILT_SOURCES)
570
571
572
573
574
	rm -f TAGS
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
	  etags -

575
.PHONY: coverage
576
coverage: $(BUILT_SOURCES) $(python_tests)
577
578
579
580
581
	set -e; \
	mkdir -p doc/coverage; \
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
582
583
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
	$(python_tests)
584

585
# vim: set noet :