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

3 4 5 6 7 8 9
# No libraries with the exception of LIBXML should be listed
# here. List them against the individual XXX_la_CFLAGS targets
# that actually use them
INCLUDES =							\
		-I$(top_srcdir)/gnulib/lib			\
		-I../gnulib/lib					\
		-I../include					\
10
		-I@top_srcdir@/src/util				\
11 12 13 14 15 16 17 18
		-I@top_srcdir@/include				\
		$(DRIVER_MODULE_CFLAGS)				\
		$(LIBXML_CFLAGS)				\
		-DLIBDIR=\""$(libdir)"\"			\
		-DBINDIR=\""$(libexecdir)"\"			\
		-DSBINDIR=\""$(sbindir)"\"			\
		-DSYSCONF_DIR="\"$(sysconfdir)\""		\
		-DLOCALEBASEDIR=\""$(datadir)/locale"\"		\
19
		-DPKGDATADIR=\""$(pkgdatadir)"\"		\
20 21 22
		-DLOCAL_STATE_DIR=\""$(localstatedir)"\"	\
		-DGETTEXT_PACKAGE=\"$(PACKAGE)\"		\
		$(WARN_CFLAGS)					\
23 24 25
		$(LOCK_CHECKING_CFLAGS)			\
		-DIN_LIBVIRT				\
		$(WIN32_EXTRA_CFLAGS)
26

27
EXTRA_DIST = $(conf_DATA)
28

29 30
BUILT_SOURCES =

31 32 33
if WITH_NETWORK
UUID=$(shell uuidgen 2>/dev/null)
endif
34

C
Chris Lalancette 已提交
35
lib_LTLIBRARIES = libvirt.la libvirt-qemu.la
36

37 38 39
moddir = $(libdir)/libvirt/drivers
mod_LTLIBRARIES =

A
Amy Griffis 已提交
40 41
confdir = $(sysconfdir)/libvirt
conf_DATA =
42

43 44 45 46 47 48
augeasdir = $(datadir)/augeas/lenses
augeas_DATA =

augeastestdir = $(datadir)/augeas/lenses/tests
augeastest_DATA =

49 50
# These files are not related to driver APIs. Simply generic
# helper APIs for various purposes
51
UTIL_SOURCES =							\
52
		util/authhelper.c util/authhelper.h		\
53
		util/bitmap.c util/bitmap.h			\
54 55 56 57 58 59
		util/bridge.c util/bridge.h			\
		util/buf.c util/buf.h				\
		util/conf.c util/conf.h				\
		util/cgroup.c util/cgroup.h			\
		util/event.c util/event.h			\
		util/hash.c util/hash.h				\
D
Daniel Veillard 已提交
60
		util/hooks.c util/hooks.h			\
61
		util/iptables.c util/iptables.h			\
G
Gerhard Stenzel 已提交
62
		util/ebtables.c util/ebtables.h			\
63
		util/dnsmasq.c util/dnsmasq.h                   \
64
		util/json.c util/json.h				\
65
		util/logging.c util/logging.h			\
66
		util/macvtap.c util/macvtap.h			\
67 68
		util/memory.c util/memory.h			\
		util/pci.c util/pci.h				\
69
		util/processinfo.c util/processinfo.h		\
70
		util/hostusb.c util/hostusb.h			\
71
		util/network.c util/network.h			\
72
		util/interface.c util/interface.h		\
73 74
		util/qparams.c util/qparams.h			\
		util/stats_linux.c util/stats_linux.h		\
75
		util/storage_file.c util/storage_file.h		\
76 77 78 79 80 81 82 83 84
		util/threads.c util/threads.h			\
		util/threads-pthread.h				\
		util/threads-win32.h				\
		util/uuid.c util/uuid.h				\
		util/util.c util/util.h				\
		util/xml.c util/xml.h				\
		util/virterror.c util/virterror_internal.h

EXTRA_DIST += util/threads-pthread.c util/threads-win32.c
85

86
# Internal generic driver infrastructure
87
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c
88
DRIVER_SOURCES =						\
89
		driver.c driver.h				\
90 91
		internal.h					\
		datatypes.c datatypes.h				\
92
		$(NODE_INFO_SOURCES)				\
93 94 95
		libvirt.c libvirt_internal.h


96
# XML configuration format handling sources
97 98
# Domain driver generic impl APIs
DOMAIN_CONF_SOURCES =						\
99
		conf/capabilities.c conf/capabilities.h		\
100 101
		conf/domain_conf.c conf/domain_conf.h		\
		conf/domain_nwfilter.c conf/domain_nwfilter.h
102 103 104

DOMAIN_EVENT_SOURCES =						\
		conf/domain_event.c conf/domain_event.h
105 106

# Network driver generic impl APIs
107
NETWORK_CONF_SOURCES =						\
108
		conf/network_conf.c conf/network_conf.h
109

110 111
# Network filter driver generic impl APIs
NWFILTER_PARAM_CONF_SOURCES =					\
112 113
		conf/nwfilter_params.c conf/nwfilter_params.h	\
		conf/nwfilter_conf.h
114 115 116 117 118

NWFILTER_CONF_SOURCES =					\
		$(NWFILTER_PARAM_CONF_SOURCES)			\
		conf/nwfilter_conf.c conf/nwfilter_conf.h

119
# Storage driver generic impl APIs
120 121
STORAGE_CONF_SOURCES =                                         \
		conf/storage_conf.h conf/storage_conf.c
122

123
# Interface driver generic impl APIs
124 125
INTERFACE_CONF_SOURCES =                                       \
		conf/interface_conf.c conf/interface_conf.h
126

127
# Secret driver generic impl APIs
128 129 130 131 132 133 134 135 136 137
SECRET_CONF_SOURCES =                                          \
		conf/secret_conf.h conf/secret_conf.c

# Network driver generic impl APIs
NODE_DEVICE_CONF_SOURCES =                                     \
		conf/node_device_conf.c conf/node_device_conf.h

ENCRYPTION_CONF_SOURCES =					\
		conf/storage_encryption_conf.c conf/storage_encryption_conf.h

138 139 140
CPU_CONF_SOURCES =						\
		conf/cpu_conf.c conf/cpu_conf.h

141 142 143 144
CONF_SOURCES =							\
		$(DOMAIN_CONF_SOURCES)				\
		$(DOMAIN_EVENT_SOURCES)				\
		$(NETWORK_CONF_SOURCES)				\
145
		$(NWFILTER_CONF_SOURCES)			\
