Makefile.am 13.4 KB
Newer Older
D
Daniel P. Berrange 已提交
1 2
## Process this file with automake to produce Makefile.in

3
## Copyright (C) 2005-2013 Red Hat, Inc.
E
Eric Blake 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library.  If not, see
## <http://www.gnu.org/licenses/>.
18

19
INCLUDES = \
20 21 22
	-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
	-I$(top_builddir)/include -I$(top_srcdir)/include \
	-I$(top_builddir)/src -I$(top_srcdir)/src \
23 24 25 26
	-I$(top_srcdir)/src/util \
	-I$(top_srcdir)/src/conf \
	-I$(top_srcdir)/src/rpc \
	-I$(top_srcdir)/src/remote \
27
	-I$(top_srcdir)/src/access \
28 29
	$(GETTEXT_CPPFLAGS)

30 31
CLEANFILES =

E
Eric Blake 已提交
32 33 34 35
DAEMON_GENERATED =			\
		remote_dispatch.h	\
		lxc_dispatch.h		\
		qemu_dispatch.h		\
36
		$(NULL)
37 38 39 40 41 42

DAEMON_SOURCES =					\
		libvirtd.c libvirtd.h			\
		remote.c remote.h			\
		stream.c stream.h			\
		$(DAEMON_GENERATED)
43

44 45
LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h

46
DISTCLEANFILES =
47
EXTRA_DIST =						\
48
	remote_dispatch.h				\
49
	lxc_dispatch.h					\
50
	qemu_dispatch.h					\
51 52
	libvirtd.conf					\
	libvirtd.init.in				\
A
Alan Pevec 已提交
53
	libvirtd.upstart				\
C
Cole Robinson 已提交
54
	libvirtd.policy.in				\
55
	libvirtd.sasl					\
56
	libvirtd.service.in				\
57
	libvirtd.sysconf				\
E
Eric Blake 已提交
58
	libvirtd.sysctl					\
59
	libvirtd.aug                                    \
60
	libvirtd.logrotate.in                           \
61 62 63
	libvirtd.qemu.logrotate.in                      \
	libvirtd.lxc.logrotate.in                       \
	libvirtd.uml.logrotate.in                       \
64
	test_libvirtd.aug.in                             \
65
	THREADS.txt					\
66
	libvirtd.pod.in					\
67
	libvirtd.8.in					\
68 69 70
	$(DAEMON_SOURCES)				\
	$(LIBVIRTD_CONF_SOURCES)			\
	$(NULL)
71

72
BUILT_SOURCES =
73

74
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
75
LXC_PROTOCOL = $(top_srcdir)/src/remote/lxc_protocol.x
76 77
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x

E
Eric Blake 已提交
78
remote_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
79
		$(REMOTE_PROTOCOL)
80
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
E
Eric Blake 已提交
81 82
	  --mode=server remote REMOTE $(REMOTE_PROTOCOL) \
	  > $(srcdir)/remote_dispatch.h
83

E
Eric Blake 已提交
84
lxc_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
85
		$(LXC_PROTOCOL)
86
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
E
Eric Blake 已提交
87 88
	  --mode=server lxc LXC $(LXC_PROTOCOL) \
	  > $(srcdir)/lxc_dispatch.h
89

E
Eric Blake 已提交
90
qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
91
		$(QEMU_PROTOCOL)
92
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
E
Eric Blake 已提交
93 94
	  --mode=server qemu QEMU $(QEMU_PROTOCOL) \
	  > $(srcdir)/qemu_dispatch.h
95

96 97
if WITH_LIBVIRTD

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
# Build a convenience library, for reuse in tests/libvirtdconftest
noinst_LTLIBRARIES = libvirtd_conf.la
libvirtd_conf_la_SOURCES = $(LIBVIRTD_CONF_SOURCES)
libvirtd_conf_la_CFLAGS = \
	$(LIBXML_CFLAGS) \
	$(WARN_CFLAGS) $(PIE_CFLAGS) \
	$(COVERAGE_CFLAGS) \
	$(NULL)
