Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ eed5c5df

History | View | Annotate | Download (11.1 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

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

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

    
73
BUILT_SOURCES = \
74
	ganeti \
75
	srclinks \
76
	lib/_autoconf.py
77

    
78
nodist_pkgpython_PYTHON = \
79
	lib/_autoconf.py
80

    
81
noinst_PYTHON = \
82
	lib/build/__init__.py
83

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

    
111
hypervisor_PYTHON = \
112
	lib/hypervisor/__init__.py \
113
	lib/hypervisor/hv_base.py \
114
	lib/hypervisor/hv_chroot.py \
115
	lib/hypervisor/hv_fake.py \
116
	lib/hypervisor/hv_kvm.py \
117
	lib/hypervisor/hv_xen.py
118

    
119
rapi_PYTHON = \
120
	lib/rapi/__init__.py \
121
	lib/rapi/baserlib.py \
122
	lib/rapi/connector.py \
123
	lib/rapi/rlib2.py
124

    
125
http_PYTHON = \
126
	lib/http/__init__.py \
127
	lib/http/auth.py \
128
	lib/http/client.py \
129
	lib/http/server.py
130

    
131
confd_PYTHON = \
132
	lib/confd/__init__.py \
133
	lib/confd/server.py \
134
	lib/confd/querylib.py
135

    
136
docrst = \
137
	doc/admin.rst \
138
	doc/design-2.0.rst \
139
	doc/design-2.1.rst \
140
	doc/glossary.rst \
141
	doc/hooks.rst \
142
	doc/iallocator.rst \
143
	doc/index.rst \
144
	doc/install.rst \
145
	doc/locking.rst \
146
	doc/rapi.rst \
147
	doc/security.rst
148

    
149
doc/html: $(docrst) $(docpng) doc/conf.py configure.ac
150
	@test -n "$(SPHINX)" || \
151
	    { echo 'sphinx-build' not found during configure; exit 1; }
152
	mkdir -p doc/build/doctrees
153
	PYTHONPATH=.:$(top_builddir) sphinx-build -q -b html \
154
	    -d doc/build/doctrees \
155
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
156
	    -D release="$(PACKAGE_VERSION)" \
157
	    $(top_srcdir)/doc doc/html
158
	touch "$@"
159

    
160
docdot = \
161
	doc/arch-2.0.dot
162

    
163
docpng = $(patsubst %.dot,%.png,$(docdot))
164

    
165
noinst_DATA = $(manhtml) doc/html
166

    
167
gnt_scripts = \
168
	scripts/gnt-backup \
169
	scripts/gnt-cluster \
170
	scripts/gnt-debug \
171
	scripts/gnt-instance \
172
	scripts/gnt-job \
173
	scripts/gnt-node \
174
	scripts/gnt-os
175

    
176
dist_sbin_SCRIPTS = \
177
	daemons/ganeti-noded \
178
	daemons/ganeti-watcher \
179
	daemons/ganeti-masterd \
180
	daemons/ganeti-confd \
181
	daemons/ganeti-rapi \
182
	$(gnt_scripts)
183

    
184
nodist_sbin_SCRIPTS = \
185
	daemons/ganeti-cleaner
186

    
187
dist_tools_SCRIPTS = \
188
	tools/burnin \
189
	tools/cfgshell \
190
	tools/cfgupgrade \
191
	tools/lvmstrap
192

    
193
EXTRA_DIST = \
194
	$(MAINTAINERCLEANFILES) \
195
	NEWS \
196
	DEVNOTES \
197
	pylintrc \
198
	autotools/build-bash-completion \
199
	autotools/check-python-code \
200
	autotools/docbook-wrapper \
201
	autotools/run-in-tempdir \
202
	daemons/ganeti-cleaner.in \
203
	devel/upload.in \
204
	$(docdot) \
205
	$(docrst) \
206
	doc/conf.py \
207
	doc/html \
208
	doc/examples/ganeti.initd.in \
209
	doc/examples/ganeti.cron.in \
210
	doc/examples/dumb-allocator \
211
	doc/examples/hooks/ethers \
212
	doc/examples/hooks/ipsec.in \
213
	test/testutils.py \
214
	test/mocks.py \
215
	$(dist_TESTS) \
216
	$(TEST_FILES) \
217
	man/footer.sgml \
218
	$(mansgml) $(maninput) \
219
	qa/ganeti-qa.py \
220
	qa/qa-sample.json \
221
	qa/qa_cluster.py \
222
	qa/qa_config.py \
223
	qa/qa_daemon.py \
224
	qa/qa_env.py \
225
	qa/qa_error.py \
226
	qa/qa_instance.py \
227
	qa/qa_node.py \
228
	qa/qa_os.py \
229
	qa/qa_rapi.py \
230
	qa/qa_tags.py \
231
	qa/qa_utils.py
232

    
233
man_MANS = \
234
	man/ganeti.7 \
235
	man/ganeti-masterd.8 \
236
	man/ganeti-noded.8 \
237
	man/ganeti-os-interface.7 \
238
	man/ganeti-rapi.8 \
239
	man/ganeti-watcher.8 \
240
	man/gnt-backup.8 \
241
	man/gnt-cluster.8 \
242
	man/gnt-debug.8 \
243
	man/gnt-instance.8 \
244
	man/gnt-job.8 \
245
	man/gnt-node.8 \
246
	man/gnt-os.8
247

    
248
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
249
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
250
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
251

    
252
TEST_FILES = \
253
	test/data/bdev-both.txt \
254
	test/data/bdev-8.3-both.txt \
255
	test/data/bdev-disk.txt \
256
	test/data/bdev-net.txt \
257
	test/data/proc_drbd8.txt \
258
	test/data/proc_drbd83.txt
259

    
260
dist_TESTS = \
261
	test/ganeti.bdev_unittest.py \
262
	test/ganeti.cli_unittest.py \
263
	test/ganeti.cmdlib_unittest.py \
264
	test/ganeti.config_unittest.py \
265
	test/ganeti.constants_unittest.py \
266
	test/ganeti.hooks_unittest.py \
267
	test/ganeti.http_unittest.py \
268
	test/ganeti.locking_unittest.py \
269
	test/ganeti.objects_unittest.py \
270
	test/ganeti.rapi.resources_unittest.py \
271
	test/ganeti.serializer_unittest.py \
272
	test/ganeti.ssh_unittest.py \
273
	test/ganeti.utils_unittest.py \
274
	test/ganeti.workerpool_unittest.py \
275
	test/docs_unittest.py
276

    
277
nodist_TESTS =
278

    
279
TESTS = $(dist_TESTS) $(nodist_TESTS)
280

    
281
TESTS_ENVIRONMENT = \
282
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
283
	$(RUN_IN_TEMPDIR) $(PYTHON)
284

    
285
all_python_code = \
286
	$(dist_sbin_SCRIPTS) \
287
	$(dist_tools_SCRIPTS) \
288
	$(dist_TESTS) \
289
	$(pkgpython_PYTHON) \
290
	$(hypervisor_PYTHON) \
291
	$(rapi_PYTHON) \
292
	$(http_PYTHON) \
293
	$(confd_PYTHON) \
294
	$(noinst_PYTHON)
295

    
296
srclink_files = \
297
	man/footer.sgml \
298
	$(all_python_code)
299

    
300
check_python_code = \
301
	$(all_python_code)
302

    
303
all-local: stamp-directories devel/upload \
304
	doc/examples/bash_completion \
305
	doc/examples/ganeti.initd doc/examples/ganeti.cron \
306
	doc/examples/hooks/ipsec
307

    
308
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
309
	sed -f $(REPLACE_VARS_SED) < $< > $@
310
	chmod u+x $@
311

    
312
daemons/ganeti-cleaner: daemons/ganeti-cleaner.in stamp-directories \
313
		$(REPLACE_VARS_SED)
314
	sed -f $(REPLACE_VARS_SED) < $< > $@
315
	chmod +x $@
316

    
317
doc/examples/%: doc/examples/%.in stamp-directories \
318
		$(REPLACE_VARS_SED)
319
	sed -f $(REPLACE_VARS_SED) < $< > $@
320

    
321
doc/examples/hooks/%: doc/examples/hooks/%.in stamp-directories \
322
		$(REPLACE_VARS_SED)
323
	sed -f $(REPLACE_VARS_SED) < $< > $@
324

    
325
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
326
	lib/cli.py $(gnt_scripts) tools/burnin
327
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
328

    
329
doc/%.png: doc/%.dot
330
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
331
	$(DOT) -Tpng -o $@ $<
332

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

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

    
341
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
342
	sed -f $(REPLACE_VARS_SED) < $< > $@
343

    
344
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
345
	sed -f $(REPLACE_VARS_SED) < $< > $@
346

    
347
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
348
	sed -f $(REPLACE_VARS_SED) < $< > $@
349

    
350
lib/_autoconf.py: Makefile stamp-directories
351
	set -e; \
352
	{ echo '# This file is automatically generated, do not edit!'; \
353
	  echo '#'; \
354
	  echo ''; \
355
	  echo '"""Build-time configuration for Ganeti.'; \
356
	  echo '';\
357
	  echo 'This file is autogenerated by the build process.'; \
358
	  echo 'For any changes you need to re-run ./configure (and'; \
359
	  echo 'not edit by hand).'; \
360
	  echo ''; \
361
	  echo '"""'; \
362
	  echo ''; \
363
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
364
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
365
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
366
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
367
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
368
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
369
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
370
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
371
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
372
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
373
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
374
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
375
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
376
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
377
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
378
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
379
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
380
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
381
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
382
	  echo "TOOLSDIR = '$(toolsdir)'"; \
383
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
384
	} > $@
385

    
386
$(REPLACE_VARS_SED): Makefile stamp-directories
387
	set -e; \
388
	{ echo 's#@PREFIX@#$(prefix)#g'; \
389
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
390
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
391
	  echo 's#@BINDIR@#$(bindir)#g'; \
392
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
393
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
394
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
395
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
396
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
397
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
398
	} > $@
399

    
400
# We need to create symlinks because "make distcheck" will not install Python
401
# files when building.
402
srclinks: stamp-directories
403
	set -e; \
404
	for i in $(srclink_files); do \
405
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
406
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
407
		fi; \
408
	done
409

    
410
.PHONY: ganeti
411
ganeti:
412
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
413

    
414
check-local:
415
	$(CHECK_PYTHON_CODE) $(check_python_code)
416

    
417
# a dist hook rule for catching revision control directories
418
distcheck-hook:
419
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
420
		echo "Found revision control files in final archive" 1>&2 ; \
421
		exit 1; \
422
	fi
423

    
424
install-exec-local:
425
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
426
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
427
	  "$(DESTDIR)${localstatedir}/run/ganeti"
428

    
429
stamp-directories: Makefile
430
	@mkdir_p@ $(DIRS)
431
	touch $@
432

    
433
.PHONY: apidoc
434
apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
435
	test -e doc/api || mkdir doc/api
436
	$(RUN_IN_TEMPDIR) epydoc -v \
437
		--conf $(CURDIR)/epydoc.conf \
438
		--output $(CURDIR)/doc/api
439

    
440
.PHONY: TAGS
441
TAGS:
442
	rm -f TAGS
443
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
444
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
445
	  etags -
446

    
447
# vim: set noet :