146 147 148 149
		$(NODE_DEVICE_CONF_SOURCES)			\
		$(STORAGE_CONF_SOURCES)				\
		$(ENCRYPTION_CONF_SOURCES)			\
		$(INTERFACE_CONF_SOURCES)			\
150 151
		$(SECRET_CONF_SOURCES)				\
		$(CPU_CONF_SOURCES)
152

153 154
# The remote RPC driver, covering domains, storage, networks, etc
REMOTE_DRIVER_SOURCES =						\
155 156
		gnutls_1_0_compat.h			\
		remote/remote_driver.c remote/remote_driver.h	\
157 158 159 160
		remote/remote_protocol.c			\
		remote/remote_protocol.h

EXTRA_DIST += remote/remote_protocol.x remote/rpcgen_fix.pl
161

162 163 164 165 166 167 168 169 170 171
# Ensure that we don't change the struct or member names or member ordering
# in remote_protocol.x  The embedded perl below needs a few comments, and
# presumes you know what pdwtags output looks like:
# * use -0777 -n to slurp the entire file into $_.
# * the "split" splits on the /* DD */ comments, so that $p iterates
#     through the struct definitions.
# * process only "struct remote_..." entries
# * remove comments and preceding TAB throughout
# * remove empty lines throughout
# * remove white space at end of buffer
172 173 174 175 176 177 178 179 180 181

# With pdwtags 1.8, --verbose output includes separators like these:
# /* 93 */
# /* <0> (null):0 */
# whereas with pdwtags 1.3, they look like this:
# /* <2d2> /usr/include/libio.h:180 */
# The concatenation of the following regexps matches both cases.
r1 = (?:/\* \d+ \*/\n)?
r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/

182 183
.PHONY: remote_protocol-structs
remote_protocol-structs:
184
	$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then		\
185
	  pdwtags --verbose libvirt_driver_remote_la-remote_protocol.$(OBJEXT) \
186
	    | perl -0777 -n						\
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
		-e 'foreach my $$p (split m!\n\n$(r1)$(r2)\n!) {'	\
		-e '  if ($$p =~ /^struct remote_/) {'			\
		-e '    $$p =~ s!\t*/\*.*?\*/!!sg;'			\
		-e '    $$p =~ s!\s+\n!\n!sg;'				\
		-e '    $$p =~ s!\s+$$!!;'				\
		-e '    print "$$p\n";'					\
		-e '    $$n++;'						\
		-e '  }'						\
		-e '}'							\
		-e 'END {'						\
		-e '  if ($$n < 300) {'					\
		-e '    warn "WARNING: your pdwtags program is too old\n";' \
		-e '    warn "WARNING: skipping the $@ test\n";'	\
		-e '    warn "WARNING: install dwarves-1.3 or newer\n";' \
		-e '    exit 8;'					\
		-e '  }'						\
		-e '}'							\
204
		> $@-t;							\
205
          case $$? in 8) exit 0;; 0) ;; *) exit 1;; esac;		\
206
	  diff -u $@-t $(srcdir)/$@; st=$$?; rm -f $@-t; exit $$st;	\
207
	else								\
208 209
	  echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2;	\
	  echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
210 211 212 213
	fi
EXTRA_DIST += remote_protocol-structs
check-local: remote_protocol-structs

214 215
# Mock driver, covering domains, storage, networks, etc
TEST_DRIVER_SOURCES =						\
216
		test/test_driver.c test/test_driver.h
217 218 219 220 221



# Now the Hypervisor specific drivers
XEN_DRIVER_SOURCES =						\
222 223 224 225 226 227 228 229
		xen/proxy_internal.c xen/proxy_internal.h	\
		xen/sexpr.c xen/sexpr.h				\
		xen/block_stats.c xen/block_stats.h		\
		xen/xen_hypervisor.c xen/xen_hypervisor.h	\
		xen/xen_driver.c xen/xen_driver.h		\
		xen/xend_internal.c xen/xend_internal.h		\
		xen/xm_internal.c xen/xm_internal.h		\
		xen/xs_internal.c xen/xs_internal.h
230
if WITH_XEN_INOTIFY
231
XEN_DRIVER_SOURCES += xen/xen_inotify.c xen/xen_inotify.h
232
endif
233 234

LXC_DRIVER_SOURCES =						\
235 236 237
		lxc/lxc_conf.c lxc/lxc_conf.h			\
		lxc/lxc_container.c lxc/lxc_container.h		\
		lxc/lxc_driver.c lxc/lxc_driver.h		\
238
		lxc/veth.c lxc/veth.h
239

240
LXC_CONTROLLER_SOURCES =					\
241 242 243
		lxc/lxc_conf.c lxc/lxc_conf.h			\
		lxc/lxc_container.c lxc/lxc_container.h		\
		lxc/lxc_controller.c				\
244
		lxc/veth.c lxc/veth.h
245

J
Jamie Strandboge 已提交
246 247 248
SECURITY_DRIVER_APPARMOR_HELPER_SOURCES =			\
		security/virt-aa-helper.c

249 250 251
PHYP_DRIVER_SOURCES =						\
		phyp/phyp_driver.c phyp/phyp_driver.h

252
OPENVZ_DRIVER_SOURCES =						\
253 254
		openvz/openvz_conf.c openvz/openvz_conf.h	\
		openvz/openvz_driver.c openvz/openvz_driver.h
255

256 257 258
VBOX_DRIVER_SOURCES =						\
        vbox/vbox_XPCOMCGlue.c vbox/vbox_XPCOMCGlue.h		\
        vbox/vbox_driver.c vbox/vbox_driver.h			\
259
        vbox/vbox_V2_2.c vbox/vbox_CAPI_v2_2.h			\
260
        vbox/vbox_V3_0.c vbox/vbox_CAPI_v3_0.h			\
261 262
        vbox/vbox_V3_1.c vbox/vbox_CAPI_v3_1.h			\
        vbox/vbox_V3_2.c vbox/vbox_CAPI_v3_2.h
263

264 265
VBOX_DRIVER_EXTRA_DIST = vbox/vbox_tmpl.c vbox/README

266
QEMU_DRIVER_SOURCES =						\
267
		qemu/qemu_conf.c qemu/qemu_conf.h		\
268
		qemu/qemu_monitor.c qemu/qemu_monitor.h		\
269 270
		qemu/qemu_monitor_text.c			\
		qemu/qemu_monitor_text.h			\
D
Daniel P. Berrange 已提交
271 272 273
		qemu/qemu_monitor_json.c			\
		qemu/qemu_monitor_json.h			\
		qemu/qemu_driver.c qemu/qemu_driver.h		\
E
Eric Blake 已提交
274
		qemu/qemu_bridge_filter.c			\
