Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 231db3a5

History | View | Annotate | Download (12.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
REPLACE_VARS_SED = autotools/replace_vars.sed
18

    
19
hypervisordir = $(pkgpythondir)/hypervisor
20
httpdir = $(pkgpythondir)/http
21
confddir = $(pkgpythondir)/confd
22
rapidir = $(pkgpythondir)/rapi
23
toolsdir = $(pkglibdir)/tools
24
docdir = $(datadir)/doc/$(PACKAGE)
25

    
26
DIRS = \
27
	autotools \
28
	daemons \
29
	devel \
30
	doc \
31
	doc/examples \
32
	doc/examples/hooks \
33
	lib \
34
	lib/build \
35
	lib/http \
36
	lib/hypervisor \
37
	lib/rapi \
38
	lib/confd \
39
	man \
40
	qa \
41
	scripts \
42
	test \
43
	test/data \
44
	tools
45

    
46
MAINTAINERCLEANFILES = \
47
	$(docpng) \
48
	$(maninput) \
49
	doc/install-quick.rst \
50
	doc/news.rst
51

    
52
maintainer-clean-local:
53
	rm -rf doc/api doc/html
54

    
55
CLEANFILES = \
56
	autotools/replace_vars.sed \
57
	daemons/daemon-util \
58
	daemons/ganeti-cleaner \
59
	devel/upload \
60
	doc/examples/bash_completion \
61
	doc/examples/ganeti.initd \
62
	doc/examples/ganeti.cron \
63
	doc/examples/gnt-config-backup \
64
	doc/examples/hooks/ipsec \
65
	lib/*.py[co] \
66
	lib/build/*.py[co] \
67
	lib/http/*.py[co] \
68
	lib/hypervisor/*.py[co] \
69
	lib/rapi/*.py[co] \
70
	$(man_MANS) \
71
	$(manhtml) \
72
	qa/*.py[co] \
73
	test/*.py[co] \
74
	stamp-directories \
75
	stamp-srclinks \
76
	$(nodist_pkgpython_PYTHON)
77

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

    
84
nodist_pkgpython_PYTHON = \
85
	lib/_autoconf.py
86

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

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

    
117
hypervisor_PYTHON = \
118
	lib/hypervisor/__init__.py \
119
	lib/hypervisor/hv_base.py \
120
	lib/hypervisor/hv_chroot.py \
121
	lib/hypervisor/hv_fake.py \
122
	lib/hypervisor/hv_kvm.py \
123
	lib/hypervisor/hv_xen.py
124

    
125
rapi_PYTHON = \
126
	lib/rapi/__init__.py \
127
	lib/rapi/baserlib.py \
128
	lib/rapi/connector.py \
129
	lib/rapi/rlib2.py
130

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

    
137
confd_PYTHON = \
138
	lib/confd/__init__.py \
139
	lib/confd/client.py \
140
	lib/confd/server.py \
141
	lib/confd/querylib.py
142

    
143
docrst = \
144
	doc/admin.rst \
145
	doc/design-2.0.rst \
146
	doc/design-2.1.rst \
147
	doc/design-2.2.rst \
148
	doc/devnotes.rst \
149
	doc/glossary.rst \
150
	doc/hooks.rst \
151
	doc/iallocator.rst \
152
	doc/index.rst \
153
	doc/install-quick.rst \
154
	doc/install.rst \
155
	doc/locking.rst \
156
	doc/news.rst \
157
	doc/rapi.rst \
158
	doc/security.rst \
159
	doc/walkthrough.rst
160

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

    
172
doc/html: doc/html/.stamp
173

    
174
doc/news.rst: NEWS
175
	set -e; \
176
	{ echo '.. This file is automatically updated at build time from $<.'; \
177
	  echo '.. Do not edit.'; \
178
	  echo; \
179
	  cat $<; \
180
	} > $@
181

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

    
190
docdot = \
191
	doc/arch-2.0.dot \
192
	doc/design-2.1-lock-acquire.dot \
193
	doc/design-2.1-lock-release.dot
194

    
195
docpng = $(patsubst %.dot,%.png,$(docdot))
196

    
197
# Things to build but not to install (add it to EXTRA_DIST if it should be
198
# distributed)
199
noinst_DATA = \
200
	devel/upload \
201
	doc/html \
202
	doc/examples/bash_completion \
203
	doc/examples/ganeti.cron \
204
	doc/examples/ganeti.initd \
205
	doc/examples/gnt-config-backup \
206
	doc/examples/hooks/ipsec \
207
	$(manhtml)
208

    
209
gnt_scripts = \
210
	scripts/gnt-backup \
211
	scripts/gnt-cluster \
212
	scripts/gnt-debug \
213
	scripts/gnt-instance \
214
	scripts/gnt-job \
215
	scripts/gnt-node \
216
	scripts/gnt-os
217

    
218
dist_sbin_SCRIPTS = \
219
	daemons/ganeti-noded \
220
	daemons/ganeti-watcher \
221
	daemons/ganeti-masterd \
222
	daemons/ganeti-confd \
223
	daemons/ganeti-rapi \
224
	$(gnt_scripts)
225

    
226
nodist_sbin_SCRIPTS = \
227
	daemons/ganeti-cleaner
228

    
229
dist_tools_SCRIPTS = \
230
	tools/burnin \
231
	tools/cfgshell \
232
	tools/cfgupgrade \
233
	tools/lvmstrap
234

    
235
pkglib_SCRIPTS = \
236
	daemons/daemon-util
237

    
238
EXTRA_DIST = \
239
	NEWS \
240
	pylintrc \
241
	autotools/build-bash-completion \
242
	autotools/check-python-code \
243
	autotools/docbook-wrapper \
244
	$(RUN_IN_TEMPDIR) \
245
	daemons/daemon-util.in \
246
	daemons/ganeti-cleaner.in \
247
	devel/upload.in \
248
	$(docdot) \
249
	$(docpng) \
250
	$(docrst) \
251
	doc/conf.py \
252
	doc/html \
253
	doc/examples/ganeti.initd.in \
254
	doc/examples/ganeti.cron.in \
255
	doc/examples/gnt-config-backup.in \
256
	doc/examples/dumb-allocator \
257
	doc/examples/hooks/ethers \
258
	doc/examples/hooks/ipsec.in \
259
	test/testutils.py \
260
	test/mocks.py \
261
	$(dist_TESTS) \
262
	$(TEST_FILES) \
263
	man/footer.sgml \
264
	$(mansgml) \
265
	$(maninput) \
266
	qa/ganeti-qa.py \
267
	qa/qa-sample.json \
268
	qa/qa_cluster.py \
269
	qa/qa_config.py \
270
	qa/qa_daemon.py \
271
	qa/qa_env.py \
272
	qa/qa_error.py \
273
	qa/qa_instance.py \
274
	qa/qa_node.py \
275
	qa/qa_os.py \
276
	qa/qa_rapi.py \
277
	qa/qa_tags.py \
278
	qa/qa_utils.py
279

    
280
man_MANS = \
281
	man/ganeti.7 \
282
	man/ganeti-cleaner.8 \
283
	man/ganeti-confd.8 \
284
	man/ganeti-masterd.8 \
285
	man/ganeti-noded.8 \
286
	man/ganeti-os-interface.7 \
287
	man/ganeti-rapi.8 \
288
	man/ganeti-watcher.8 \
289
	man/gnt-backup.8 \
290
	man/gnt-cluster.8 \
291
	man/gnt-debug.8 \
292
	man/gnt-instance.8 \
293
	man/gnt-job.8 \
294
	man/gnt-node.8 \
295
	man/gnt-os.8
296

    
297
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
298
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
299
maninput = \
300
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
301
	$(patsubst %.html,%.html.in,$(manhtml))
302

    
303
TEST_FILES = \
304
	test/data/bdev-both.txt \
305
	test/data/bdev-8.3-both.txt \
306
	test/data/bdev-disk.txt \
307
	test/data/bdev-net.txt \
308
	test/data/proc_drbd8.txt \
309
	test/data/proc_drbd80-emptyline.txt \
310
	test/data/proc_drbd83.txt
311

    
312
dist_TESTS = \
313
	test/ganeti.bdev_unittest.py \
314
	test/ganeti.cli_unittest.py \
315
	test/ganeti.cmdlib_unittest.py \
316
	test/ganeti.confd_client_unittest.py \
317
	test/ganeti.config_unittest.py \
318
	test/ganeti.constants_unittest.py \
319
	test/ganeti.hooks_unittest.py \
320
	test/ganeti.http_unittest.py \
321
	test/ganeti.locking_unittest.py \
322
	test/ganeti.luxi_unittest.py \
323
	test/ganeti.mcpu_unittest.py \
324
	test/ganeti.objects_unittest.py \
325
	test/ganeti.rapi.resources_unittest.py \
326
	test/ganeti.serializer_unittest.py \
327
	test/ganeti.ssh_unittest.py \
328
	test/ganeti.utils_unittest.py \
329
	test/ganeti.workerpool_unittest.py \
330
	test/docs_unittest.py
331

    
332
nodist_TESTS =
333

    
334
TESTS = $(dist_TESTS) $(nodist_TESTS)
335

    
336
TESTS_ENVIRONMENT = \
337
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
338
	$(RUN_IN_TEMPDIR) $(PYTHON)
339

    
340
all_python_code = \
341
	$(dist_sbin_SCRIPTS) \
342
	$(dist_tools_SCRIPTS) \
343
	$(dist_TESTS) \
344
	$(pkgpython_PYTHON) \
345
	$(hypervisor_PYTHON) \
346
	$(rapi_PYTHON) \
347
	$(http_PYTHON) \
348
	$(confd_PYTHON) \
349
	$(noinst_PYTHON)
350

    
351
srclink_files = \
352
	man/footer.sgml \
353
	$(all_python_code)
354

    
355
check_python_code = \
356
	autotools/build-bash-completion \
357
	$(all_python_code)
358

    
359
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
360
	sed -f $(REPLACE_VARS_SED) < $< > $@
361
	chmod u+x $@
362

    
363
daemons/%: daemons/%.in \
364
		$(REPLACE_VARS_SED)
365
	sed -f $(REPLACE_VARS_SED) < $< > $@
366
	chmod +x $@
367

    
368
doc/examples/%: doc/examples/%.in \
369
		$(REPLACE_VARS_SED)
370
	sed -f $(REPLACE_VARS_SED) < $< > $@
371

    
372
doc/examples/hooks/%: doc/examples/hooks/%.in \
373
		$(REPLACE_VARS_SED)
374
	sed -f $(REPLACE_VARS_SED) < $< > $@
375

    
376
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
377
	lib/cli.py $(gnt_scripts) tools/burnin
378
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
379

    
380
doc/%.png: doc/%.dot
381
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
382
	$(DOT) -Tpng -o $@ $<
383

    
384
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
385
	@test -n "$(DOCBOOK2MAN)" || \
386
	  { echo 'docbook2man' not found during configure; exit 1; }
387
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
388

    
389
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
390
	@test -n "$(DOCBOOK2HTML)" || \
391
	  { echo 'docbook2html' not found during configure; exit 1; }
392
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
393

    
394
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
395
	sed -f $(REPLACE_VARS_SED) < $< > $@
396

    
397
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
398
	sed -f $(REPLACE_VARS_SED) < $< > $@
399

    
400
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
401
	sed -f $(REPLACE_VARS_SED) < $< > $@
402

    
403
lib/_autoconf.py: Makefile stamp-directories
404
	set -e; \
405
	{ echo '# This file is automatically generated, do not edit!'; \
406
	  echo '#'; \
407
	  echo ''; \
408
	  echo '"""Build-time configuration for Ganeti.'; \
409
	  echo '';\
410
	  echo 'This file is autogenerated by the build process.'; \
411
	  echo 'For any changes you need to re-run ./configure (and'; \
412
	  echo 'not edit by hand).'; \
413
	  echo ''; \
414
	  echo '"""'; \
415
	  echo ''; \
416
	  echo '# pylint: disable-msg=C0301,C0324'; \
417
	  echo '# because this is autogenerated, we do not want'; \
418
	  echo '# style warnings' ; \
419
	  echo ''; \
420
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
421
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
422
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
423
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
424
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
425
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
426
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
427
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
428
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
429
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
430
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
431
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
432
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
433
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
434
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
435
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
436
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
437
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
438
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
439
	  echo "TOOLSDIR = '$(toolsdir)'"; \
440
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
441
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
442
	} > $@
443

    
444
$(REPLACE_VARS_SED): Makefile
445
	set -e; \
446
	{ echo 's#@PREFIX@#$(prefix)#g'; \
447
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
448
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
449
	  echo 's#@BINDIR@#$(bindir)#g'; \
450
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
451
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
452
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
453
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
454
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
455
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
456
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
457
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
458
	} > $@
459

    
460
# We need to create symlinks because "make distcheck" will not install Python
461
# files when building.
462
stamp-srclinks: Makefile stamp-directories
463
	set -e; \
464
	for i in $(srclink_files); do \
465
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
466
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
467
		fi; \
468
	done
469
	touch $@
470

    
471
.PHONY: ganeti
472
ganeti:
473
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
474

    
475
check-local:
476
	$(CHECK_PYTHON_CODE) $(check_python_code)
477

    
478
.PHONY: lint
479
lint: ganeti
480
	pylint ganeti $(dist_sbin_SCRIPTS) $(dist_tools_SCRIPTS)
481

    
482
# a dist hook rule for catching revision control directories
483
distcheck-hook:
484
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
485
		echo "Found revision control files in final archive." 1>&2; \
486
		exit 1; \
487
	fi
488
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
489
		echo "Found Python byte code in final archive." 1>&2; \
490
		exit 1; \
491
	fi
492
	if find $(top_distdir) -name '*~' | grep .; then \
493
		echo "Found backup files in final archive." 1>&2; \
494
		exit 1; \
495
	fi
496

    
497
install-exec-local:
498
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
499
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
500
	  "$(DESTDIR)${localstatedir}/run/ganeti"
501

    
502
stamp-directories: Makefile
503
	@mkdir_p@ $(DIRS)
504
	touch $@
505

    
506
.PHONY: apidoc
507
apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
508
	test -e doc/api || mkdir doc/api
509
	$(RUN_IN_TEMPDIR) epydoc -v \
510
		--conf $(CURDIR)/epydoc.conf \
511
		--output $(CURDIR)/doc/api
512

    
513
.PHONY: TAGS
514
TAGS:
515
	rm -f TAGS
516
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
517
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
518
	  etags -
519

    
520
# vim: set noet :