Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ bae7e531

History | View | Annotate | Download (10 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-cleaner.8 \
192
	man/ganeti-masterd.8 \
193
	man/ganeti-noded.8 \
194
	man/ganeti-os-interface.7 \
195
	man/ganeti-rapi.8 \
196
	man/ganeti-watcher.8 \
197
	man/gnt-backup.8 \
198
	man/gnt-cluster.8 \
199
	man/gnt-debug.8 \
200
	man/gnt-instance.8 \
201
	man/gnt-job.8 \
202
	man/gnt-node.8 \
203
	man/gnt-os.8
204

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

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

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

    
233
nodist_TESTS =
234

    
235
TESTS = $(dist_TESTS) $(nodist_TESTS)
236

    
237
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir) $(PYTHON)
238

    
239
RAPI_RESOURCES = $(wildcard lib/rapi/*.py)
240

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

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

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

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

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

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

    
266
doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
267

    
268
doc/rapi.html: doc/rapi-resources.gen
269

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

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

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

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

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

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

    
299
man/footer.sgml $(TESTS): srclinks
300

    
301
$(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
302

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

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

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

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

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

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

    
378
stamp-directories: Makefile
379
	@mkdir_p@ $(DIRS)
380
	touch $@
381

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

    
396
# vim: set noet :