275 276
		qemu/qemu_bridge_filter.h			\
		qemu/qemu_security_stacked.h			\
277 278 279
		qemu/qemu_security_stacked.c			\
		qemu/qemu_security_dac.h			\
		qemu/qemu_security_dac.c
R
Richard W.M. Jones 已提交
280

281 282
XENAPI_DRIVER_SOURCES =								\
		xenapi/xenapi_driver.c xenapi/xenapi_driver.h	\
283
		xenapi/xenapi_driver_private.h					\
284 285
		xenapi/xenapi_utils.c xenapi/xenapi_utils.h

286
UML_DRIVER_SOURCES =						\
D
Daniel P. Berrange 已提交
287 288
		uml/uml_conf.c uml/uml_conf.h			\
		uml/uml_driver.c uml/uml_driver.h
289

290 291 292 293 294 295
ONE_DRIVER_SOURCES =						\
		./opennebula/one_conf.c				\
		./opennebula/one_conf.h				\
		./opennebula/one_driver.c			\
		./opennebula/one_driver.h			\
		./opennebula/one_client.c			\
296
		./opennebula/one_client.h
D
Daniel Veillard 已提交
297

298
ESX_DRIVER_SOURCES =						\
299
		esx/esx_private.h						\
300
		esx/esx_driver.c esx/esx_driver.h		\
301 302 303 304 305
		esx/esx_interface_driver.c esx/esx_interface_driver.h		\
		esx/esx_network_driver.c esx/esx_network_driver.h		\
		esx/esx_storage_driver.c esx/esx_storage_driver.h		\
		esx/esx_device_monitor.c esx/esx_device_monitor.h		\
		esx/esx_secret_driver.c esx/esx_secret_driver.h		\
M
Matthias Bolte 已提交
306
		esx/esx_nwfilter_driver.c esx/esx_nwfilter_driver.h		\
307 308
		esx/esx_util.c esx/esx_util.h			\
		esx/esx_vi.c esx/esx_vi.h			\
309 310 311 312
		esx/esx_vi_methods.c esx/esx_vi_methods.h	\
		esx/esx_vi_types.c esx/esx_vi_types.h		\
		esx/esx_vmx.c esx/esx_vmx.h

313
ESX_DRIVER_GENERATED =							\
314 315
		esx/esx_vi_methods.generated.c				\
		esx/esx_vi_methods.generated.h				\
316 317 318 319 320 321 322 323 324 325 326 327 328
		esx/esx_vi_types.generated.c				\
		esx/esx_vi_types.generated.h				\
		esx/esx_vi_types.generated.typedef			\
		esx/esx_vi_types.generated.typeenum			\
		esx/esx_vi_types.generated.typetostring			\
		esx/esx_vi_types.generated.typefromstring

ESX_DRIVER_EXTRA_DIST =						\
		esx/README						\
		esx/esx_vi_generator.input				\
		esx/esx_vi_generator.py					\
		$(ESX_DRIVER_GENERATED)

329
NETWORK_DRIVER_SOURCES =					\
330
		network/bridge_driver.h network/bridge_driver.c
331

332
INTERFACE_DRIVER_SOURCES =					\
333
		interface/netcf_driver.h interface/netcf_driver.c
334

335
SECRET_DRIVER_SOURCES =						\
336
		secret/secret_driver.h secret/secret_driver.c
337

338
# Storage backend specific impls
339
STORAGE_DRIVER_SOURCES =					\
340 341
		storage/storage_driver.h storage/storage_driver.c		\
		storage/storage_backend.h storage/storage_backend.c
342 343

STORAGE_DRIVER_FS_SOURCES =					\
344
		storage/storage_backend_fs.h storage/storage_backend_fs.c
R
Richard W.M. Jones 已提交
345

346
STORAGE_DRIVER_LVM_SOURCES =					\
347 348
		storage/storage_backend_logical.h			\
		storage/storage_backend_logical.c
349 350

STORAGE_DRIVER_ISCSI_SOURCES =					\
351
		storage/storage_backend_iscsi.h storage/storage_backend_iscsi.c
352

353
STORAGE_DRIVER_SCSI_SOURCES =					\
354
		storage/storage_backend_scsi.h storage/storage_backend_scsi.c
355

D
Dave Allan 已提交
356
STORAGE_DRIVER_MPATH_SOURCES =					\
357
		storage/storage_backend_mpath.h storage/storage_backend_mpath.c
D
Dave Allan 已提交
358

359
STORAGE_DRIVER_DISK_SOURCES =					\
360
		storage/storage_backend_disk.h storage/storage_backend_disk.c
361 362

STORAGE_HELPER_DISK_SOURCES =					\
363
		storage/parthelper.c
364

365 366 367
# Network filters
NWFILTER_DRIVER_SOURCES =					\
		nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c	\
368 369 370
		nwfilter/nwfilter_gentech_driver.c			\
		nwfilter/nwfilter_gentech_driver.h			\
		nwfilter/nwfilter_ebiptables_driver.c			\
371 372 373
		nwfilter/nwfilter_ebiptables_driver.h			\
		nwfilter/nwfilter_learnipaddr.c				\
		nwfilter/nwfilter_learnipaddr.h
374

375

376
# Security framework and drivers for various models
377
SECURITY_DRIVER_SOURCES =					\
378
		security/security_driver.h security/security_driver.c
379

380
SECURITY_DRIVER_SELINUX_SOURCES =				\
381
		security/security_selinux.h security/security_selinux.c
382

J
Jamie Strandboge 已提交
383 384 385
SECURITY_DRIVER_APPARMOR_SOURCES =				\
		security/security_apparmor.h security/security_apparmor.c

386

387
NODE_DEVICE_DRIVER_SOURCES =					\
388 389 390
		node_device/node_device_driver.c \
		node_device/node_device_driver.h \
		node_device/node_device_linux_sysfs.c
391 392

NODE_DEVICE_DRIVER_HAL_SOURCES =				\
393
		node_device/node_device_hal.c			\
394
		node_device/node_device_hal.h
395

396
NODE_DEVICE_DRIVER_UDEV_SOURCES =				\
D
Daniel Veillard 已提交
397 398
		node_device/node_device_udev.c			\
		node_device/node_device_udev.h
399

J
Jiri Denemark 已提交
400 401 402 403 404
CPU_SOURCES =							\
		cpu/cpu.h cpu/cpu.c				\
		cpu/cpu_generic.h cpu/cpu_generic.c		\
		cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h	\
		cpu/cpu_map.h cpu/cpu_map.c
405

J
Jiri Denemark 已提交
406 407
pkgdata_DATA =	cpu/cpu_map.xml

