Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ d6d9ce45

History | View | Annotate | Download (9.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_RAPI_RESOURCE_DOC = $(top_srcdir)/doc/build-rapi-resources-doc
15
REPLACE_VARS_SED = autotools/replace_vars.sed
16

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

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

    
41
MAINTAINERCLEANFILES = \
42
	$(dochtml) \
43
	$(patsubst %.dot,%.png,$(docdot)) \
44
	$(maninput)
45

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

    
64
nodist_pkgpython_PYTHON = \
65
	lib/_autoconf.py
66

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

    
92
hypervisor_PYTHON = \
93
	lib/hypervisor/__init__.py \
94
	lib/hypervisor/hv_base.py \
95
	lib/hypervisor/hv_fake.py \
96
	lib/hypervisor/hv_kvm.py \
97
	lib/hypervisor/hv_xen.py
98

    
99
rapi_PYTHON = \
100
	lib/rapi/__init__.py \
101
	lib/rapi/baserlib.py \
102
	lib/rapi/connector.py \
103
	lib/rapi/rlib2.py
104

    
105
http_PYTHON = \
106
	lib/http/__init__.py \
107
	lib/http/auth.py \
108
	lib/http/client.py \
109
	lib/http/server.py
110

    
111

    
112
docrst = \
113
	doc/admin.rst \
114
	doc/design-2.0.rst \
115
	doc/hooks.rst \
116
	doc/iallocator.rst \
117
	doc/install.rst \
118
	doc/security.rst
119

    
120
dochtml = $(patsubst %.rst,%.html,$(docrst))
121

    
122
docdot = \
123
	doc/arch-2.0.dot
124

    
125
doc_DATA = $(dochtml)
126

    
127
noinst_DATA = $(manhtml)
128

    
129
dist_sbin_SCRIPTS = \
130
	daemons/ganeti-noded \
131
	daemons/ganeti-watcher \
132
	daemons/ganeti-masterd \
133
	daemons/ganeti-rapi \
134
	scripts/gnt-backup \
135
	scripts/gnt-cluster \
136
	scripts/gnt-debug \
137
	scripts/gnt-instance \
138
	scripts/gnt-job \
139
	scripts/gnt-node \
140
	scripts/gnt-os
141

    
142
dist_tools_SCRIPTS = \
143
	tools/burnin \
144
	tools/cfgshell \
145
	tools/cfgupgrade \
146
	tools/lvmstrap
147

    
148
EXTRA_DIST = \
149
	$(MAINTAINERCLEANFILES) \
150
	NEWS \
151
	DEVNOTES \
152
	pylintrc \
153
	autotools/docbook-wrapper \
154
	devel/upload.in \
155
	$(docrst) \
156
	$(docdot) \
157
	doc/build-rapi-resources-doc \
158
	doc/examples/bash_completion.in \
159
	doc/examples/ganeti.initd.in \
160
	doc/examples/ganeti.cron.in \
161
	doc/examples/dumb-allocator \
162
	doc/examples/hooks/ethers \
163
	doc/locking.txt \
164
	test/testutils.py \
165
	test/mocks.py \
166
	$(dist_TESTS) \
167
	$(TEST_FILES) \
168
	man/footer.sgml \
169
	$(mansgml) $(maninput) \
170
	qa/ganeti-qa.py \
171
	qa/qa-sample.json \
172
	qa/qa_cluster.py \
173
	qa/qa_config.py \
174
	qa/qa_daemon.py \
175
	qa/qa_env.py \
176
	qa/qa_error.py \
177
	qa/qa_instance.py \
178
	qa/qa_node.py \
179
	qa/qa_os.py \
180
	qa/qa_rapi.py \
181
	qa/qa_tags.py \
182
	qa/qa_utils.py
183

    
184
man_MANS = \
185
	man/ganeti.7 \
186
	man/ganeti-masterd.8 \
187
	man/ganeti-noded.8 \
188
	man/ganeti-os-interface.7 \
189
	man/ganeti-rapi.8 \
190
	man/ganeti-watcher.8 \
191
	man/gnt-backup.8 \
192
	man/gnt-cluster.8 \
193
	man/gnt-debug.8 \
194
	man/gnt-instance.8 \
195
	man/gnt-job.8 \
196
	man/gnt-node.8 \
197
	man/gnt-os.8
198

    
199
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
200
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
201
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
202

    
203
TEST_FILES = \
204
	test/data/bdev-both.txt \
205
	test/data/bdev-8.3-both.txt \
206
	test/data/bdev-disk.txt \
207
	test/data/bdev-net.txt \
208
	test/data/proc_drbd8.txt \
209
	test/data/proc_drbd83.txt
210

    
211
dist_TESTS = \
212
	test/ganeti.bdev_unittest.py \
213
	test/ganeti.cli_unittest.py \
214
	test/ganeti.cmdlib_unittest.py \
215
	test/ganeti.config_unittest.py \
216
	test/ganeti.constants_unittest.py \
217
	test/ganeti.hooks_unittest.py \
218
	test/ganeti.http_unittest.py \
219
	test/ganeti.locking_unittest.py \
220
	test/ganeti.rapi.resources_unittest.py \
221
	test/ganeti.serializer_unittest.py \
222
	test/ganeti.ssh_unittest.py \
223
	test/ganeti.utils_unittest.py \
224
	test/ganeti.workerpool_unittest.py
225

    
226
nodist_TESTS =
227

    
228
TESTS = $(dist_TESTS) $(nodist_TESTS)
229

    
230
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir) $(PYTHON)
231

    
232
RAPI_RESOURCES = $(wildcard lib/rapi/*.py)
233

    
234
all-local: stamp-directories lib/_autoconf.py devel/upload \
235
	doc/examples/bash_completion \
236
	doc/examples/ganeti.initd doc/examples/ganeti.cron
237

    
238
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
239
	sed -f $(REPLACE_VARS_SED) < $< > $@
240
	chmod u+x $@
241

    
242
doc/examples/%: doc/examples/%.in stamp-directories \
243
		$(REPLACE_VARS_SED)
244
	sed -f $(REPLACE_VARS_SED) < $< > $@
245

    
246
doc/%.html: doc/%.rst
247
	@test -n "$(RST2HTML)" || { echo 'rst2html' not found during configure; exit 1; }
248
	$(RST2HTML) $< $@
249

    
250
doc/%.png: doc/%.dot
251
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
252
	$(DOT) -Tpng -o $@ $<
253

    
254
doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
255

    
256
doc/rapi.html: doc/rapi-resources.gen
257

    
258
doc/rapi-resources.gen: $(BUILD_RAPI_RESOURCE_DOC) $(RAPI_RESOURCES)
259
	PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || \
260
	  rm -f $@
261

    
262
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
263
	@test -n "$(DOCBOOK2MAN)" || { echo 'docbook2html' not found during configure; exit 1; }
264
	TMPDIR=`mktemp -d` && { \
265
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
266
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
267
	rm -rf "$$TMPDIR" ; \
268
	}
269

    
270
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
271
	@test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
272
	TMPDIR=`mktemp -d` && { \
273
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
274
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
275
	rm -rf "$$TMPDIR" ; \
276
	}
277

    
278
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
279
	sed -f $(REPLACE_VARS_SED) < $< > $@
280

    
281
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
282
	sed -f $(REPLACE_VARS_SED) < $< > $@
283

    
284
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
285
	sed -f $(REPLACE_VARS_SED) < $< > $@
286

    
287
man/footer.sgml $(TESTS): srclinks
288

    
289
$(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
290

    
291
lib/_autoconf.py: Makefile stamp-directories
292
	set -e; \
293
	{ echo '# This file is automatically generated, do not edit!'; \
294
	  echo '#'; \
295
	  echo ''; \
296
	  echo '"""Build-time configuration for Ganeti.'; \
297
	  echo '';\
298
	  echo 'This file is autogenerated by the build process.'; \
299
	  echo 'For any changes you need to re-run ./configure (and'; \
300
	  echo 'not edit by hand).'; \
301
	  echo ''; \
302
	  echo '"""'; \
303
	  echo ''; \
304
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
305
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
306
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
307
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
308
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
309
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
310
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
311
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
312
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
313
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
314
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
315
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
316
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
317
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
318
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
319
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
320
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
321
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
322
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)" ; \
323
	} > $@
324

    
325
$(REPLACE_VARS_SED): Makefile stamp-directories
326
	set -e; \
327
	{ echo 's#@PREFIX@#$(prefix)#g'; \
328
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
329
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
330
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
331
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
332
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
333
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
334
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
335
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
336
	} > $@
337

    
338
# We need to create symlinks because "make distcheck" will not install Python
339
# files when building.
340
#.PHONY: srclinks
341
srclinks: stamp-directories
342
	set -e; \
343
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
344
			$(rapi_PYTHON) $(http_PYTHON); do \
345
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
346
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
347
		fi; \
348
	done
349

    
350
.PHONY: ganeti
351
ganeti:
352
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
353

    
354
# a dist hook rule for catching revision control directories
355
distcheck-hook:
356
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
357
		echo "Found revision control files in final archive" 1>&2 ; \
358
		exit 1; \
359
	fi
360

    
361
install-exec-local:
362
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
363
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
364
	  "$(DESTDIR)${localstatedir}/run/ganeti"
365

    
366
stamp-directories: Makefile
367
	@mkdir_p@ $(DIRS)
368
	touch $@
369

    
370
.PHONY: apidoc
371
apidoc:
372
	test -e doc/api || mkdir doc/api
373
	TMPDIR=`mktemp -d ` && { \
374
		cp -r scripts daemons lib $$TMPDIR && \
375
		( \
376
			CDIR=`pwd` && \
377
			cd $$TMPDIR && \
378
			mv lib ganeti && \
379
			epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
380
		) ; \
381
		rm -rf $$TMPDIR ; \
382
	}
383

    
384
# vim: set noet :