Makefile.am 13.0 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

DAEMON_SOURCES =					\
		libvirtd.c libvirtd.h			\
40
		libvirtd-config.c libvirtd-config.h	\
41 42
		remote.c remote.h			\
		stream.c stream.h			\
C
Chris Lalancette 已提交
43
		../src/remote/remote_protocol.c		\
44
		../src/remote/lxc_protocol.c		\
45 46
		../src/remote/qemu_protocol.c		\
		$(DAEMON_GENERATED)
47

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

100 101 102 103
sbin_PROGRAMS = libvirtd

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

105
augeasdir = $(datadir)/augeas/lenses
106
augeas_DATA = libvirtd.aug
107 108

augeastestsdir = $(datadir)/augeas/lenses/tests
109
augeastests_DATA = test_libvirtd.aug
110

111 112
CLEANFILES += test_libvirtd.aug

113
libvirtd.8: $(srcdir)/libvirtd.8.in
114
	$(AM_V_GEN)sed \
115 116
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
117
	    < $< > $@-t && \
118 119
	mv $@-t $@

120
libvirtd_SOURCES = $(DAEMON_SOURCES)
121

D
Daniel P. Berrange 已提交
122
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
123
libvirtd_CFLAGS = \
124
	$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
D
Doug Goldstein 已提交
125
	$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
D
Daniel P. Berrange 已提交
126
	$(WARN_CFLAGS) $(PIE_CFLAGS) \
127
	$(COVERAGE_CFLAGS) \
128
	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
129

E
Eric Blake 已提交
130
libvirtd_LDFLAGS =					\
G
Guido Günther 已提交
131
	$(RELRO_LDFLAGS)				\
D
Daniel P. Berrange 已提交
132
	$(PIE_LDFLAGS)					\
D
Daniel P. Berrange 已提交
133
	$(RELRO_LDFLAGS)				\
G
Guido Günther 已提交
134
	$(COVERAGE_LDFLAGS)				\
135
	$(NO_INDIRECT_LDFLAGS)				\
G
Guido Günther 已提交
136
	$(NULL)
137

138
libvirtd_LDADD =					\
139 140 141
	$(LIBXML_LIBS)					\
	$(GNUTLS_LIBS)					\
	$(SASL_LIBS)					\
142
	$(DBUS_LIBS)					\
D
Doug Goldstein 已提交
143 144
	$(POLKIT_LIBS)					\
	$(LIBNL_LIBS)
145

146
if WITH_DTRACE_PROBES
147
libvirtd_LDADD += ../src/libvirt_probes.lo
148
endif WITH_DTRACE_PROBES
149

150
libvirtd_LDADD += \
151
	../src/libvirt-lxc.la \
152
	../src/libvirt-qemu.la
C
Chris Lalancette 已提交
153

154
if ! WITH_DRIVER_MODULES
155
if WITH_QEMU
156
    libvirtd_LDADD += ../src/libvirt_driver_qemu.la
157
if WITH_DTRACE_PROBES
158
    libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
159 160
endif WITH_DTRACE_PROBES
endif WITH_QEMU
161

162
if WITH_LXC
163
    libvirtd_LDADD += ../src/libvirt_driver_lxc.la
164
endif WITH_LXC
165

166 167
if WITH_XEN
    libvirtd_LDADD += ../src/libvirt_driver_xen.la
168
endif WITH_XEN
169

J
Jim Fehlig 已提交
170 171
if WITH_LIBXL
    libvirtd_LDADD += ../src/libvirt_driver_libxl.la
172
endif WITH_LIBXL
J
Jim Fehlig 已提交
173

174
if WITH_UML
175
    libvirtd_LDADD += ../src/libvirt_driver_uml.la
176
endif WITH_UML
177

J
Jiri Denemark 已提交
178 179
if WITH_VBOX
    libvirtd_LDADD += ../src/libvirt_driver_vbox.la
180
endif WITH_VBOX
J
Jiri Denemark 已提交
181

182
if WITH_STORAGE
183
    libvirtd_LDADD += ../src/libvirt_driver_storage.la
184
endif WITH_STORAGE
185

186
if WITH_NETWORK
187
    libvirtd_LDADD += ../src/libvirt_driver_network.la
188
endif WITH_NETWORK
189

190
if WITH_INTERFACE
191
    libvirtd_LDADD += ../src/libvirt_driver_interface.la
192
endif WITH_INTERFACE
193

194
if WITH_NODE_DEVICES
195
    libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
196
endif WITH_NODE_DEVICES
197 198 199

if WITH_SECRETS
    libvirtd_LDADD += ../src/libvirt_driver_secret.la
200
endif WITH_SECRETS
201 202 203

if WITH_NWFILTER
    libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
204 205
endif WITH_NWFILTER
endif ! WITH_DRIVER_MODULES
206 207

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

209 210
if WITH_POLKIT
if WITH_POLKIT0
211
policydir = $(datadir)/PolicyKit/policy
C
Cole Robinson 已提交
212
policyauth = auth_admin_keep_session
213
else ! WITH_POLKIT0
214
policydir = $(datadir)/polkit-1/actions
C
Cole Robinson 已提交
215
policyauth = auth_admin_keep
216 217
endif ! WITH_POLKIT0
endif WITH_POLKIT
218

C
Cole Robinson 已提交
219 220
libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
	$(AM_V_GEN) sed \
221
	    -e 's|[@]authaction[@]|$(policyauth)|g' \
C
Cole Robinson 已提交
222 223 224 225
	    < $< > $@-t && \
	mv $@-t $@