E
Eric Blake 已提交
408
EXTRA_DIST +=	$(pkgdata_DATA)
409

410 411 412 413 414 415
#########################
#
# Build up list of libvirt.la source files based on configure conditions
#
# First deal with sources usable in non-daemon context

416
noinst_LTLIBRARIES = libvirt_util.la
417 418
libvirt_la_LIBADD = $(libvirt_la_BUILT_LIBADD)
libvirt_la_BUILT_LIBADD = libvirt_util.la
419 420
libvirt_util_la_SOURCES =					\
		$(UTIL_SOURCES)
M
Matthias Bolte 已提交
421 422
libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS)
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) $(LIB_PTHREAD)
423

424 425

noinst_LTLIBRARIES += libvirt_conf.la
426
libvirt_la_BUILT_LIBADD += libvirt_conf.la
427 428 429 430
libvirt_conf_la_SOURCES = $(CONF_SOURCES)
libvirt_conf_la_CFLAGS =
libvirt_conf_la_LDFLAGS =

J
Jiri Denemark 已提交
431
noinst_LTLIBRARIES += libvirt_cpu.la
432
libvirt_la_BUILT_LIBADD += libvirt_cpu.la
J
Jiri Denemark 已提交
433 434 435 436
libvirt_cpu_la_CFLAGS = \
		-I@top_srcdir@/src/conf
libvirt_cpu_la_SOURCES = $(CPU_SOURCES)

437

438
noinst_LTLIBRARIES += libvirt_driver.la
439
libvirt_la_BUILT_LIBADD += libvirt_driver.la
440
libvirt_driver_la_SOURCES = $(DRIVER_SOURCES)
441

M
Matthias Bolte 已提交
442
libvirt_driver_la_CFLAGS = $(NUMACTL_CFLAGS) $(GNUTLS_CFLAGS) \
443
		-I@top_srcdir@/src/conf
M
Matthias Bolte 已提交
444
libvirt_driver_la_LIBADD = $(NUMACTL_LIBS) $(GNUTLS_LIBS)
445

446
USED_SYM_FILES = libvirt_private.syms
447

448
if WITH_TEST
449 450 451
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_test.la
else
452
noinst_LTLIBRARIES += libvirt_driver_test.la
453
libvirt_la_BUILT_LIBADD += libvirt_driver_test.la
454
endif
455 456
libvirt_driver_test_la_CFLAGS = \
		-I@top_srcdir@/src/conf
457 458 459
if WITH_DRIVER_MODULES
libvirt_driver_test_la_LDFLAGS = -module -avoid-version
endif
460
libvirt_driver_test_la_SOURCES = $(TEST_DRIVER_SOURCES)
461 462 463
endif

if WITH_REMOTE
464 465 466
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_remote.la
else
467
noinst_LTLIBRARIES += libvirt_driver_remote.la
468
libvirt_la_BUILT_LIBADD += libvirt_driver_remote.la
469
endif
470 471
libvirt_driver_remote_la_CFLAGS =				\
		$(GNUTLS_CFLAGS)				\
472
		$(SASL_CFLAGS)					\
473
		-I@top_srcdir@/src/conf
474 475
libvirt_driver_remote_la_LDFLAGS =
libvirt_driver_remote_la_LIBADD = $(GNUTLS_LIBS) $(SASL_LIBS)
476 477 478
if WITH_DRIVER_MODULES
libvirt_driver_remote_la_LDFLAGS += -module -avoid-version
endif
479
libvirt_driver_remote_la_SOURCES = $(REMOTE_DRIVER_SOURCES)
480 481 482 483 484 485

if HAVE_RPCGEN
#
# Maintainer-only target for re-generating the derived .c/.h source
# files, which are actually derived from the .x file.
#
486
# For committing protocol changes to GIT, the GLIBC rpcgen *must*
487 488 489 490 491 492 493 494 495 496
# be used.
#
# Support for non-GLIB rpcgen is here as a convenience for
# non-Linux people needing to test changes during dev.
#
rpcgen:
	rm -f rp.c-t rp.h-t rp.c-t1 rp.c-t2 rp.h-t1
	$(RPCGEN) -h -o rp.h-t $(srcdir)/remote/remote_protocol.x
	$(RPCGEN) -c -o rp.c-t $(srcdir)/remote/remote_protocol.x
if HAVE_GLIBC_RPCGEN
P
Paolo Bonzini 已提交
497 498
	perl -w $(srcdir)/remote/rpcgen_fix.pl rp.h-t > rp.h-t1
	perl -w $(srcdir)/remote/rpcgen_fix.pl rp.c-t > rp.c-t1
499 500 501 502 503 504 505 506 507 508 509 510 511
	(echo '#include <config.h>'; cat rp.c-t1) > rp.c-t2
	chmod 0444 rp.c-t2 rp.h-t1
	mv -f rp.h-t1 $(srcdir)/remote/remote_protocol.h
	mv -f rp.c-t2 $(srcdir)/remote/remote_protocol.c
	rm -f rp.c-t rp.h-t rp.c-t1
else
	chmod 0444 rp.c-t rp.h-t
	mv -f rp.h-t $(srcdir)/remote/remote_protocol.h
	mv -f rp.c-t $(srcdir)/remote/remote_protocol.c
endif
endif

remote/remote_protocol.c: remote/remote_protocol.h
512 513 514
endif

if WITH_XEN
515 516 517
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_xen.la
else
518
noinst_LTLIBRARIES += libvirt_driver_xen.la
519
libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la
520
endif
E
Eric Blake 已提交
521
libvirt_driver_xen_la_CFLAGS =					\
522 523
		$(XEN_CFLAGS)					\
		-I@top_srcdir@/src/conf
524 525
libvirt_driver_xen_la_LDFLAGS =
libvirt_driver_xen_la_LIBADD = $(XEN_LIBS)
526 527 528
if WITH_DRIVER_MODULES
libvirt_driver_xen_la_LDFLAGS += -module -avoid-version
endif
529
libvirt_driver_xen_la_SOURCES = $(XEN_DRIVER_SOURCES)
530 531
endif

532 533 534 535 536
if WITH_PHYP
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_phyp.la
else
noinst_LTLIBRARIES += libvirt_driver_phyp.la
537
libvirt_la_BUILT_LIBADD += libvirt_driver_phyp.la
538
endif
539
libvirt_driver_phyp_la_LIBADD = $(LIBSSH2_LIBS)
540 541
libvirt_driver_phyp_la_CFLAGS = $(LIBSSH2_CFLAGS) \
		-I@top_srcdir@/src/conf
