Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 7e1fac25

History | View | Annotate | Download (12.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
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/news.rst
50

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

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

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

    
83
nodist_pkgpython_PYTHON = \
84
	lib/_autoconf.py
85

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

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

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

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

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

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

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

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

    
169
doc/html: doc/html/.stamp
170

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

    
179
docdot = \
180
	doc/arch-2.0.dot \
181
	doc/design-2.1-lock-acquire.dot \
182
	doc/design-2.1-lock-release.dot
183

    
184
docpng = $(patsubst %.dot,%.png,$(docdot))
185

    
186
# Things to build but not to install (add it to EXTRA_DIST if it should be
187
# distributed)
188
noinst_DATA = \
189
	devel/upload \
190
	doc/html \
191
	doc/examples/bash_completion \
192
	doc/examples/ganeti.cron \
193
	doc/examples/ganeti.initd \
194
	doc/examples/gnt-config-backup \
195
	doc/examples/hooks/ipsec \
196
	$(manhtml)
197

    
198
gnt_scripts = \
199
	scripts/gnt-backup \
200
	scripts/gnt-cluster \
201
	scripts/gnt-debug \
202
	scripts/gnt-instance \
203
	scripts/gnt-job \
204
	scripts/gnt-node \
205
	scripts/gnt-os
206

    
207
dist_sbin_SCRIPTS = \
208
	daemons/ganeti-noded \
209
	daemons/ganeti-watcher \
210
	daemons/ganeti-masterd \
211
	daemons/ganeti-confd \
212
	daemons/ganeti-rapi \
213
	$(gnt_scripts)
214

    
215
nodist_sbin_SCRIPTS = \
216
	daemons/ganeti-cleaner
217

    
218
dist_tools_SCRIPTS = \
219
	tools/burnin \
220
	tools/cfgshell \
221
	tools/cfgupgrade \
222
	tools/lvmstrap
223

    
224
pkglib_SCRIPTS = \
225
	daemons/daemon-util
226

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

    
269
man_MANS = \
270
	man/ganeti.7 \
271
	man/ganeti-cleaner.8 \
272
	man/ganeti-confd.8 \
273
	man/ganeti-masterd.8 \
274
	man/ganeti-noded.8 \
275
	man/ganeti-os-interface.7 \
276
	man/ganeti-rapi.8 \
277
	man/ganeti-watcher.8 \
278
	man/gnt-backup.8 \
279
	man/gnt-cluster.8 \
280
	man/gnt-debug.8 \
281
	man/gnt-instance.8 \
282
	man/gnt-job.8 \
283
	man/gnt-node.8 \
284
	man/gnt-os.8
285

    
286
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
287
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
288
maninput = \
289
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
290
	$(patsubst %.html,%.html.in,$(manhtml))
291

    
292
TEST_FILES = \
293
	test/data/bdev-both.txt \
294
	test/data/bdev-8.3-both.txt \
295
	test/data/bdev-disk.txt \
296
	test/data/bdev-net.txt \
297
	test/data/proc_drbd8.txt \
298
	test/data/proc_drbd80-emptyline.txt \
299
	test/data/proc_drbd83.txt
300

    
301
dist_TESTS = \
302
	test/ganeti.bdev_unittest.py \
303
	test/ganeti.cli_unittest.py \
304
	test/ganeti.cmdlib_unittest.py \
305
	test/ganeti.confd_client_unittest.py \
306
	test/ganeti.config_unittest.py \
307
	test/ganeti.constants_unittest.py \
308
	test/ganeti.hooks_unittest.py \
309
	test/ganeti.http_unittest.py \
310
	test/ganeti.locking_unittest.py \
311
	test/ganeti.mcpu_unittest.py \
312
	test/ganeti.objects_unittest.py \
313
	test/ganeti.rapi.resources_unittest.py \
314
	test/ganeti.serializer_unittest.py \
315
	test/ganeti.ssh_unittest.py \
316
	test/ganeti.utils_unittest.py \
317
	test/ganeti.workerpool_unittest.py \
318
	test/docs_unittest.py
319

    
320
nodist_TESTS =
321

    
322
TESTS = $(dist_TESTS) $(nodist_TESTS)
323

    
324
TESTS_ENVIRONMENT = \
325
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
326
	$(RUN_IN_TEMPDIR) $(PYTHON)
327

    
328
all_python_code = \
329
	$(dist_sbin_SCRIPTS) \
330
	$(dist_tools_SCRIPTS) \
331
	$(dist_TESTS) \
332
	$(pkgpython_PYTHON) \
333
	$(hypervisor_PYTHON) \
334
	$(rapi_PYTHON) \
335
	$(http_PYTHON) \
336
	$(confd_PYTHON) \
337
	$(noinst_PYTHON)
338

    
339
srclink_files = \
340
	man/footer.sgml \
341
	$(all_python_code)
342

    
343
check_python_code = \
344
	$(all_python_code)
345

    
346
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
347
	sed -f $(REPLACE_VARS_SED) < $< > $@
348
	chmod u+x $@
349

    
350
daemons/%: daemons/%.in \
351
		$(REPLACE_VARS_SED)
352
	sed -f $(REPLACE_VARS_SED) < $< > $@
353
	chmod +x $@
354

    
355
doc/examples/%: doc/examples/%.in \
356
		$(REPLACE_VARS_SED)
357
	sed -f $(REPLACE_VARS_SED) < $< > $@
358

    
359
doc/examples/hooks/%: doc/examples/hooks/%.in \
360
		$(REPLACE_VARS_SED)
361
	sed -f $(REPLACE_VARS_SED) < $< > $@
362

    
363
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
364
	lib/cli.py $(gnt_scripts) tools/burnin
365
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
366

    
367
doc/%.png: doc/%.dot
368
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
369
	$(DOT) -Tpng -o $@ $<
370

    
371
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
372
	@test -n "$(DOCBOOK2MAN)" || \
373
	  { echo 'docbook2man' not found during configure; exit 1; }
374
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
375

    
376
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
377
	@test -n "$(DOCBOOK2HTML)" || \
378
	  { echo 'docbook2html' not found during configure; exit 1; }
379
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
380

    
381
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
382
	sed -f $(REPLACE_VARS_SED) < $< > $@
383

    
384
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
385
	sed -f $(REPLACE_VARS_SED) < $< > $@
386

    
387
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
388
	sed -f $(REPLACE_VARS_SED) < $< > $@
389

    
390
lib/_autoconf.py: Makefile stamp-directories
391
	set -e; \
392
	{ echo '# This file is automatically generated, do not edit!'; \
393
	  echo '#'; \
394
	  echo ''; \
395
	  echo '"""Build-time configuration for Ganeti.'; \
396
	  echo '';\
397
	  echo 'This file is autogenerated by the build process.'; \
398
	  echo 'For any changes you need to re-run ./configure (and'; \
399
	  echo 'not edit by hand).'; \
400
	  echo ''; \
401
	  echo '"""'; \
402
	  echo ''; \
403
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
404
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
405
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
406
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
407
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
408
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
409
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
410
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
411
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
412
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
413
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
414
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
415
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
416
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
417
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
418
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
419
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
420
	  echo "SOCAT_ESCAPE = '$(SOCAT_ESCAPE)'"; \
421
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
422
	  echo "TOOLSDIR = '$(toolsdir)'"; \
423
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
424
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
425
	} > $@
426

    
427
$(REPLACE_VARS_SED): Makefile
428
	set -e; \
429
	{ echo 's#@PREFIX@#$(prefix)#g'; \
430
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
431
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
432
	  echo 's#@BINDIR@#$(bindir)#g'; \
433
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
434
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
435
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
436
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
437
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
438
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
439
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
440
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
441
	} > $@
442

    
443
# We need to create symlinks because "make distcheck" will not install Python
444
# files when building.
445
stamp-srclinks: Makefile stamp-directories
446
	set -e; \
447
	for i in $(srclink_files); do \
448
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
449
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
450
		fi; \
451
	done
452
	touch $@
453

    
454
.PHONY: ganeti
455
ganeti:
456
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
457

    
458
check-local:
459
	$(CHECK_PYTHON_CODE) $(check_python_code)
460

    
461
# a dist hook rule for catching revision control directories
462
distcheck-hook:
463
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
464
		echo "Found revision control files in final archive." 1>&2; \
465
		exit 1; \
466
	fi
467
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
468
		echo "Found Python byte code in final archive." 1>&2; \
469
		exit 1; \
470
	fi
471
	if find $(top_distdir) -name '*~' | grep .; then \
472
		echo "Found backup files in final archive." 1>&2; \
473
		exit 1; \
474
	fi
475

    
476
install-exec-local:
477
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
478
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
479
	  "$(DESTDIR)${localstatedir}/run/ganeti"
480

    
481
stamp-directories: Makefile
482
	@mkdir_p@ $(DIRS)
483
	touch $@
484

    
485
.PHONY: apidoc
486
apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
487
	test -e doc/api || mkdir doc/api
488
	$(RUN_IN_TEMPDIR) epydoc -v \
489
		--conf $(CURDIR)/epydoc.conf \
490
		--output $(CURDIR)/doc/api
491

    
492
.PHONY: TAGS
493
TAGS:
494
	rm -f TAGS
495
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
496
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
497
	  etags -
498

    
499
# vim: set noet :