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

3 4 5
INCLUDES = \
	   -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
	   -I../include \
6 7
	   -I@top_srcdir@/include \
	   -I@top_srcdir@/qemud \
8 9
	   $(LIBXML_CFLAGS) \
	   $(GNUTLS_CFLAGS) \
10
	   $(SASL_CFLAGS) \
11
	   $(SELINUX_CFLAGS) \
12
	   $(NUMACTL_CFLAGS) \
13 14 15 16
	   -DBINDIR=\""$(libexecdir)"\" \
	   -DSBINDIR=\""$(sbindir)"\" \
	   -DSYSCONF_DIR="\"$(sysconfdir)\"" \
	   -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
D
Daniel P. Berrange 已提交
17
           -DLOCAL_STATE_DIR=\""$(localstatedir)"\" \
18 19 20
           -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
	   $(WARN_CFLAGS) \
	   $(LIBVIRT_FEATURES)
21
DEPS = libvirt.la
22
LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la ../gnulib/lib/libgnu.la
K
Karel Zak 已提交
23
VIRSH_LIBS = @VIRSH_LIBS@
D
Daniel Veillard 已提交
24

25 26 27 28 29
confdir = $(sysconfdir)/libvirt/
conf_DATA = qemu.conf


EXTRA_DIST = libvirt_sym.version $(conf_DATA)
30

31
lib_LTLIBRARIES = libvirt.la
32

33 34 35 36 37 38
# These files are not related to driver APIs. Simply generic
# helper APIs for various purposes
GENERIC_LIB_SOURCES =						\
		bridge.c bridge.h				\
		buf.c buf.h					\
		conf.c conf.h					\
39
		event.c event.h					\
40 41 42
		iptables.c iptables.h				\
		memory.c memory.h				\
		qparams.c qparams.h				\
43
		stats_linux.c stats_linux.h			\
44 45
		uuid.c uuid.h					\
		util.c util.h					\
46
		virterror.c					\
47 48 49 50 51 52 53 54 55 56 57 58 59 60
		xml.c xml.h

# Domain driver generic impl APIs
DOMAIN_CONF_SOURCES =						\
		capabilities.c capabilities.h			\
		domain_conf.c domain_conf.h			\
		nodeinfo.h nodeinfo.c

# Network driver generic impl APIs
NETWORK_CONF_SOURCES =						\
		network_conf.c network_conf.h

# Storage driver generic impl APIs
STORAGE_CONF_SOURCES =						\
D
Daniel P. Berrange 已提交
61 62
		storage_conf.h storage_conf.c			\
		storage_backend.h storage_backend.c
63 64 65 66 67


# The remote RPC driver, covering domains, storage, networks, etc
REMOTE_DRIVER_SOURCES =						\
		gnutls_1_0_compat.h				\
68
		remote_internal.c remote_internal.h		\
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
		../qemud/remote_protocol.c			\
		../qemud/remote_protocol.h			\
		socketcompat.h

# Mock driver, covering domains, storage, networks, etc
TEST_DRIVER_SOURCES =						\
		test.c test.h



# Now the Hypervisor specific drivers
XEN_DRIVER_SOURCES =						\
		proxy_internal.c proxy_internal.h		\
		sexpr.c sexpr.h					\
		xen_internal.c xen_internal.h			\
		xen_unified.c xen_unified.h			\
		xend_internal.c xend_internal.h			\
		xm_internal.c xm_internal.h			\
		xs_internal.c xs_internal.h

LXC_DRIVER_SOURCES =						\
D
Daniel Veillard 已提交
90
		lxc_conf.c lxc_conf.h				\
R
Richard W.M. Jones 已提交
91
		lxc_container.c lxc_container.h			\
92
		lxc_driver.c lxc_driver.h			\
D
Dan Smith 已提交
93 94
		veth.c veth.h					\
		cgroup.c cgroup.h
95

96 97 98 99
LXC_CONTROLLER_SOURCES =					\
		lxc_conf.c lxc_conf.h				\
		lxc_container.c lxc_container.h			\
		lxc_controller.c				\
D
Dan Smith 已提交
100 101
		veth.c veth.h                                   \
		cgroup.c cgroup.h