542 543 544
libvirt_driver_phyp_la_SOURCES = $(PHYP_DRIVER_SOURCES)
endif

545
if WITH_OPENVZ
546 547 548
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_openvz.la
else
549
noinst_LTLIBRARIES += libvirt_driver_openvz.la
550
libvirt_la_BUILT_LIBADD += libvirt_driver_openvz.la
551
endif
552 553
libvirt_driver_openvz_la_CFLAGS = \
		-I@top_srcdir@/src/conf
554 555 556
if WITH_DRIVER_MODULES
libvirt_driver_openvz_la_LDFLAGS = -module -avoid-version
endif
557
libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
558 559
endif

560 561 562 563 564
if WITH_VBOX
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_vbox.la
else
noinst_LTLIBRARIES += libvirt_driver_vbox.la
565
libvirt_la_BUILT_LIBADD += libvirt_driver_vbox.la
566
endif
567 568
libvirt_driver_vbox_la_CFLAGS = \
		-I@top_srcdir@/src/conf
569 570 571
if WITH_DRIVER_MODULES
libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version
endif
572
libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
573 574 575
libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
endif

576 577 578 579 580
if WITH_XENAPI
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_xenapi.la
else
noinst_LTLIBRARIES += libvirt_driver_xenapi.la
581
libvirt_la_BUILT_LIBADD += libvirt_driver_xenapi.la
582 583 584
endif
libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(LIBCURL_CFLAGS) \
		-I@top_srcdir@/src/conf
585 586
libvirt_driver_xenapi_la_LDFLAGS =
libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(LIBCURL_LIBS)
587 588 589 590 591 592
if WITH_DRIVER_MODULES
libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
endif

593
if WITH_QEMU
594 595 596
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_qemu.la
else
597
noinst_LTLIBRARIES += libvirt_driver_qemu.la
598
# Stateful, so linked to daemon instead
599
#libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la
600
endif
601 602
libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
		-I@top_srcdir@/src/conf
603 604
libvirt_driver_qemu_la_LDFLAGS =
libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS)
605 606 607
if WITH_DRIVER_MODULES
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
endif
608
libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
609

A
Amy Griffis 已提交
610
conf_DATA += qemu/qemu.conf
611

612 613
augeas_DATA += qemu/libvirtd_qemu.aug
augeastest_DATA += qemu/test_libvirtd_qemu.aug
614

615
endif
616 617
EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \
		qemu/test_libvirtd_qemu.aug qemu/THREADS.txt
618

619 620

if WITH_LXC
621 622 623
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_lxc.la
else
624
noinst_LTLIBRARIES += libvirt_driver_lxc.la
625
# Stateful, so linked to daemon instead
626
#libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la
627
endif
628 629
libvirt_driver_lxc_la_CFLAGS = \
		-I@top_srcdir@/src/conf
630 631 632
if WITH_DRIVER_MODULES
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version
endif
633
libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
A
Amy Griffis 已提交
634 635 636

conf_DATA += lxc/lxc.conf

637 638 639
augeas_DATA += lxc/libvirtd_lxc.aug
augeastest_DATA += lxc/test_libvirtd_lxc.aug

640
endif
641
EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug
642

643
if WITH_UML
644 645 646
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_uml.la
else
647 648
noinst_LTLIBRARIES += libvirt_driver_uml.la
# Stateful, so linked to daemon instead
649
#libvirt_la_BUILT_LIBADD += libvirt_driver_uml.la
650
endif
651 652
libvirt_driver_uml_la_CFLAGS = $(NUMACTL_CFLAGS) \
		-I@top_srcdir@/src/conf
653 654
libvirt_driver_uml_la_LDFLAGS =
libvirt_driver_uml_la_LIBADD = $(NUMACTL_LIBS)
655 656 657
if WITH_DRIVER_MODULES
libvirt_driver_uml_la_LDFLAGS += -module -avoid-version
endif
658 659
libvirt_driver_uml_la_SOURCES = $(UML_DRIVER_SOURCES)
endif
660

D
Daniel Veillard 已提交
661 662 663 664 665 666
if WITH_ONE
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_one.la
else
noinst_LTLIBRARIES += libvirt_driver_one.la
# Stateful, so linked to daemon instead
667
#libvirt_la_BUILT_LIBADD  += libvirt_driver_one.la
D
Daniel Veillard 已提交
668
endif
669 670
libvirt_driver_one_la_CFLAGS = $(XMLRPC_CFLAGS) \
		-I@top_srcdir@/src/conf
671 672
libvirt_driver_one_la_LDFLAGS =
libvirt_driver_one_la_LIBADD = $(XMLRPC_LIBS)
D
Daniel Veillard 已提交
673 674 675 676 677 678 679 680
#libvirt_driver_one_la_CFLAGS  = "-DWITH_ONE"
if WITH_DRIVER_MODULES
libvirt_driver_one_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_one_la_SOURCES = $(ONE_DRIVER_SOURCES)
endif


681
BUILT_SOURCES += $(ESX_DRIVER_GENERATED)
D
Daniel Veillard 已提交
682

683 684
$(ESX_DRIVER_GENERATED): $(srcdir)/esx/esx_vi_generator.input $(srcdir)/esx/esx_vi_generator.py
	-srcdir=$(srcdir) $(srcdir)/esx/esx_vi_generator.py
D
Daniel Veillard 已提交
685

686 687 688 689 690
if WITH_ESX
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_esx.la
else
noinst_LTLIBRARIES += libvirt_driver_esx.la
691
libvirt_la_BUILT_LIBADD += libvirt_driver_esx.la
692
endif
693 694
libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \
		-I@top_srcdir@/src/conf
695 696
libvirt_driver_esx_la_LDFLAGS =
libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS)
697 698 699 700
if WITH_DRIVER_MODULES
libvirt_driver_esx_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES)
701
libvirt_driver_esx_la_DEPENDENCIES = $(ESX_DRIVER_GENERATED)
702 703
endif

704
if WITH_NETWORK
705 706 707
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_network.la
else
708
noinst_LTLIBRARIES += libvirt_driver_network.la
709
# Stateful, so linked to daemon instead
710
#libvirt_la_BUILT_LIBADD += libvirt_driver_network.la
711
endif
712 713
libvirt_driver_network_la_CFLAGS = \
		-I@top_srcdir@/src/conf
714 715 716
if WITH_DRIVER_MODULES
libvirt_driver_network_la_LDFLAGS = -module -avoid-version
endif
717
libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
718
endif
719 720 721 722
EXTRA_DIST += network/default.xml



