Makefile.am 12.5 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 =

32
DAEMON_GENERATED =					\
33
		$(srcdir)/remote_dispatch.h		\
34 35 36
		$(srcdir)/lxc_dispatch.h		\
		$(srcdir)/qemu_dispatch.h		\
		$(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

78
$(srcdir)/remote_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
79
		$(REMOTE_PROTOCOL)
80 81
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
	  --mode=server remote REMOTE $(REMOTE_PROTOCOL) > $@
82

83 84
$(srcdir)/lxc_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
		$(LXC_PROTOCOL)
85 86
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
	  --mode=server lxc LXC $(LXC_PROTOCOL) > $@
87

88
$(srcdir)/qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
89
		$(QEMU_PROTOCOL)
90 91
	$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
	  --mode=server qemu QEMU $(QEMU_PROTOCOL) > $@
92

93 94
if WITH_LIBVIRTD

95
man8_MANS = libvirtd.8
96

97 98 99 100
sbin_PROGRAMS = libvirtd

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

102
augeasdir = $(datadir)/augeas/lenses
103
augeas_DATA = libvirtd.aug
104 105

augeastestsdir = $(datadir)/augeas/lenses/tests
106
augeastests_DATA = test_libvirtd.aug
107

108 109
CLEANFILES += test_libvirtd.aug

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

117
libvirtd_SOURCES = $(DAEMON_SOURCES)
118

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

E
Eric Blake 已提交
127
libvirtd_LDFLAGS =					\
D
Daniel P. Berrange 已提交
128
	$(PIE_LDFLAGS)					\
D
Daniel P. Berrange 已提交
129
	$(RELRO_LDFLAGS)				\
130
	$(COVERAGE_LDFLAGS)
131

132
libvirtd_LDADD =					\
133 134 135
	$(LIBXML_LIBS)					\
	$(GNUTLS_LIBS)					\
	$(SASL_LIBS)					\
136
	$(DBUS_LIBS)					\
D
Doug Goldstein 已提交
137 138
	$(POLKIT_LIBS)					\
	$(LIBNL_LIBS)
139

140
if WITH_DTRACE_PROBES
141
libvirtd_LDADD += ../src/libvirt_probes.lo
142 143
endif

144
libvirtd_LDADD += \
145
	../src/libvirt-lxc.la \
146
	../src/libvirt-qemu.la
C
Chris Lalancette 已提交
147

148
if ! WITH_DRIVER_MODULES
149
if WITH_QEMU
150
    libvirtd_LDADD += ../src/libvirt_driver_qemu.la
151
if WITH_DTRACE_PROBES
152
    libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
153
endif
154
endif
155

156
if WITH_LXC
157
    libvirtd_LDADD += ../src/libvirt_driver_lxc.la
158
endif
159

160 161 162 163
if WITH_XEN
    libvirtd_LDADD += ../src/libvirt_driver_xen.la
endif

J
Jim Fehlig 已提交
164 165 166 167
if WITH_LIBXL
    libvirtd_LDADD += ../src/libvirt_driver_libxl.la
endif

168
if WITH_UML
169
    libvirtd_LDADD += ../src/libvirt_driver_uml.la
170
endif
171

J
Jiri Denemark 已提交
172 173 174 175
if WITH_VBOX
    libvirtd_LDADD += ../src/libvirt_driver_vbox.la
endif

176
if WITH_STORAGE
177
    libvirtd_LDADD += ../src/libvirt_driver_storage.la
178
endif
179

180
if WITH_NETWORK
181
    libvirtd_LDADD += ../src/libvirt_driver_network.la
182
endif
183

184
if WITH_INTERFACE
185 186 187
    libvirtd_LDADD += ../src/libvirt_driver_interface.la
endif

188
if WITH_NODE_DEVICES
189
    libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
190
endif
191 192 193 194

if WITH_SECRETS
    libvirtd_LDADD += ../src/libvirt_driver_secret.la
endif
195 196 197 198

if WITH_NWFILTER
    libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
endif
199
endif
200 201

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

203 204
if WITH_POLKIT
if WITH_POLKIT0
205
policydir = $(datadir)/PolicyKit/policy
C
Cole Robinson 已提交
206
policyauth = auth_admin_keep_session
207 208
else
policydir = $(datadir)/polkit-1/actions
C
Cole Robinson 已提交
209
policyauth = auth_admin_keep
210
endif
211 212
endif

C
Cole Robinson 已提交
213 214
libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
	$(AM_V_GEN) sed \
215
	    -e 's|[@]authaction[@]|$(policyauth)|g' \
C
Cole Robinson 已提交
216 217 218 219
	    < $< > $@-t && \
	mv $@-t $@
BUILT_SOURCES += libvirtd.policy

220 221
install-data-local: install-init-redhat install-init-systemd \
		install-init-upstart \
222 223
		install-data-sasl install-data-polkit \
		install-logrotate install-sysctl
224 225 226
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
		   $(DESTDIR)$(localstatedir)/run/libvirt \
		   $(DESTDIR)$(localstatedir)/lib/libvirt
227

228 229
uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
		uninstall-init-upstart \
230
		uninstall-data-sasl uninstall-data-polkit \
231
		uninstall-logrotate uninstall-sysctl
232
	rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
233
	rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
234
	rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
235

236
if WITH_POLKIT
237
install-data-polkit::
238
	$(MKDIR_P) $(DESTDIR)$(policydir)
C
Cole Robinson 已提交
239
	$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
240
uninstall-data-polkit::
241
	rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
242
	rmdir $(DESTDIR)$(policydir) || :
243 244 245 246 247
else
install-data-polkit::
uninstall-data-polkit::
endif

248 249
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
250

251
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
252
		  libvirtd.uml.logrotate libvirtd.logrotate
253

254 255
BUILT_SOURCES += $(LOGROTATE_CONFS)

256
libvirtd.logrotate: libvirtd.logrotate.in
257
	$(AM_V_GEN)sed						\
258
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
259
	    < $< > $@-t && \
260 261
	mv $@-t $@

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

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

libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
275
	$(AM_V_GEN)sed						\
276
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
277 278
	    < $< > $@-t &&					\
	    mv $@-t $@
G
Guido Günther 已提交
279

280
install-logrotate: $(LOGROTATE_CONFS)
281 282 283 284
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
		   $(DESTDIR)$(sysconfdir)/logrotate.d/
285 286 287 288 289 290 291 292
	$(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 已提交
293

294 295 296 297 298 299 300 301 302 303
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 || :

304
install-sysconfig:
305
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
306
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
J
Jim Meyering 已提交
307
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
308 309
uninstall-sysconfig:
	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
310
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
311

312
if WITH_SYSCTL
313 314
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
315
install-sysctl:
316
	$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
E
Eric Blake 已提交
317
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
318
	  $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
319

320
uninstall-sysctl:
321 322
	rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
	rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
323 324 325 326
else
install-sysctl:
uninstall-sysctl:
endif
327 328

if LIBVIRT_INIT_SCRIPT_RED_HAT
D
Daniel P. Berrange 已提交
329

330
BUILT_SOURCES += libvirtd.init
331

332
install-init-redhat: install-sysconfig libvirtd.init
333
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
334 335 336 337 338
	$(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
339
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
340 341 342 343 344 345 346 347 348
else
install-init-redhat:
uninstall-init-redhat:
endif # LIBVIRT_INIT_SCRIPT_RED_HAT


if LIBVIRT_INIT_SCRIPT_UPSTART

install-init-upstart: install-sysconfig
349
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
350 351 352 353 354
	$(INSTALL_SCRIPT) libvirtd.upstart \
	  $(DESTDIR)$(sysconfdir)/event.d/libvirtd

uninstall-init-upstart: uninstall-sysconfig
	rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
355
	rmdir $(DESTDIR)$(sysconfdir)/event.d || :
356 357 358 359 360 361 362 363 364 365 366 367
else
install-init-upstart:
uninstall-init-upstart:
endif # LIBVIRT_INIT_SCRIPT_UPSTART


if LIBVIRT_INIT_SCRIPT_SYSTEMD

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

install-init-systemd: install-sysconfig libvirtd.service
368
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
369
	$(INSTALL_DATA) libvirtd.service \
370 371 372 373
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service

uninstall-init-systemd: uninstall-sysconfig
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
374
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
375 376 377 378 379
else
install-init-systemd:
uninstall-init-systemd:
endif # LIBVIRT_INIT_SCRIPT_SYSTEMD

380
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
381 382 383 384 385 386
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
	    chmod a+x $@-t &&					\
387
	    mv $@-t $@
D
Daniel P. Berrange 已提交
388

389
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
390 391 392 393 394
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
395 396 397
	    mv $@-t $@


398 399
check-local: check-augeas

400 401 402 403
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 $< $@
404 405

check-augeas: test_libvirtd.aug
406
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
407
	  '$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \
408
	fi
409

410

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

415 416 417
else # WITH_LIBVIRTD
install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
418
endif # WITH_LIBVIRTD
419

420 421 422
POD2MAN = pod2man -c "Virtualization Support" \
			-r "$(PACKAGE)-$(VERSION)" -s 8

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

427 428
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
429
if WITH_SASL
430
install-data-sasl:
431
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
432 433
	$(INSTALL_DATA) $(srcdir)/libvirtd.sasl \
		$(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
434 435 436

uninstall-data-sasl:
	rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
D
Dave Allan 已提交
437
	rmdir $(DESTDIR)$(sysconfdir)/sasl2/ || :
D
Daniel P. Berrange 已提交
438 439 440
else
install-data-sasl:
uninstall-data-sasl:
441 442 443
endif


444
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
445
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
446
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)