Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ fc3fd894

History | View | Annotate | Download (9.9 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
	daemons/ganeti-cleaner \
49
	devel/upload \
50
	doc/rapi-resources.gen \
51
	doc/examples/bash_completion \
52
	doc/examples/ganeti.initd \
53
	doc/examples/ganeti.cron \
54
	lib/*.py[co] \
55
	lib/http/*.py[co] \
56
	lib/hypervisor/*.py[co] \
57
	lib/rapi/*.py[co] \
58
	$(man_MANS) \
59
	$(manhtml) \
60
	qa/*.py[co] \
61
	test/*.py[co] \
62
	stamp-directories \
63
	$(nodist_pkgpython_PYTHON)
64

    
65
nodist_pkgpython_PYTHON = \
66
	lib/_autoconf.py
67

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

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

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

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

    
112

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

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

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

    
126
doc_DATA = $(dochtml)
127

    
128
noinst_DATA = $(manhtml)
129

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

    
143
nodist_sbin_SCRIPTS = \
144
	daemons/ganeti-cleaner
145

    
146
dist_tools_SCRIPTS = \
147
	tools/burnin \
148
	tools/cfgshell \
149
	tools/cfgupgrade \
150
	tools/lvmstrap
151

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

    
189
man_MANS = \
190
	man/ganeti.7 \
191
	man/ganeti-masterd.8 \
192
	man/ganeti-noded.8 \
193
	man/ganeti-os-interface.7 \
194
	man/ganeti-rapi.8 \
195
	man/ganeti-watcher.8 \
196
	man/gnt-backup.8 \
197
	man/gnt-cluster.8 \
198
	man/gnt-debug.8 \
199
	man/gnt-instance.8 \
200
	man/gnt-job.8 \
201
	man/gnt-node.8 \
202
	man/gnt-os.8
203

    
204
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
205
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
206
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
207

    
208
TEST_FILES = \
209
	test/data/bdev-both.txt \
210
	test/data/bdev-8.3-both.txt \
211
	test/data/bdev-disk.txt \
212
	test/data/bdev-net.txt \
213
	test/data/proc_drbd8.txt \
214
	test/data/proc_drbd83.txt
215

    
216
dist_TESTS = \
217
	test/ganeti.bdev_unittest.py \
218
	test/ganeti.cli_unittest.py \
219
	test/ganeti.cmdlib_unittest.py \
220
	test/ganeti.config_unittest.py \
221
	test/ganeti.constants_unittest.py \
222
	test/ganeti.hooks_unittest.py \
223
	test/ganeti.http_unittest.py \
224
	test/ganeti.locking_unittest.py \
225
	test/ganeti.rapi.resources_unittest.py \
226
	test/ganeti.serializer_unittest.py \
227
	test/ganeti.ssh_unittest.py \
228
	test/ganeti.utils_unittest.py \
229
	test/ganeti.workerpool_unittest.py
230

    
231
nodist_TESTS =
232

    
233
TESTS = $(dist_TESTS) $(nodist_TESTS)
234

    
235
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir) $(PYTHON)
236

    
237
RAPI_RESOURCES = $(wildcard lib/rapi/*.py)
238

    
239
all-local: stamp-directories lib/_autoconf.py devel/upload \
240
	doc/examples/bash_completion \
241
	doc/examples/ganeti.initd doc/examples/ganeti.cron
242

    
243
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
244
	sed -f $(REPLACE_VARS_SED) < $< > $@
245
	chmod u+x $@
246

    
247
doc/examples/%: doc/examples/%.in stamp-directories \
248
		$(REPLACE_VARS_SED)
249
	sed -f $(REPLACE_VARS_SED) < $< > $@
250

    
251
daemons/ganeti-cleaner: daemons/ganeti-cleaner.in stamp-directories \
252
		$(REPLACE_VARS_SED)
253
	sed -f $(REPLACE_VARS_SED) < $< > $@
254
	chmod +x $@
255

    
256
doc/%.html: doc/%.rst
257
	@test -n "$(RST2HTML)" || { echo 'rst2html' not found during configure; exit 1; }
258
	$(RST2HTML) $< $@
259

    
260
doc/%.png: doc/%.dot
261
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
262
	$(DOT) -Tpng -o $@ $<
263

    
264
doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
265

    
266
doc/rapi.html: doc/rapi-resources.gen
267

    
268
doc/rapi-resources.gen: $(BUILD_RAPI_RESOURCE_DOC) $(RAPI_RESOURCES)
269
	PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || \
270
	  rm -f $@
271

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

    
280
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
281
	@test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
282
	TMPDIR=`mktemp -d` && { \
283
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
284
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
285
	rm -rf "$$TMPDIR" ; \
286
	}
287

    
288
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
289
	sed -f $(REPLACE_VARS_SED) < $< > $@
290

    
291
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
292
	sed -f $(REPLACE_VARS_SED) < $< > $@
293

    
294
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
295
	sed -f $(REPLACE_VARS_SED) < $< > $@
296

    
297
man/footer.sgml $(TESTS): srclinks
298

    
299
$(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
300

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

    
335
$(REPLACE_VARS_SED): Makefile stamp-directories
336
	set -e; \
337
	{ echo 's#@PREFIX@#$(prefix)#g'; \
338
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
339
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
340
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
341
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
342
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
343
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
344
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
345
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
346
	} > $@
347

    
348
# We need to create symlinks because "make distcheck" will not install Python
349
# files when building.
350
#.PHONY: srclinks
351
srclinks: stamp-directories
352
	set -e; \
353
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
354
			$(rapi_PYTHON) $(http_PYTHON); do \
355
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
356
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
357
		fi; \
358
	done
359

    
360
.PHONY: ganeti
361
ganeti:
362
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
363

    
364
# a dist hook rule for catching revision control directories
365
distcheck-hook:
366
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
367
		echo "Found revision control files in final archive" 1>&2 ; \
368
		exit 1; \
369
	fi
370

    
371
install-exec-local:
372
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
373
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
374
	  "$(DESTDIR)${localstatedir}/run/ganeti"
375

    
376
stamp-directories: Makefile
377
	@mkdir_p@ $(DIRS)
378
	touch $@
379

    
380
.PHONY: apidoc
381
apidoc:
382
	test -e doc/api || mkdir doc/api
383
	TMPDIR=`mktemp -d ` && { \
384
		cp -r scripts daemons lib $$TMPDIR && \
385
		( \
386
			CDIR=`pwd` && \
387
			cd $$TMPDIR && \
388
			mv lib ganeti && \
389
			epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
390
		) ; \
391
		rm -rf $$TMPDIR ; \
392
	}
393

    
394
# vim: set noet :