723

D
Daniel Veillard 已提交
724
if WITH_NETCF
725 726 727 728
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_interface.la
else
noinst_LTLIBRARIES += libvirt_driver_interface.la
729
libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la
730
endif
731 732
libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS) \
		-I@top_srcdir@/src/conf
733 734
libvirt_driver_interface_la_LDFLAGS =
libvirt_driver_interface_la_LIBADD = $(NETCF_LIBS)
735 736 737 738
if WITH_DRIVER_MODULES
libvirt_driver_interface_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES)
D
Daniel Veillard 已提交
739 740
endif

D
Daniel P. Berrange 已提交
741
if WITH_SECRETS
742 743 744 745
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_secret.la
else
noinst_LTLIBRARIES += libvirt_driver_secret.la
746
# Stateful, so linked to daemon instead
747
#libvirt_la_BUILT_LIBADD += libvirt_driver_secret.la
748
endif
749 750
libvirt_driver_secret_la_CFLAGS = \
		-I@top_srcdir@/src/conf
751
if WITH_DRIVER_MODULES
752 753
libvirt_driver_secret_la_LDFLAGS = -module -avoid-version
libvirt_driver_secret_la_LIBADD = ../gnulib/lib/libgnu.la
754 755
endif
libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES)
D
Daniel P. Berrange 已提交
756
endif
757

758 759
# Needed to keep automake quiet about conditionals
libvirt_driver_storage_la_SOURCES =
760 761
libvirt_driver_storage_la_CFLAGS = \
		-I@top_srcdir@/src/conf
762
libvirt_driver_storage_la_LDFLAGS =
763
libvirt_driver_storage_la_LIBADD =
764
if WITH_STORAGE_DIR
765 766 767
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_storage.la
else
768
noinst_LTLIBRARIES += libvirt_driver_storage.la
769
# Stateful, so linked to daemon instead
770
#libvirt_la_BUILT_LIBADD += libvirt_driver_storage.la
771 772
endif
if WITH_DRIVER_MODULES
773
libvirt_driver_storage_la_LDFLAGS += -module -avoid-version
774
endif
775 776
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)
777 778
endif

779
if WITH_STORAGE_LVM
780
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_LVM_SOURCES)
781 782
endif

783
if WITH_STORAGE_ISCSI
784
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_ISCSI_SOURCES)
785 786
endif

787 788 789 790
if WITH_STORAGE_SCSI
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SCSI_SOURCES)
endif

D
Dave Allan 已提交
791 792 793
if WITH_STORAGE_MPATH
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_MPATH_SOURCES)
libvirt_driver_storage_la_CFLAGS += $(DEVMAPPER_CFLAGS)
794
libvirt_driver_storage_la_LIBADD += $(DEVMAPPER_LIBS)
D
Dave Allan 已提交
795 796
endif

797
if WITH_STORAGE_DISK
798
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_DISK_SOURCES)
799
endif
800

801 802 803 804 805 806 807
if WITH_NODE_DEVICES
# Needed to keep automake quiet about conditionals
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_nodedev.la
else
noinst_LTLIBRARIES += libvirt_driver_nodedev.la
# Stateful, so linked to daemon instead
808
#libvirt_la_BUILT_LIBADD += libvirt_driver_nodedev.la
809 810 811
endif
libvirt_driver_nodedev_la_SOURCES = $(NODE_DEVICE_DRIVER_SOURCES)

812 813
libvirt_driver_nodedev_la_CFLAGS = \
		-I@top_srcdir@/src/conf
814
libvirt_driver_nodedev_la_LDFLAGS =
815
libvirt_driver_nodedev_la_LIBADD =
816 817 818
if HAVE_HAL
libvirt_driver_nodedev_la_SOURCES += $(NODE_DEVICE_DRIVER_HAL_SOURCES)
libvirt_driver_nodedev_la_CFLAGS += $(HAL_CFLAGS)
819
libvirt_driver_nodedev_la_LIBADD += $(HAL_LIBS)
820
endif
821 822
if HAVE_UDEV
libvirt_driver_nodedev_la_SOURCES += $(NODE_DEVICE_DRIVER_UDEV_SOURCES)
823
libvirt_driver_nodedev_la_CFLAGS += $(UDEV_CFLAGS) $(PCIACCESS_CFLAGS)
824
libvirt_driver_nodedev_la_LIBADD += $(UDEV_LIBS) $(PCIACCESS_LIBS)
825
endif
826 827 828 829 830 831 832

if WITH_DRIVER_MODULES
libvirt_driver_nodedev_la_LDFLAGS += -module -avoid-version
endif
endif


833 834 835 836
if WITH_NWFILTER
if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_nwfilter.la
else
837
libvirt_la_BUILT_LIBADD += libvirt_driver_nwfilter.la
838 839
noinst_LTLIBRARIES += libvirt_driver_nwfilter.la
endif
840
libvirt_driver_nwfilter_la_CFLAGS = $(LIBPCAP_CFLAGS) \
841
		-I@top_srcdir@/src/conf
842 843
libvirt_driver_nwfilter_la_LDFLAGS =
libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS)
844
if WITH_DRIVER_MODULES
845 846
libvirt_driver_nwfilter_la_LDFLAGS += -module -avoid-version
libvirt_driver_nwfilter_la_LIBADD += ../gnulib/lib/libgnu.la
847 848 849 850 851
endif
libvirt_driver_nwfilter_la_SOURCES = $(NWFILTER_DRIVER_SOURCES)
endif


852 853
libvirt_driver_security_la_SOURCES = $(SECURITY_DRIVER_SOURCES)
noinst_LTLIBRARIES += libvirt_driver_security.la
854
libvirt_la_BUILT_LIBADD += libvirt_driver_security.la
855 856
libvirt_driver_security_la_CFLAGS = \
		-I@top_srcdir@/src/conf
J
Jamie Strandboge 已提交
857
libvirt_driver_security_la_LDFLAGS =
858
libvirt_driver_security_la_LIBADD =
859 860
if WITH_SECDRIVER_SELINUX
libvirt_driver_security_la_SOURCES += $(SECURITY_DRIVER_SELINUX_SOURCES)
J
Jim Fehlig 已提交
861
libvirt_driver_security_la_CFLAGS += $(SELINUX_CFLAGS)
862
libvirt_driver_security_la_LIBADD += $(SELINUX_LIBS)
863
endif
J
Jamie Strandboge 已提交
864 865 866
if WITH_SECDRIVER_APPARMOR
libvirt_driver_security_la_SOURCES += $(SECURITY_DRIVER_APPARMOR_SOURCES)
libvirt_driver_security_la_CFLAGS += $(APPARMOR_CFLAGS)
867
libvirt_driver_security_la_LIBADD += $(APPARMOR_LIBS)
J
Jamie Strandboge 已提交
868
endif
869