libvirtd_conf_la_LDFLAGS =				\
	$(RELRO_LDFLAGS)				\
	$(PIE_LDFLAGS)					\
	$(COVERAGE_LDFLAGS)				\
	$(NO_INDIRECT_LDFLAGS)				\
	$(NULL)
libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)

114
man8_MANS = libvirtd.8
115

116 117 118 119
sbin_PROGRAMS = libvirtd

confdir = $(sysconfdir)/libvirt/
conf_DATA = libvirtd.conf
120

121
augeasdir = $(datadir)/augeas/lenses
122
augeas_DATA = libvirtd.aug
123 124

augeastestsdir = $(datadir)/augeas/lenses/tests
125
augeastests_DATA = test_libvirtd.aug
126

127 128
CLEANFILES += test_libvirtd.aug

129
libvirtd.8: $(srcdir)/libvirtd.8.in
130
	$(AM_V_GEN)sed \
131 132
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
133
	    < $< > $@-t && \
134 135
	mv $@-t $@

136
libvirtd_SOURCES = $(DAEMON_SOURCES)
137

D
Daniel P. Berrange 已提交
138
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
139
libvirtd_CFLAGS = \
140
	$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
D
Doug Goldstein 已提交
141
	$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
D
Daniel P. Berrange 已提交
142
	$(WARN_CFLAGS) $(PIE_CFLAGS) \
143
	$(COVERAGE_CFLAGS) \
144
	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
145

E
Eric Blake 已提交
146
libvirtd_LDFLAGS =					\
G
Guido Günther 已提交
147
	$(RELRO_LDFLAGS)				\
D
Daniel P. Berrange 已提交
148
	$(PIE_LDFLAGS)					\
G
Guido Günther 已提交
149
	$(COVERAGE_LDFLAGS)				\
150
	$(NO_INDIRECT_LDFLAGS)				\
G
Guido Günther 已提交
151
	$(NULL)
152

153
libvirtd_LDADD =					\
154 155 156
	$(LIBXML_LIBS)					\
	$(GNUTLS_LIBS)					\
	$(SASL_LIBS)					\
157
	$(DBUS_LIBS)					\
D
Doug Goldstein 已提交
158 159
	$(POLKIT_LIBS)					\
	$(LIBNL_LIBS)
160

161
if WITH_DTRACE_PROBES
162
libvirtd_LDADD += ../src/libvirt_probes.lo
163
endif WITH_DTRACE_PROBES
164

165
libvirtd_LDADD += \
166
	libvirtd_conf.la \
167
	../src/libvirt-lxc.la \
168 169 170
	../src/libvirt-qemu.la \
	../src/libvirt_driver_remote.la \
	$(NULL)
C
Chris Lalancette 已提交
171

172
if ! WITH_DRIVER_MODULES
173
if WITH_QEMU
174
    libvirtd_LDADD += ../src/libvirt_driver_qemu.la
175
if WITH_DTRACE_PROBES
176
    libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
177 178
endif WITH_DTRACE_PROBES
endif WITH_QEMU
179

180
if WITH_LXC
181
    libvirtd_LDADD += ../src/libvirt_driver_lxc.la
182
endif WITH_LXC
183

184 185
if WITH_XEN
    libvirtd_LDADD += ../src/libvirt_driver_xen.la
186
endif WITH_XEN
187

J
Jim Fehlig 已提交
188 189
if WITH_LIBXL
    libvirtd_LDADD += ../src/libvirt_driver_libxl.la
190
endif WITH_LIBXL
J
Jim Fehlig 已提交
191

192
if WITH_UML
193
    libvirtd_LDADD += ../src/libvirt_driver_uml.la
194
endif WITH_UML
195

J
Jiri Denemark 已提交
196 197
if WITH_VBOX
    libvirtd_LDADD += ../src/libvirt_driver_vbox.la
198
endif WITH_VBOX
J
Jiri Denemark 已提交
199

200
if WITH_STORAGE
201
    libvirtd_LDADD += ../src/libvirt_driver_storage.la
202
endif WITH_STORAGE
203

204
if WITH_NETWORK
205
    libvirtd_LDADD += ../src/libvirt_driver_network.la