102

103 104 105
OPENVZ_DRIVER_SOURCES =						\
		openvz_conf.c openvz_conf.h			\
		openvz_driver.c openvz_driver.h
106

107 108 109 110
# XXX network driver should be split out of this
QEMU_DRIVER_SOURCES =						\
		qemu_conf.c qemu_conf.h				\
		qemu_driver.c qemu_driver.h
R
Richard W.M. Jones 已提交
111

112 113 114

# And finally storage backend specific impls
STORAGE_DRIVER_SOURCES =					\
D
Daniel P. Berrange 已提交
115
		storage_driver.h storage_driver.c
116 117

STORAGE_DRIVER_FS_SOURCES =					\
R
Richard W.M. Jones 已提交
118 119
		storage_backend_fs.h storage_backend_fs.c

120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
STORAGE_DRIVER_LVM_SOURCES =					\
		storage_backend_logical.h 			\
		storage_backend_logical.c

STORAGE_DRIVER_ISCSI_SOURCES =					\
		storage_backend_iscsi.h storage_backend_iscsi.c

STORAGE_DRIVER_DISK_SOURCES =					\
		storage_backend_disk.h storage_backend_disk.c

STORAGE_HELPER_DISK_SOURCES =					\
		parthelper.c



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

libvirt_la_SOURCES =						\
		driver.h					\
		hash.c hash.h					\
		internal.h					\
		libvirt.c					\
		$(GENERIC_LIB_SOURCES)				\
		$(DOMAIN_CONF_SOURCES)				\
		$(NETWORK_CONF_SOURCES)				\
		$(STORAGE_CONF_SOURCES)

# Drivers usable outside daemon context
if WITH_TEST
libvirt_la_SOURCES += $(TEST_DRIVER_SOURCES)
endif

if WITH_REMOTE
libvirt_la_SOURCES += $(REMOTE_DRIVER_SOURCES)
endif

if WITH_XEN
libvirt_la_SOURCES += $(XEN_DRIVER_SOURCES)
endif

164 165 166 167
if WITH_OPENVZ
libvirt_la_SOURCES += $(OPENVZ_DRIVER_SOURCES)
endif

168 169 170 171 172 173 174 175 176 177 178 179 180 181

# Drivers usable inside daemon context
if WITH_LIBVIRTD
libvirt_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
libvirt_la_SOURCES += $(STORAGE_DRIVER_FS_SOURCES)

if WITH_QEMU
libvirt_la_SOURCES += $(QEMU_DRIVER_SOURCES)
endif

if WITH_LXC
libvirt_la_SOURCES += $(LXC_DRIVER_SOURCES)
endif

182
if WITH_STORAGE_LVM
183
libvirt_la_SOURCES += $(STORAGE_DRIVER_LVM_SOURCES)
184 185
endif

186
if WITH_STORAGE_ISCSI
187
libvirt_la_SOURCES += $(STORAGE_DRIVER_ISCSI_SOURCES)
188 189
endif

190
if WITH_STORAGE_DISK
191
libvirt_la_SOURCES += $(STORAGE_DRIVER_DISK_SOURCES)
192
endif
R
Richard W.M. Jones 已提交
193
endif
194

195 196 197 198 199 200 201 202 203 204 205 206 207 208
# Add all conditional sources just in case...
EXTRA_DIST +=							\
		$(TEST_DRIVER_SOURCES)				\
		$(REMOTE_DRIVER_SOURCES)			\
		$(XEN_DRIVER_SOURCES)				\
		$(QEMU_DRIVER_SOURCES)				\
		$(LXC_DRIVER_SOURCES)				\
		$(OPENVZ_DRIVER_SOURCES)			\
		$(STORAGE_DRIVER_SOURCES)			\
		$(STORAGE_DRIVER_FS_SOURCES)			\
		$(STORAGE_DRIVER_LVM_SOURCES)			\
		$(STORAGE_DRIVER_ISCSI_SOURCES)			\
		$(STORAGE_DRIVER_DISK_SOURCES)

209

210
libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) $(SELINUX_LIBS) \
211
                    $(NUMACTL_LIBS) \
212
		    @CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