870 871 872 873 874 875 876
# Add all conditional sources just in case...
EXTRA_DIST +=							\
		$(TEST_DRIVER_SOURCES)				\
		$(REMOTE_DRIVER_SOURCES)			\
		$(XEN_DRIVER_SOURCES)				\
		$(QEMU_DRIVER_SOURCES)				\
		$(LXC_DRIVER_SOURCES)				\
877
		$(UML_DRIVER_SOURCES)				\
D
Daniel Veillard 已提交
878
		$(ONE_DRIVER_SOURCES)				\
879
		$(OPENVZ_DRIVER_SOURCES)			\
880
		$(PHYP_DRIVER_SOURCES)				\
881
		$(VBOX_DRIVER_SOURCES)				\
882
		$(XENAPI_DRIVER_SOURCES)			\
883
		$(ESX_DRIVER_SOURCES)				\
884
		$(ESX_DRIVER_EXTRA_DIST)			\
885
		$(NETWORK_DRIVER_SOURCES)			\
886
		$(INTERFACE_DRIVER_SOURCES)			\
887 888 889 890
		$(STORAGE_DRIVER_SOURCES)			\
		$(STORAGE_DRIVER_FS_SOURCES)			\
		$(STORAGE_DRIVER_LVM_SOURCES)			\
		$(STORAGE_DRIVER_ISCSI_SOURCES)			\
891
		$(STORAGE_DRIVER_SCSI_SOURCES)			\
D
Dave Allan 已提交
892
		$(STORAGE_DRIVER_MPATH_SOURCES)			\
893 894 895
		$(STORAGE_DRIVER_DISK_SOURCES)			\
		$(NODE_DEVICE_DRIVER_SOURCES)			\
		$(NODE_DEVICE_DRIVER_HAL_SOURCES)		\
896
		$(NODE_DEVICE_DRIVER_UDEV_SOURCES)		\
897
		$(NWFILTER_DRIVER_SOURCES)			\
898
		$(SECURITY_DRIVER_SELINUX_SOURCES)		\
J
Jamie Strandboge 已提交
899
		$(SECURITY_DRIVER_APPARMOR_SOURCES)		\
D
Daniel P. Berrange 已提交
900
		$(SECRET_DRIVER_SOURCES)			\
901
		$(VBOX_DRIVER_EXTRA_DIST)
902

903 904 905 906
check-local: augeas-check

.PHONY: augeas-check
augeas-check:
907
if WITH_QEMU
908
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
909 910 911 912 913
	    '$(AUGPARSE)' -I $(srcdir)/qemu \
	    $(srcdir)/qemu/test_libvirtd_qemu.aug; \
	fi
endif
if WITH_LXC
914
	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
915 916 917 918 919
	    '$(AUGPARSE)' -I $(srcdir)/lxc \
	    $(srcdir)/lxc/test_libvirtd_lxc.aug; \
	fi
endif

920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938
#
# Build our version script.  This is composed of three parts:
#
# 1. libvirt_public.syms - public API.  These functions are always
# present in the library and should never change incompatibly.
#
# 2. libvirt_private.syms - private API.  These symbols are private and
# semantics may change on every release, hence the version number is
# spliced in at build time. This ensures that if libvirtd, virsh, or a
# driver module was built against one libvirt release, it will refuse to
# load with another where symbols may have same names but different
# semantics. Such symbols should never be visible in an (installed)
# public header file.
#
# 3. libvirt_*.syms - dynamic private API.  Like libvirt_private.syms,
# except that build options (such as --enable-debug) can mean these
# symbols aren't present at all.
#

939
if WITH_DRIVER_MODULES
940
USED_SYM_FILES += libvirt_driver_modules.syms
941
endif
942 943

if WITH_BRIDGE
944
USED_SYM_FILES += libvirt_bridge.syms
945
endif
946 947

if WITH_LINUX
948
USED_SYM_FILES += libvirt_linux.syms
949
endif
950

951
if WITH_MACVTAP
952
USED_SYM_FILES += libvirt_macvtap.syms
953
endif
954

955 956 957 958
if WITH_LIBVIRTD
USED_SYM_FILES += libvirt_daemon.syms
endif

959 960 961 962
if WITH_NWFILTER
USED_SYM_FILES += libvirt_nwfilter.syms
endif

963 964 965 966 967
EXTRA_DIST += \
  libvirt_public.syms		\
  libvirt_private.syms		\
  libvirt_driver_modules.syms	\
  libvirt_bridge.syms		\
968
  libvirt_linux.syms		\
969
  libvirt_macvtap.syms		\
970 971
  libvirt_daemon.syms		\
  libvirt_nwfilter.syms
972

973
BUILT_SOURCES += libvirt.syms libvirt.def
974

975
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES)
976 977 978 979 980 981
	$(AM_V_GEN)rm -f $@-tmp $@ ; \
	printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
	cat $(srcdir)/libvirt_public.syms >>$@-tmp && \
	printf '\n\n# Private symbols\n\n' >>$@-tmp && \
	printf 'LIBVIRT_PRIVATE_$(VERSION) {\n\n'  >>$@-tmp && \
	printf 'global:\n\n' >>$@-tmp && \
982
	for file in $(USED_SYM_FILES); do \
983
	    cat $(srcdir)/$$file >>$@-tmp; \
984 985 986
	done && \
	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
	chmod a-w $@-tmp && \
987
	mv $@-tmp libvirt.syms
988

989 990 991 992 993 994 995
libvirt.def: libvirt.syms
	$(AM_V_GEN)rm -f -- $@-tmp $@ ; \
	printf 'EXPORTS\n' > $@-tmp && \
	sed -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /LIBVIRT_/d; s/[ \t]*\(.*\)\;/    \1/g' $^ >> $@-tmp && \
	chmod a-w $@-tmp && \
	mv $@-tmp libvirt.def

996 997
# Empty source list - it merely links a bunch of convenience libs together
libvirt_la_SOURCES =
998
libvirt_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE) \
999
                     -version-info $(LIBVIRT_VERSION_INFO) \
1000
                    $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
1001
		    $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS)
1002
libvirt_la_BUILT_LIBADD += ../gnulib/lib/libgnu.la
1003
libvirt_la_LIBADD += $(LIBXML_LIBS) \
1004
		    $(DRIVER_MODULE_LIBS) \
