Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 434c34a5

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

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

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

    
43
MAINTAINERCLEANFILES = \
44
	$(docpng) \
45
	$(maninput)
46

    
47
maintainer-clean-local:
48
	-rm -rf doc/api doc/build doc/html
49

    
50
CLEANFILES = \
51
	autotools/replace_vars.sed \
52
	devel/upload \
53
	doc/examples/bash_completion \
54
	doc/examples/ganeti.initd \
55
	doc/examples/ganeti.cron \
56
	lib/*.py[co] \
57
	lib/http/*.py[co] \
58
	lib/hypervisor/*.py[co] \
59
	lib/rapi/*.py[co] \
60
	$(man_MANS) \
61
	$(manhtml) \
62
	qa/*.py[co] \
63
	test/*.py[co] \
64
	stamp-directories \
65
	$(nodist_pkgpython_PYTHON)
66

    
67
nodist_pkgpython_PYTHON = \
68
	lib/_autoconf.py
69

    
70
pkgpython_PYTHON = \
71
	lib/__init__.py \
72
	lib/asyncnotifier.py \
73
	lib/backend.py \
74
	lib/bdev.py \
75
	lib/bootstrap.py \
76
	lib/cli.py \
77
	lib/cmdlib.py \
78
	lib/config.py \
79
	lib/constants.py \
80
	lib/daemon.py \
81
	lib/errors.py \
82
	lib/jqueue.py \
83
	lib/jstore.py \
84
	lib/locking.py \
85
	lib/luxi.py \
86
	lib/mcpu.py \
87
	lib/objects.py \
88
	lib/opcodes.py \
89
	lib/rpc.py \
90
	lib/serializer.py \
91
	lib/ssconf.py \
92
	lib/ssh.py \
93
	lib/storage.py \
94
	lib/utils.py \
95
	lib/workerpool.py
96

    
97
hypervisor_PYTHON = \
98
	lib/hypervisor/__init__.py \
99
	lib/hypervisor/hv_base.py \
100
	lib/hypervisor/hv_chroot.py \
101
	lib/hypervisor/hv_fake.py \
102
	lib/hypervisor/hv_kvm.py \
103
	lib/hypervisor/hv_xen.py
104

    
105
rapi_PYTHON = \
106
	lib/rapi/__init__.py \
107
	lib/rapi/baserlib.py \
108
	lib/rapi/connector.py \
109
	lib/rapi/rlib2.py
110

    
111
http_PYTHON = \
112
	lib/http/__init__.py \
113
	lib/http/auth.py \
114
	lib/http/client.py \
115
	lib/http/server.py
116

    
117
confd_PYTHON = \
118
	lib/confd/__init__.py \
119
	lib/confd/server.py \
120
	lib/confd/querylib.py
121

    
122
docrst = \
123
	doc/admin.rst \
124
	doc/design-2.0.rst \
125
	doc/design-2.1.rst \
126
	doc/glossary.rst \
127
	doc/hooks.rst \
128
	doc/iallocator.rst \
129
	doc/index.rst \
130
	doc/install.rst \
131
	doc/rapi.rst \
132
	doc/security.rst
133

    
134
doc/html: $(docrst) $(docpng) doc/conf.py configure.ac
135
	@test -n "$(SPHINX)" || \
136
	    { echo 'sphinx-build' not found during configure; exit 1; }
137
	mkdir -p doc/build/doctrees
138
	PYTHONPATH=.:$(top_builddir) sphinx-build -q -b html \
139
	    -d doc/build/doctrees \
140
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
141
	    -D release="$(PACKAGE_VERSION)" \
142
	    $(top_srcdir)/doc doc/html
143
	touch "$@"
144

    
145
docdot = \
146
	doc/arch-2.0.dot
147

    
148
docpng = $(patsubst %.dot,%.png,$(docdot))
149

    
150
noinst_DATA = $(manhtml) doc/html
151

    
152
gnt_scripts = \
153
	scripts/gnt-backup \
154
	scripts/gnt-cluster \
155
	scripts/gnt-debug \
156
	scripts/gnt-instance \
157
	scripts/gnt-job \
158
	scripts/gnt-node \
159
	scripts/gnt-os
160

    
161
dist_sbin_SCRIPTS = \
162
	daemons/ganeti-noded \
163
	daemons/ganeti-watcher \
164
	daemons/ganeti-masterd \
165
	daemons/ganeti-confd \
166
	daemons/ganeti-rapi \
167
	$(gnt_scripts)
168

    
169
dist_tools_SCRIPTS = \
170
	tools/burnin \
171
	tools/cfgshell \
172
	tools/cfgupgrade \
173
	tools/lvmstrap
174

    
175
EXTRA_DIST = \
176
	$(MAINTAINERCLEANFILES) \
177
	NEWS \
178
	DEVNOTES \
179
	pylintrc \
180
	autotools/docbook-wrapper \
181
	devel/upload.in \
182
	$(docdot) \
183
	$(docrst) \
184
	doc/conf.py \
185
	doc/html \
186
	doc/examples/ganeti.initd.in \
187
	doc/examples/ganeti.cron.in \
188
	doc/examples/dumb-allocator \
189
	doc/examples/hooks/ethers \
190
	doc/locking.txt \
191
	test/testutils.py \
192
	test/mocks.py \
193
	$(dist_TESTS) \
194
	$(TEST_FILES) \
195
	man/footer.sgml \
196
	$(mansgml) $(maninput) \
197
	qa/ganeti-qa.py \
198
	qa/qa-sample.json \
199
	qa/qa_cluster.py \
200
	qa/qa_config.py \
201
	qa/qa_daemon.py \
202
	qa/qa_env.py \
203
	qa/qa_error.py \
204
	qa/qa_instance.py \
205
	qa/qa_node.py \
206
	qa/qa_os.py \
207
	qa/qa_rapi.py \
208
	qa/qa_tags.py \
209
	qa/qa_utils.py
210

    
211
man_MANS = \
212
	man/ganeti.7 \
213
	man/ganeti-masterd.8 \
214
	man/ganeti-noded.8 \
215
	man/ganeti-os-interface.7 \
216
	man/ganeti-rapi.8 \
217
	man/ganeti-watcher.8 \
218
	man/gnt-backup.8 \
219
	man/gnt-cluster.8 \
220
	man/gnt-debug.8 \
221
	man/gnt-instance.8 \
222
	man/gnt-job.8 \
223
	man/gnt-node.8 \
224
	man/gnt-os.8
225

    
226
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
227
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
228
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
229

    
230
TEST_FILES = \
231
	test/data/bdev-both.txt \
232
	test/data/bdev-8.3-both.txt \
233
	test/data/bdev-disk.txt \
234
	test/data/bdev-net.txt \
235
	test/data/proc_drbd8.txt \
236
	test/data/proc_drbd83.txt
237

    
238
dist_TESTS = \
239
	test/ganeti.bdev_unittest.py \
240
	test/ganeti.cli_unittest.py \
241
	test/ganeti.cmdlib_unittest.py \
242
	test/ganeti.config_unittest.py \
243
	test/ganeti.constants_unittest.py \
244
	test/ganeti.hooks_unittest.py \
245
	test/ganeti.http_unittest.py \
246
	test/ganeti.locking_unittest.py \
247
	test/ganeti.objects_unittest.py \
248
	test/ganeti.rapi.resources_unittest.py \
249
	test/ganeti.serializer_unittest.py \
250
	test/ganeti.ssh_unittest.py \
251
	test/ganeti.utils_unittest.py \
252
	test/ganeti.workerpool_unittest.py
253

    
254
nodist_TESTS =
255

    
256
TESTS = $(dist_TESTS) $(nodist_TESTS)
257

    
258
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir) $(PYTHON)
259

    
260
all-local: stamp-directories lib/_autoconf.py devel/upload \
261
	doc/examples/bash_completion \
262
	doc/examples/ganeti.initd doc/examples/ganeti.cron
263

    
264
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
265
	sed -f $(REPLACE_VARS_SED) < $< > $@
266
	chmod u+x $@
267

    
268
doc/examples/%: doc/examples/%.in stamp-directories \
269
		$(REPLACE_VARS_SED)
270
	sed -f $(REPLACE_VARS_SED) < $< > $@
271

    
272
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) lib/_autoconf.py \
273
	lib/cli.py $(gnt_scripts) tools/burnin
274
	TMPDIR=`mktemp -d ./buildtmpXXXXXX` && \
275
	cp -r scripts lib tools $$TMPDIR && \
276
	( \
277
		CDIR=`pwd` && \
278
		cd $$TMPDIR && \
279
		mv lib ganeti && \
280
		PYTHONPATH=. $$CDIR/$(BUILD_BASH_COMPLETION) > $$CDIR/$@; \
281
	); \
282
	rm -rf $$TMPDIR
283

    
284
doc/%.png: doc/%.dot
285
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
286
	$(DOT) -Tpng -o $@ $<
287

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

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

    
296
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
297
	sed -f $(REPLACE_VARS_SED) < $< > $@
298

    
299
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
300
	sed -f $(REPLACE_VARS_SED) < $< > $@
301

    
302
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
303
	sed -f $(REPLACE_VARS_SED) < $< > $@
304

    
305
man/footer.sgml $(TESTS): srclinks
306

    
307
$(TESTS): ganeti lib/_autoconf.py
308

    
309
lib/_autoconf.py: Makefile stamp-directories
310
	set -e; \
311
	{ echo '# This file is automatically generated, do not edit!'; \
312
	  echo '#'; \
313
	  echo ''; \
314
	  echo '"""Build-time configuration for Ganeti.'; \
315
	  echo '';\
316
	  echo 'This file is autogenerated by the build process.'; \
317
	  echo 'For any changes you need to re-run ./configure (and'; \
318
	  echo 'not edit by hand).'; \
319
	  echo ''; \
320
	  echo '"""'; \
321
	  echo ''; \
322
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
323
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
324
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
325
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
326
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
327
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
328
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
329
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
330
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
331
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
332
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
333
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
334
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
335
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
336
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
337
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
338
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
339
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
340
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
341
	  echo "TOOLSDIR = '$(toolsdir)'"; \
342
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
343
	} > $@
344

    
345
$(REPLACE_VARS_SED): Makefile stamp-directories
346
	set -e; \
347
	{ echo 's#@PREFIX@#$(prefix)#g'; \
348
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
349
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
350
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
351
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
352
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
353
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
354
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
355
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
356
	} > $@
357

    
358
# We need to create symlinks because "make distcheck" will not install Python
359
# files when building.
360
#.PHONY: srclinks
361
srclinks: stamp-directories
362
	set -e; \
363
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
364
			$(rapi_PYTHON) $(http_PYTHON) $(confd_PYTHON); do \
365
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
366
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
367
		fi; \
368
	done
369

    
370
.PHONY: ganeti
371
ganeti:
372
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
373

    
374
# a dist hook rule for catching revision control directories
375
distcheck-hook:
376
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
377
		echo "Found revision control files in final archive" 1>&2 ; \
378
		exit 1; \
379
	fi
380

    
381
install-exec-local:
382
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
383
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
384
	  "$(DESTDIR)${localstatedir}/run/ganeti"
385

    
386
stamp-directories: Makefile
387
	@mkdir_p@ $(DIRS)
388
	touch $@
389

    
390
.PHONY: apidoc
391
apidoc:
392
	test -e doc/api || mkdir doc/api
393
	TMPDIR=`mktemp -d ` && { \
394
		cp -r scripts daemons lib $$TMPDIR && \
395
		( \
396
			CDIR=`pwd` && \
397
			cd $$TMPDIR && \
398
			mv lib ganeti && \
399
			epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
400
		) ; \
401
		rm -rf $$TMPDIR ; \
402
	}
403

    
404
.PHONY: TAGS
405
TAGS:
406
	rm -f TAGS
407
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
408
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
409
	  etags -
410

    
411
# vim: set noet :