206
endif WITH_NETWORK
207

208
if WITH_INTERFACE
209
    libvirtd_LDADD += ../src/libvirt_driver_interface.la
210
endif WITH_INTERFACE
211

212
if WITH_NODE_DEVICES
213
    libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
214
endif WITH_NODE_DEVICES
215 216 217

if WITH_SECRETS
    libvirtd_LDADD += ../src/libvirt_driver_secret.la
218
endif WITH_SECRETS
219 220 221

if WITH_NWFILTER
    libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
222 223
endif WITH_NWFILTER
endif ! WITH_DRIVER_MODULES
224 225

libvirtd_LDADD += ../src/libvirt.la
D
Daniel P. Berrange 已提交
226

227 228
if WITH_POLKIT
if WITH_POLKIT0
229
policydir = $(datadir)/PolicyKit/policy
C
Cole Robinson 已提交
230
policyauth = auth_admin_keep_session
231
else ! WITH_POLKIT0
232
policydir = $(datadir)/polkit-1/actions
C
Cole Robinson 已提交
233
policyauth = auth_admin_keep
234 235
endif ! WITH_POLKIT0
endif WITH_POLKIT
236

C
Cole Robinson 已提交
237 238
libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
	$(AM_V_GEN) sed \
239
	    -e 's|[@]authaction[@]|$(policyauth)|g' \
C
Cole Robinson 已提交
240 241 242 243
	    < $< > $@-t && \
	mv $@-t $@
BUILT_SOURCES += libvirtd.policy

244 245
install-data-local: install-init-redhat install-init-systemd \
		install-init-upstart \
246 247
		install-data-sasl install-data-polkit \
		install-logrotate install-sysctl
248 249 250
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
		   $(DESTDIR)$(localstatedir)/run/libvirt \
		   $(DESTDIR)$(localstatedir)/lib/libvirt
251

252 253
uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
		uninstall-init-upstart \
254
		uninstall-data-sasl uninstall-data-polkit \
255
		uninstall-logrotate uninstall-sysctl
256
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
257
	rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
258
	rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
259

260
if WITH_POLKIT
261
install-data-polkit::
262
	$(MKDIR_P) $(DESTDIR)$(policydir)
C
Cole Robinson 已提交
263
	$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
264
uninstall-data-polkit::
265
	rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
266
	rmdir $(DESTDIR)$(policydir) || :
267
else ! WITH_POLKIT
268 269
install-data-polkit::
uninstall-data-polkit::
270
endif ! WITH_POLKIT
271

272 273
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
274

275
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
276
		  libvirtd.uml.logrotate libvirtd.logrotate
277

278 279
BUILT_SOURCES += $(LOGROTATE_CONFS)

280
libvirtd.logrotate: libvirtd.logrotate.in
281
	$(AM_V_GEN)sed						\
282
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
283
	    < $< > $@-t && \
284 285
	mv $@-t $@

286
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
287
	$(AM_V_GEN)sed						\
288
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
289
	    < $< > $@-t && \
290 291 292
	mv $@-t $@

libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
293
	$(AM_V_GEN)sed						\
294
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
295 296
	    < $< > $@-t &&					\
	    mv $@-t $@
297 298

libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
299
	$(AM_V_GEN)sed						\
300
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
301 302
	    < $< > $@-t &&					\
	    mv $@-t $@
G
Guido Günther 已提交
303

304
install-logrotate: $(LOGROTATE_CONFS)
305 306 307 308
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
		   $(DESTDIR)$(sysconfdir)/logrotate.d/
309 310 311 312 313 314 315 316
	$(INSTALL_DATA) libvirtd.logrotate \
		$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
	$(INSTALL_DATA) libvirtd.qemu.logrotate \
		$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
	$(INSTALL_DATA) libvirtd.lxc.logrotate \
		$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
	$(INSTALL_DATA) libvirtd.uml.logrotate \
		$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
G
Guido Günther 已提交
317

318 319 320 321 322 323 324 325 326 327
uninstall-logrotate:
	rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd \
	      $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu \
	      $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc \
	      $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt/qemu || :
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt/lxc || :
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt/uml || :
	rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :

