Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ b76aac08

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

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

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

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

    
81
nodist_pkgpython_PYTHON = \
82
	lib/_autoconf.py
83

    
84
noinst_PYTHON = \
85
	lib/build/__init__.py
86

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

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

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

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

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

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

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

    
166
doc/html: doc/html/.stamp
167

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

    
176
docdot = \
177
	doc/arch-2.0.dot \
178
	doc/design-2.1-lock-acquire.dot \
179
	doc/design-2.1-lock-release.dot
180

    
181
docpng = $(patsubst %.dot,%.png,$(docdot))
182

    
183
# Things to build but not to install (add it to EXTRA_DIST if it should be
184
# distributed)
185
noinst_DATA = \
186
	devel/upload \
187
	doc/html \
188
	doc/examples/bash_completion \
189
	doc/examples/ganeti.cron \
190
	doc/examples/ganeti.initd \
191
	doc/examples/hooks/ipsec \
192
	$(manhtml)
193

    
194
gnt_scripts = \
195
	scripts/gnt-backup \
196
	scripts/gnt-cluster \
197
	scripts/gnt-debug \
198
	scripts/gnt-instance \
199
	scripts/gnt-job \
200
	scripts/gnt-node \
201
	scripts/gnt-os
202

    
203
dist_sbin_SCRIPTS = \
204
	daemons/ganeti-noded \
205
	daemons/ganeti-watcher \
206
	daemons/ganeti-masterd \
207
	daemons/ganeti-confd \
208
	daemons/ganeti-rapi \
209
	$(gnt_scripts)
210

    
211
nodist_sbin_SCRIPTS = \
212
	daemons/ganeti-cleaner
213

    
214
dist_tools_SCRIPTS = \
215
	tools/burnin \
216
	tools/cfgshell \
217
	tools/cfgupgrade \
218
	tools/lvmstrap
219

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

    
260
man_MANS = \
261
	man/ganeti.7 \
262
	man/ganeti-cleaner.8 \
263
	man/ganeti-confd.8 \
264
	man/ganeti-masterd.8 \
265
	man/ganeti-noded.8 \
266
	man/ganeti-os-interface.7 \
267
	man/ganeti-rapi.8 \
268
	man/ganeti-watcher.8 \
269
	man/gnt-backup.8 \
270
	man/gnt-cluster.8 \
271
	man/gnt-debug.8 \
272
	man/gnt-instance.8 \
273
	man/gnt-job.8 \
274
	man/gnt-node.8 \
275
	man/gnt-os.8
276

    
277
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
278
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
279
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
280

    
281
TEST_FILES = \
282
	test/data/bdev-both.txt \
283
	test/data/bdev-8.3-both.txt \
284
	test/data/bdev-disk.txt \
285
	test/data/bdev-net.txt \
286
	test/data/proc_drbd8.txt \
287
	test/data/proc_drbd80-emptyline.txt \
288
	test/data/proc_drbd83.txt
289

    
290
dist_TESTS = \
291
	test/ganeti.bdev_unittest.py \
292
	test/ganeti.cli_unittest.py \
293
	test/ganeti.cmdlib_unittest.py \
294
	test/ganeti.confd_client_unittest.py \
295
	test/ganeti.config_unittest.py \
296
	test/ganeti.constants_unittest.py \
297
	test/ganeti.hooks_unittest.py \
298
	test/ganeti.http_unittest.py \
299
	test/ganeti.locking_unittest.py \
300
	test/ganeti.mcpu_unittest.py \
301
	test/ganeti.objects_unittest.py \
302
	test/ganeti.rapi.resources_unittest.py \
303
	test/ganeti.serializer_unittest.py \
304
	test/ganeti.ssh_unittest.py \
305
	test/ganeti.utils_unittest.py \
306
	test/ganeti.workerpool_unittest.py \
307
	test/docs_unittest.py
308

    
309
nodist_TESTS =
310

    
311
TESTS = $(dist_TESTS) $(nodist_TESTS)
312

    
313
TESTS_ENVIRONMENT = \
314
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
315
	$(RUN_IN_TEMPDIR) $(PYTHON)
316

    
317
all_python_code = \
318
	$(dist_sbin_SCRIPTS) \
319
	$(dist_tools_SCRIPTS) \
320
	$(dist_TESTS) \
321
	$(pkgpython_PYTHON) \
322
	$(hypervisor_PYTHON) \