BUILT_SOURCES += libvirtd.policy

226 227
install-data-local: install-init-redhat install-init-systemd \
		install-init-upstart \
228 229
		install-data-sasl install-data-polkit \
		install-logrotate install-sysctl
230 231 232
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
		   $(DESTDIR)$(localstatedir)/run/libvirt \
		   $(DESTDIR)$(localstatedir)/lib/libvirt
233

234 235
uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
		uninstall-init-upstart \
236
		uninstall-data-sasl uninstall-data-polkit \
237
		uninstall-logrotate uninstall-sysctl
238
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
239
	rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
240
	rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
241

242
if WITH_POLKIT
243
install-data-polkit::
244
	$(MKDIR_P) $(DESTDIR)$(policydir)
C
Cole Robinson 已提交
245
	$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
246
uninstall-data-polkit::
247
	rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
248
	rmdir $(DESTDIR)$(policydir) || :
249
else ! WITH_POLKIT
250 251
install-data-polkit::
uninstall-data-polkit::
252
endif ! WITH_POLKIT
253

254 255
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
256

257
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
258
		  libvirtd.uml.logrotate libvirtd.logrotate
259

260 261
BUILT_SOURCES += $(LOGROTATE_CONFS)

262
libvirtd.logrotate: libvirtd.logrotate.in
263
	$(AM_V_GEN)sed						\
264
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
265
	    < $< > $@-t && \
266 267
	mv $@-t $@

268
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
269
	$(AM_V_GEN)sed						\
270
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
271
	    < $< > $@-t && \
272 273 274
	mv $@-t $@

libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
275
	$(AM_V_GEN)sed						\
276
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
277 278
	    < $< > $@-t &&					\
	    mv $@-t $@
279 280

libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
281
	$(AM_V_GEN)sed						\
282
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
283 284
	    < $< > $@-t &&					\
	    mv $@-t $@
G
Guido Günther 已提交
285

286
install-logrotate: $(LOGROTATE_CONFS)
287 288 289 290
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
		   $(DESTDIR)$(sysconfdir)/logrotate.d/
291 292 293 294 295 296 297 298
	$(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 已提交
299

300 301 302 303 304 305 306 307 308 309
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 || :

310
install-sysconfig:
311
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
312
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
J
Jim Meyering 已提交
313
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
314 315
uninstall-sysconfig:
	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
316
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
317

318
if WITH_SYSCTL
319 320
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
321
install-sysctl:
322
	$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
E
Eric Blake 已提交
323
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
324
	  $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
325

326
uninstall-sysctl:
327 328
	rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
	rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
329
else ! WITH_SYSCTL
330 331
install-sysctl:
uninstall-sysctl:
332
endif ! WITH_SYSCTL
333 334

if LIBVIRT_INIT_SCRIPT_RED_HAT
D
Daniel P. Berrange 已提交
335

336
BUILT_SOURCES += libvirtd.init
337

338
install-init-redhat: install-sysconfig libvirtd.init
339
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
340 341 342 343 344
	$(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
345
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
346
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
347 348
install-init-redhat:
uninstall-init-redhat:
349
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
350 351 352 353 354


if LIBVIRT_INIT_SCRIPT_UPSTART

install-init-upstart: install-sysconfig
355
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
356 357 358 359 360
	$(INSTALL_SCRIPT) libvirtd.upstart \
	  $(DESTDIR)$(sysconfdir)/event.d/libvirtd

uninstall-init-upstart: uninstall-sysconfig
	rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
361
	rmdir $(DESTDIR)$(sysconfdir)/event.d || :
362
else ! LIBVIRT_INIT_SCRIPT_UPSTART
363 364
install-init-upstart:
uninstall-init-upstart:
365
endif ! LIBVIRT_INIT_SCRIPT_UPSTART
366 367 368 369 370 371 372 373


if LIBVIRT_INIT_SCRIPT_SYSTEMD

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

install-init-systemd: install-sysconfig libvirtd.service
374
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
375
	$(INSTALL_DATA) libvirtd.service \
376 377 378 379
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service

uninstall-init-systemd: uninstall-sysconfig
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
380
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
381
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
382 383
install-init-systemd:
uninstall-init-systemd:
384
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
385

386
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
387 388 389 390 391 392
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
	    chmod a+x $@-t &&					\
393
	    mv $@-t $@
D
Daniel P. Berrange 已提交
394

395
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
396 397 398 399 400
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
401 402 403
	    mv $@-t $@


404 405
check-local: check-augeas

406 407 408 409
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 $< $@
410 411

check-augeas: test_libvirtd.aug
412
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
413
	  '$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \
414
	fi
415

416

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

421
else ! WITH_LIBVIRTD
422 423
install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
424
endif ! WITH_LIBVIRTD
425

426 427 428
POD2MAN = pod2man -c "Virtualization Support" \
			-r "$(PACKAGE)-$(VERSION)" -s 8

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

433 434
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
435
if WITH_SASL
436
install-data-sasl:
437
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
438 439
	$(INSTALL_DATA) $(srcdir)/libvirtd.sasl \
		$(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
440 441 442

uninstall-data-sasl:
	rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
D
Dave Allan 已提交
443
	rmdir $(DESTDIR)$(sysconfdir)/sasl2/ || :
444
else ! WITH_SASL
D
Daniel P. Berrange 已提交
445 446
install-data-sasl:
uninstall-data-sasl:
447
endif ! WITH_SASL
448 449


450
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
451
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
452
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)