328
install-sysconfig:
329
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
330
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
J
Jim Meyering 已提交
331
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
332 333
uninstall-sysconfig:
	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
334
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
335

336
if WITH_SYSCTL
337 338
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
339
install-sysctl:
340
	$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
E
Eric Blake 已提交
341
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
342
	  $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
343

344
uninstall-sysctl:
345 346
	rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
	rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
347
else ! WITH_SYSCTL
348 349
install-sysctl:
uninstall-sysctl:
350
endif ! WITH_SYSCTL
351 352

if LIBVIRT_INIT_SCRIPT_RED_HAT
D
Daniel P. Berrange 已提交
353

354
BUILT_SOURCES += libvirtd.init
355

356
install-init-redhat: install-sysconfig libvirtd.init
357
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
358 359 360 361 362
	$(INSTALL_SCRIPT) libvirtd.init \
	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd

uninstall-init-redhat: uninstall-sysconfig
	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
363
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
364
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
365 366
install-init-redhat:
uninstall-init-redhat:
367
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
368 369 370 371 372


if LIBVIRT_INIT_SCRIPT_UPSTART

install-init-upstart: install-sysconfig
373
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
374 375 376 377 378
	$(INSTALL_SCRIPT) libvirtd.upstart \
	  $(DESTDIR)$(sysconfdir)/event.d/libvirtd

uninstall-init-upstart: uninstall-sysconfig
	rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
379
	rmdir $(DESTDIR)$(sysconfdir)/event.d || :
380
else ! LIBVIRT_INIT_SCRIPT_UPSTART
381 382
install-init-upstart:
uninstall-init-upstart:
383
endif ! LIBVIRT_INIT_SCRIPT_UPSTART
384 385 386 387 388 389 390 391


if LIBVIRT_INIT_SCRIPT_SYSTEMD

SYSTEMD_UNIT_DIR = /lib/systemd/system
BUILT_SOURCES += libvirtd.service

install-init-systemd: install-sysconfig libvirtd.service
392
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
393
	$(INSTALL_DATA) libvirtd.service \
394 395 396 397
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service

uninstall-init-systemd: uninstall-sysconfig
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
398
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
399
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
400 401
install-init-systemd:
uninstall-init-systemd:
402
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
403

404
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
405 406 407 408 409 410
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
	    chmod a+x $@-t &&					\
411
	    mv $@-t $@
D
Daniel P. Berrange 已提交
412

413
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
414 415 416 417 418
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
419 420 421
	    mv $@-t $@


422 423
check-local: check-augeas

424 425 426 427
AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl

test_libvirtd.aug: test_libvirtd.aug.in $(srcdir)/libvirtd.conf
	$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libvirtd.conf $< $@
428 429

check-augeas: test_libvirtd.aug
430
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
431
	  '$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \
432
	fi
433

434

435 436
# This must be added last, since functions it provides/replaces
# are used by nearly every other library.
J
John Levon 已提交
437
libvirtd_LDADD += ../gnulib/lib/libgnu.la $(LIBSOCKET)
438

439
else ! WITH_LIBVIRTD
440 441
install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
442
endif ! WITH_LIBVIRTD
443

444 445 446
POD2MAN = pod2man -c "Virtualization Support" \
			-r "$(PACKAGE)-$(VERSION)" -s 8

447
$(srcdir)/libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac
E
Eric Blake 已提交
448 449
	$(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \
	    && if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
450

451 452
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
453
if WITH_SASL
454
install-data-sasl:
455
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
456 457
	$(INSTALL_DATA) $(srcdir)/libvirtd.sasl \
		$(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
458 459 460

uninstall-data-sasl:
	rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
D
Dave Allan 已提交
461
	rmdir $(DESTDIR)$(sysconfdir)/sasl2/ || :
462
else ! WITH_SASL
D
Daniel P. Berrange 已提交
463 464
install-data-sasl:
uninstall-data-sasl:
465
endif ! WITH_SASL
466 467


468
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
469
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
470
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)