1005
		    $(CYGWIN_EXTRA_LIBADD)
1006
libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
1007 1008 1009 1010 1011 1012
# Because we specify libvirt_la_DEPENDENCIES for $(LIBVIRT_SYMBOL_FILE), we
# lose automake's automatic dependencies on an appropriate subset of
# $(libvirt_la_LIBADD).  But we were careful to create
# $(libvirt_la_BUILT_LIBADD) as the subset that automake would have
# picked out for us.
libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
1013

1014 1015 1016
# Create an automake "convenience library" version of libvirt_la,
# just for testing, since the test harness requires access to internal
# bits and pieces that we don't want to make publicly accessible.
1017
noinst_LTLIBRARIES += libvirt_test.la
1018

1019
# Remove version script from convenience library
1020 1021
test_LDFLAGS =						\
  $$(echo '$(libvirt_la_LDFLAGS)'			\
1022
     |sed 's!$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE)!!'	\
1023
     |sed 's!-version-info $(LIBVIRT_VERSION_INFO)!!')
1024 1025 1026 1027 1028 1029 1030

# Just like the above, but with a slightly different set of public symbols.
libvirt_test_la_SOURCES = $(libvirt_la_SOURCES)
libvirt_test_la_LIBADD = $(libvirt_la_LIBADD)
libvirt_test_la_LDFLAGS = $(test_LDFLAGS)
libvirt_test_la_CFLAGS = $(COVERAGE_CFLAGS)

C
Chris Lalancette 已提交
1031 1032 1033 1034 1035 1036
libvirt_qemu_la_SOURCES = libvirt-qemu.c
libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
                          -version-info $(LIBVIRT_VERSION_INFO) \
                          $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS)
libvirt_qemu_la_CFLAGS = $(COVERAGE_CFLAGS)
libvirt_qemu_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
1037

1038 1039
libexec_PROGRAMS =

1040
if WITH_STORAGE_DISK
R
Richard W.M. Jones 已提交
1041
if WITH_LIBVIRTD
1042
libexec_PROGRAMS += libvirt_parthelper
1043

1044
libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
E
Eric Blake 已提交
1045
libvirt_parthelper_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
1046 1047 1048 1049 1050 1051 1052
libvirt_parthelper_LDADD =		\
		$(LIBPARTED_LIBS)	\
		$(DEVMAPPER_LIBS)	\
		libvirt_util.la		\
		../gnulib/lib/libgnu.la

libvirt_parthelper_CFLAGS = $(LIBPARTED_CFLAGS) $(DEVMAPPER_CFLAGS)
R
Richard W.M. Jones 已提交
1053
endif
1054
endif
1055 1056
EXTRA_DIST += $(STORAGE_HELPER_DISK_SOURCES)

1057

1058 1059 1060 1061 1062 1063
if WITH_LXC
if WITH_LIBVIRTD
libexec_PROGRAMS += libvirt_lxc

libvirt_lxc_SOURCES =						\
		$(LXC_CONTROLLER_SOURCES)			\
1064
		$(UTIL_SOURCES)					\
1065 1066
		$(NODE_INFO_SOURCES)				\
		$(ENCRYPTION_CONF_SOURCES)			\
1067
		$(DOMAIN_CONF_SOURCES)				\
1068 1069
		$(CPU_CONF_SOURCES)				\
		$(NWFILTER_PARAM_CONF_SOURCES)
E
Eric Blake 已提交
1070
libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
1071 1072
libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
		$(LIBXML_LIBS) $(NUMACTL_LIBS) $(LIB_PTHREAD) \
1073
		$(LIBNL_LIBS) ../gnulib/lib/libgnu.la
1074 1075 1076 1077
libvirt_lxc_CFLAGS =				\
		$(LIBPARTED_CFLAGS)		\
		$(NUMACTL_CFLAGS)		\
		$(CAPNG_CFLAGS)			\
1078
		$(YAJL_CFLAGS)			\
1079
		-I@top_srcdir@/src/conf
1080 1081 1082 1083
endif
endif
EXTRA_DIST += $(LXC_CONTROLLER_SOURCES)

J
Jamie Strandboge 已提交
1084 1085 1086 1087 1088 1089
if WITH_SECDRIVER_APPARMOR
if WITH_LIBVIRTD
libexec_PROGRAMS += virt-aa-helper

virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)

E
Eric Blake 已提交
1090
virt_aa_helper_LDFLAGS = $(WARN_LDFLAGS)
J
Jamie Strandboge 已提交
1091
virt_aa_helper_LDADD =						\
1092
		$(LIBXML_LIBS)					\
C
Chris Lalancette 已提交
1093 1094 1095
		libvirt_conf.la					\
		libvirt_util.la					\
		../gnulib/lib/libgnu.la
J
Jamie Strandboge 已提交
1096 1097 1098 1099 1100 1101 1102
virt_aa_helper_CFLAGS =						\
		-I@top_srcdir@/src/conf				\
		-I@top_srcdir@/src/security
endif
endif
EXTRA_DIST += $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)

1103
install-data-local:
1104 1105 1106 1107 1108 1109
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot"
if WITH_QEMU
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/qemu"
1110
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu"
1111
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/qemu"
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122
endif
if WITH_LXC
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lxc"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/lxc"
endif
if WITH_UML
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/uml"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/uml"
endif
if WITH_NETWORK
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/network"
1123
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/dnsmasq"
1124
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/network"
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
	$(MKDIR_P) "$(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart"
	$(INSTALL_DATA) $(srcdir)/network/default.xml \
	  $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml
	test -z "$(UUID)" || \
	  sed -i -e "s,</name>,</name>\n  <uuid>$(UUID)</uuid>," \
	    $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml
	test -e $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml || \
           ln -s ../default.xml \
	    $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml
endif

uninstall-local::
	rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" ||:
if WITH_QEMU
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu" ||:
	rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/qemu" ||:
	rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu" ||:
	rmdir "$(DESTDIR)$(localstatedir)/log/libvirt/qemu" ||:
1145
endif
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
if WITH_LXC
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lxc" ||:
	rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/lxc" ||:
endif
if WITH_UML
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/uml" ||:
	rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/uml" ||:
endif
if WITH_NETWORK
	rm -f $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml
	rm -f $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml
	rmdir "$(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart" || :
	rmdir "$(DESTDIR)$(sysconfdir)/libvirt/qemu/networks" || :
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||:
	rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/network" ||:
endif
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt" ||:
R
Richard W.M. Jones 已提交
1163

1164
CLEANFILES = *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
1165
DISTCLEANFILES = $(BUILT_SOURCES)