323
	$(rapi_PYTHON) \
324
	$(http_PYTHON) \
325
	$(confd_PYTHON) \
326
	$(noinst_PYTHON)
327

    
328
srclink_files = \
329
	man/footer.sgml \
330
	$(all_python_code)
331

    
332
check_python_code = \
333
	$(all_python_code)
334

    
335
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
336
	sed -f $(REPLACE_VARS_SED) < $< > $@
337
	chmod u+x $@
338

    
339
daemons/ganeti-cleaner: daemons/ganeti-cleaner.in \
340
		$(REPLACE_VARS_SED)
341
	sed -f $(REPLACE_VARS_SED) < $< > $@
342
	chmod +x $@
343

    
344
doc/examples/%: doc/examples/%.in \
345
		$(REPLACE_VARS_SED)
346
	sed -f $(REPLACE_VARS_SED) < $< > $@
347

    
348
doc/examples/hooks/%: doc/examples/hooks/%.in \
349
		$(REPLACE_VARS_SED)
350
	sed -f $(REPLACE_VARS_SED) < $< > $@
351

    
352
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
353
	lib/cli.py $(gnt_scripts) tools/burnin
354
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
355

    
356
doc/%.png: doc/%.dot
357
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
358
	$(DOT) -Tpng -o $@ $<
359

    
360
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
361
	@test -n "$(DOCBOOK2MAN)" || { echo 'docbook2man' not found during configure; exit 1; }
362
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
363

    
364
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
365
	@test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
366
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
367

    
368
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
369
	sed -f $(REPLACE_VARS_SED) < $< > $@
370

    
371
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
372
	sed -f $(REPLACE_VARS_SED) < $< > $@
373

    
374
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
375
	sed -f $(REPLACE_VARS_SED) < $< > $@
376

    
377
lib/_autoconf.py: Makefile stamp-directories
378
	set -e; \
379
	{ echo '# This file is automatically generated, do not edit!'; \
380
	  echo '#'; \
381
	  echo ''; \
382
	  echo '"""Build-time configuration for Ganeti.'; \
383
	  echo '';\
384
	  echo 'This file is autogenerated by the build process.'; \
385
	  echo 'For any changes you need to re-run ./configure (and'; \
386
	  echo 'not edit by hand).'; \
387
	  echo ''; \
388
	  echo '"""'; \
389
	  echo ''; \
390
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
391
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
392
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
393
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
394
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
395
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
396
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
397
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
398
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
399
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
400
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
401
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
402
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
403
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
404
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
405
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
406
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
407
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
408
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
409
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
410
	  echo "TOOLSDIR = '$(toolsdir)'"; \
411
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
412
	} > $@
413

    
414
$(REPLACE_VARS_SED): Makefile
415
	set -e; \
416
	{ echo 's#@PREFIX@#$(prefix)#g'; \
417
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
418
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
419
	  echo 's#@BINDIR@#$(bindir)#g'; \
420
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
421
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
422
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
423
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
424
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
425
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
426
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
427
	} > $@
428

    
429
# We need to create symlinks because "make distcheck" will not install Python
430
# files when building.
431
stamp-srclinks: Makefile stamp-directories
432
	set -e; \
433
	for i in $(srclink_files); do \
434
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
435
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
436
		fi; \
437
	done
438
	touch $@
439

    
440
.PHONY: ganeti
441
ganeti:
442
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
443

    
444
check-local:
445
	$(CHECK_PYTHON_CODE) $(check_python_code)
446

    
447
# a dist hook rule for catching revision control directories
448
distcheck-hook:
449
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
450
		echo "Found revision control files in final archive" 1>&2 ; \
451
		exit 1; \
452
	fi
453

    
454
install-exec-local:
455
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
456
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
457
	  "$(DESTDIR)${localstatedir}/run/ganeti"
458

    
459
stamp-directories: Makefile
460
	@mkdir_p@ $(DIRS)
461
	touch $@
462

    
463
.PHONY: apidoc
464
apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
465
	test -e doc/api || mkdir doc/api
466
	$(RUN_IN_TEMPDIR) epydoc -v \
467
		--conf $(CURDIR)/epydoc.conf \
468
		--output $(CURDIR)/doc/api
469

    
470
.PHONY: TAGS
471
TAGS:
472
	rm -f TAGS
473
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
474
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
475
	  etags -
476

    
477
# vim: set noet :