213 214 215
libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
                     -version-info @LIBVIRT_VERSION_INFO@ \
                    $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
216
		    @CYGWIN_EXTRA_LDFLAGS@ @MINGW_EXTRA_LDFLAGS@
217
libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
218

219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
# 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.
noinst_LTLIBRARIES = libvirt_test.la

# Convert libvirt_sym.version
#      to libvirt_test_sym.version, and
# remove -version-info X.Y.Z (not needed since this is a convenience library.
test_LDFLAGS =						\
  $$(echo '$(libvirt_la_LDFLAGS)'			\
     |sed 's!-Wl,--v.*_sym\.version!!'			\
     |sed 's!-version-info @LIBVIRT_VERSION_INFO@!!')

# 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)

K
Karel Zak 已提交
238
bin_PROGRAMS = virsh
239

240 241 242 243 244
virsh_SOURCES =							\
		console.c console.h				\
		util-lib.c util-lib.h				\
		virsh.c

245
virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
246
virsh_DEPENDENCIES = $(DEPS)
K
Karel Zak 已提交
247
virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
248
virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c

virsh-net-edit.c: virsh.c Makefile.am
	rm -f $@-tmp
	echo '/* Automatically generated from: $^ */' > $@-tmp
	echo 'static int' >> $@-tmp
	awk '/^cmdEdit/, /^}/' $< \
	  | sed -e 's/domain/network/g' \
	      -e 's/Domain/Network/g' \
	      -e 's/cmdEdit/cmdNetworkEdit/g' \
	      -e 's/dom/network/g' \
	>> $@-tmp
	chmod a-w $@-tmp
	rm -f $@
	mv $@-tmp $@

virsh-pool-edit.c: virsh.c Makefile.am
	rm -f $@-tmp
	echo '/* Automatically generated from: $^ */' > $@-tmp
	echo 'static int' >> $@-tmp
	awk '/^cmdEdit/, /^}/' $< \
	  | sed -e 's/domain/pool/g' \
	      -e 's/vshCommandOptDomain/vshCommandOptPool/g' \
	      -e 's/Domain %s/Pool %s/g' \
	      -e 's/Domain/StoragePool/g' \
	      -e 's/cmdEdit/cmdPoolEdit/g' \
	      -e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
	      -e 's/dom/pool/g' \
	>> $@-tmp
	chmod a-w $@-tmp
	rm -f $@
	mv $@-tmp $@
281

282 283
libexec_PROGRAMS =

284
if WITH_STORAGE_DISK
R
Richard W.M. Jones 已提交
285
if WITH_LIBVIRTD
286
libexec_PROGRAMS += libvirt_parthelper
287

288
libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
289 290 291
libvirt_parthelper_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDCFLAGS)
libvirt_parthelper_LDADD = $(LIBPARTED_LIBS)
libvirt_parthelper_CFLAGS =  $(LIBPARTED_CFLAGS)
R
Richard W.M. Jones 已提交
292
endif
293
endif
294 295
EXTRA_DIST += $(STORAGE_HELPER_DISK_SOURCES)

296

297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
if WITH_LXC
if WITH_LIBVIRTD
libexec_PROGRAMS += libvirt_lxc

libvirt_lxc_SOURCES =						\
		$(LXC_CONTROLLER_SOURCES)			\
		$(GENERIC_LIB_SOURCES) 				\
		$(DOMAIN_CONF_SOURCES)
libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDCFLAGS)
libvirt_lxc_LDADD = $(LIBXML_LIBS) ../gnulib/lib/libgnu.la
libvirt_lxc_CFLAGS =  $(LIBPARTED_CFLAGS)
endif
endif
EXTRA_DIST += $(LXC_CONTROLLER_SOURCES)

R
Richard W.M. Jones 已提交
312 313
# Create the /var/cache/libvirt directory when installing.
install-exec-local:
D
Daniel P. Berrange 已提交
314
	$(MKDIR_P) $(DESTDIR)$(localstatedir)/cache/libvirt
R
Richard W.M. Jones 已提交
315

316
CLEANFILES = *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
317
DISTCLEANFILES = $(BUILT_SOURCES)