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

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 222
install-data-local: install-init-redhat install-init-systemd install-init-upstart \
		install-data-sasl install-data-polkit \
		install-logrotate install-sysctl
223 224 225
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
		   $(DESTDIR)$(localstatedir)/run/libvirt \
		   $(DESTDIR)$(localstatedir)/lib/libvirt
226

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

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

246 247
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
248

249
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
250
		  libvirtd.uml.logrotate libvirtd.logrotate
251

252 253
BUILT_SOURCES += $(LOGROTATE_CONFS)

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

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

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

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

278
install-logrotate: $(LOGROTATE_CONFS)
279 280 281 282
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
		   $(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
		   $(DESTDIR)$(sysconfdir)/logrotate.d/
283
	$(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
284 285 286
	$(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 已提交
287

288 289 290 291 292 293 294 295 296 297
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 || :

298
install-sysconfig:
299
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
300
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
J
Jim Meyering 已提交
301
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
302 303
uninstall-sysconfig:
	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
304
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
305

306
if WITH_SYSCTL
307 308
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
309
install-sysctl:
310
	$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
E
Eric Blake 已提交
311
	$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
312
	  $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
313

314
uninstall-sysctl:
315 316
	rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/libvirtd.conf
	rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
317 318 319 320
else
install-sysctl:
uninstall-sysctl:
endif
321 322

if LIBVIRT_INIT_SCRIPT_RED_HAT
D
Daniel P. Berrange 已提交
323

324
BUILT_SOURCES += libvirtd.init
325

326
install-init-redhat: install-sysconfig libvirtd.init
327
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
328 329 330 331 332
	$(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
333
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
334 335 336 337 338 339 340 341 342
else
install-init-redhat:
uninstall-init-redhat:
endif # LIBVIRT_INIT_SCRIPT_RED_HAT


if LIBVIRT_INIT_SCRIPT_UPSTART

install-init-upstart: install-sysconfig
343
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
344 345 346 347 348
	$(INSTALL_SCRIPT) libvirtd.upstart \
	  $(DESTDIR)$(sysconfdir)/event.d/libvirtd

uninstall-init-upstart: uninstall-sysconfig
	rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
349
	rmdir $(DESTDIR)$(sysconfdir)/event.d || :
350 351 352 353 354 355 356 357 358 359 360 361
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
362
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
363
	$(INSTALL_DATA) libvirtd.service \
364 365 366 367
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service

uninstall-init-systemd: uninstall-sysconfig
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
368
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
369 370 371 372 373
else
install-init-systemd:
uninstall-init-systemd:
endif # LIBVIRT_INIT_SCRIPT_SYSTEMD

374
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
375 376 377 378 379 380
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
	    chmod a+x $@-t &&					\
381
	    mv $@-t $@
D
Daniel P. Berrange 已提交
382

383
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
384 385 386 387 388
	$(AM_V_GEN)sed						\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
389 390 391
	    mv $@-t $@


392 393
check-local: check-augeas

394 395 396 397
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 $< $@
398 399

check-augeas: test_libvirtd.aug
400
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
401
	  '$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \
402
	fi
403

404

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

409 410 411
else # WITH_LIBVIRTD
install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
412
endif # WITH_LIBVIRTD
413

414 415 416
POD2MAN = pod2man -c "Virtualization Support" \
			-r "$(PACKAGE)-$(VERSION)" -s 8

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

421 422
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
423
if WITH_SASL
424
install-data-sasl:
425
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
426 427 428 429
	$(INSTALL_DATA) $(srcdir)/libvirtd.sasl $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf

uninstall-data-sasl:
	rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
D
Dave Allan 已提交
430
	rmdir $(DESTDIR)$(sysconfdir)/sasl2/ || :
D
Daniel P. Berrange 已提交
431 432 433
else
install-data-sasl:
uninstall-data-sasl:
434 435 436
endif


437
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
438
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
439
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)