You need to sign in or sign up before continuing.
Makefile.am 23.1 KB
Newer Older
D
Daniel Veillard 已提交
1 2
## Process this file with automake to produce Makefile.in

3
## Copyright (C) 2005-2018 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 20
# No libraries with the exception of LIBXML should be listed
# here. List them against the individual XXX_la_CFLAGS targets
21
# that actually use them.
22
AM_CPPFLAGS =	-I../gnulib/lib \
23 24 25 26 27 28 29
		-I$(top_srcdir)/gnulib/lib \
		-I$(top_srcdir) \
		-I../include \
		-I$(top_srcdir)/include \
		-I$(srcdir)/util \
		-I./util \
		-DIN_LIBVIRT \
30 31
		-Dabs_top_builddir="\"$(abs_top_builddir)\"" \
		-Dabs_top_srcdir="\"$(abs_top_srcdir)\"" \
32
		$(NULL)
E
Eric Blake 已提交
33

34 35
WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)

36 37 38 39
AM_CFLAGS =	$(LIBXML_CFLAGS) \
		$(WARN_CFLAGS) \
		$(LOCK_CHECKING_CFLAGS) \
		$(WIN32_EXTRA_CFLAGS) \
40
		$(NULL)
41 42 43 44 45
AM_LDFLAGS =	$(DRIVER_MODULES_LDFLAGS) \
		$(RELRO_LDFLAGS) \
		$(NO_INDIRECT_LDFLAGS) \
		$(CYGWIN_EXTRA_LDFLAGS) \
		$(MINGW_EXTRA_LDFLAGS) \
G
Guido Günther 已提交
46
		$(NULL)
47 48 49 50 51
AM_LDFLAGS_MOD = \
	-module \
	-avoid-version \
	$(LIBVIRT_NODELETE) \
	$(AM_LDFLAGS)
52
AM_LDFLAGS_MOD_NOUNDEF = $(AM_LDFLAGS_MOD) $(NO_UNDEFINED_LDFLAGS)
53

54 55
POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"

56
EXTRA_DIST = $(conf_DATA)
57

58
BUILT_SOURCES =
59 60 61
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
62
nodist_conf_DATA =
63 64 65 66 67
DRIVER_SOURCE_FILES =
STATEFUL_DRIVER_SOURCE_FILES =
noinst_LTLIBRARIES =
mod_LTLIBRARIES =
INSTALL_DATA_DIRS =
68 69
INSTALL_DATA_LOCAL =
UNINSTALL_LOCAL =
70
libvirt_la_BUILT_LIBADD =
71 72 73
SYM_FILES =
USED_SYM_FILES =
GENERATED_SYM_FILES =
74 75 76 77 78 79
augeas_DATA =
augeastest_DATA =
conf_DATA =
if WITH_DTRACE_PROBES
tapset_DATA =
endif WITH_DTRACE_PROBES
80 81
libexec_PROGRAMS =
RPC_PROBE_FILES =
82 83 84 85 86 87 88
LOGROTATE_FILES_IN =
PODFILES =
MANINFILES =
SYSTEMD_UNIT_FILES_IN =
SYSCONF_FILES =
sbin_PROGRAMS =
man8_MANS =
89
DRIVER_SOURCES =
90
man7_MANS =
91

92
include util/Makefile.inc.am
93
include conf/Makefile.inc.am
94
include cpu/Makefile.inc.am
95
include cpu_map/Makefile.inc.am
96
include security/Makefile.inc.am
97
include access/Makefile.inc.am
98
include logging/Makefile.inc.am
99
include locking/Makefile.inc.am
100
include admin/Makefile.inc.am
101
include rpc/Makefile.inc.am
102
include phyp/Makefile.inc.am
103
include test/Makefile.inc.am
104
include esx/Makefile.inc.am
105
include hyperv/Makefile.inc.am
106
include vmx/Makefile.inc.am
107
include vmware/Makefile.inc.am
108
include vbox/Makefile.inc.am
109
include openvz/Makefile.inc.am
110
include qemu/Makefile.inc.am
111
include bhyve/Makefile.inc.am
112
include xenconfig/Makefile.inc.am
113
include libxl/Makefile.inc.am
114
include xenapi/Makefile.inc.am
115
include vz/Makefile.inc.am
116
include lxc/Makefile.inc.am
117
include interface/Makefile.inc.am
118
include network/Makefile.inc.am
119
include nwfilter/Makefile.inc.am
120
include node_device/Makefile.inc.am
121
include secret/Makefile.inc.am
122
include storage/Makefile.inc.am
123
include remote/Makefile.inc.am
124

125

E
Eric Blake 已提交
126 127
THREAD_LIBS = $(LIB_PTHREAD) $(LTLIBMULTITHREAD)

J
Jim Fehlig 已提交
128
SECDRIVER_CFLAGS =
129 130
SECDRIVER_LIBS =
if WITH_SECDRIVER_SELINUX
J
Jim Fehlig 已提交
131
SECDRIVER_CFLAGS += $(SELINUX_CFLAGS)
132
SECDRIVER_LIBS += $(SELINUX_LIBS)
133
endif WITH_SECDRIVER_SELINUX
134
if WITH_SECDRIVER_APPARMOR
J
Jim Fehlig 已提交
135
SECDRIVER_CFLAGS += $(APPARMOR_CFLAGS)
136
SECDRIVER_LIBS += $(APPARMOR_LIBS)
137
endif WITH_SECDRIVER_APPARMOR
138

139

140
lib_LTLIBRARIES = libvirt.la libvirt-qemu.la libvirt-lxc.la
141

142
moddir = $(libdir)/libvirt/connection-driver
143

A
Amy Griffis 已提交
144
confdir = $(sysconfdir)/libvirt
145
conf_DATA += libvirt.conf libvirt-admin.conf
146

147 148 149 150
augeasdir = $(datadir)/augeas/lenses

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

151
CLEANFILES += $(augeastest_DATA)
L
Lai Jiangshan 已提交
152

153
# Internal generic driver infrastructure
O
Osier Yang 已提交
154
DATATYPES_SOURCES = datatypes.h datatypes.c
155
DRIVER_SOURCES += \
156 157 158 159 160 161 162 163 164 165 166 167 168 169
		driver.c driver.h \
		driver-hypervisor.h \
		driver-interface.h \
		driver-network.h \
		driver-nodedev.h \
		driver-nwfilter.h \
		driver-secret.h \
		driver-state.h \
		driver-storage.h \
		driver-stream.h \
		internal.h \
		$(DATATYPES_SOURCES) \
		libvirt.c libvirt_internal.h \
		libvirt-domain.c \
170
		libvirt-domain-checkpoint.c \
171 172 173 174 175 176 177 178 179
		libvirt-domain-snapshot.c \
		libvirt-host.c \
		libvirt-interface.c \
		libvirt-network.c \
		libvirt-nodedev.c \
		libvirt-nwfilter.c \
		libvirt-secret.c \
		libvirt-storage.c \
		libvirt-stream.c \
180
		$(NULL)
181

182

183

M
Martin Kletzander 已提交
184

185 186 187 188 189 190 191 192 193 194
# 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
195 196 197 198

# With pdwtags 1.8, --verbose output includes separators like these:
# /* 93 */
# /* <0> (null):0 */
199 200
# with the second line omitted for intrinsic types.
# Whereas with pdwtags 1.3, they look like this:
201
# /* <2d2> /usr/include/libio.h:180 */
202 203
# The alternation of the following regexps matches both cases.
r1 = /\* \d+ \*/
204
r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/
M
Martin Kletzander 已提交
205 206 207
libs_prefix = remote_|qemu_|lxc_|admin_
other_prefix = keepalive|vir(Net|LockSpace|LXCMonitor)
struct_prefix = ($(libs_prefix)|$(other_prefix))
208

209
# Depending on configure options, libtool creates one or both of
E
Eric Blake 已提交
210 211
# remote/{,.libs/}libvirt_driver_remote_la-remote_protocol.o.  We want
# the newest of the two, in case configure options changed and a stale
212
# file is left around from an earlier build.
213 214 215
# The pdwtags output is completely different when building with clang
# which causes the comparison against expected output to fail, so skip
# if using clang as CC.
216
PDWTAGS = \
A
Andrea Bolognani 已提交
217
	$(AM_V_GEN)if $(CC) -v 2>&1 | grep -q clang; then \
218 219 220 221
	   echo 'WARNING: skipping pdwtags test with Clang' >&2; \
	   exit 0; \
	fi; \
	if (pdwtags --help) > /dev/null 2>&1; then \
222 223 224 225 226 227 228
	  o=`ls -t $(<:.lo=.$(OBJEXT)) \
	     $(subst /,/.libs/,$(<:.lo=.$(OBJEXT))) \
	    2>/dev/null | sed -n 1p`; \
	  test -f "$$o" || { echo ".o for $< not found" >&2; exit 1; }; \
	  pdwtags --verbose $$o > $(@F)-t1 2> $(@F)-t2; \
	  if test ! -s $(@F)-t1 && test -s $(@F)-t2; then \
	    rm -rf $(@F)-t?; \
229
	    echo 'WARNING: pdwtags appears broken; skipping the $@ test' >&2;\
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
	  else \
	    $(PERL) -0777 -n \
		-e 'foreach my $$p (split m!\n*(?:$(r1)|$(r2))\n!) {' \
		-e '  if ($$p =~ /^(struct|enum) $(struct_prefix)/ ||' \
		-e '      $$p =~ /^enum \{/) {' \
		-e '    $$p =~ s!\t*/\*.*?\*/!!sg;' \
		-e '    $$p =~ s!\s+\n!\n!sg;' \
		-e '    $$p =~ s!\s+$$!!;' \
		-e '    $$p =~ s!\t!        !g;' \
		-e '    print "$$p\n";' \
		-e '    $$n++;' \
		-e '  }' \
		-e '}' \
		-e 'BEGIN {' \
		-e '  print "/* -*- c -*- */\n";' \
		-e '}' \
		-e 'END {' \
		-e '  if ($$n < 1) {' \
248
		-e '    warn "WARNING: your pdwtags program is too old\n";' \
249
		-e '    warn "WARNING: skipping the $@ test\n";' \
250
		-e '    warn "WARNING: install dwarves-1.3 or newer\n";' \
251 252 253 254
		-e '    exit 8;' \
		-e '  }' \
		-e '}' \
		< $(@F)-t1 > $(@F)-t3; \
255
	    case $$? in 8) rm -f $(@F)-t?; exit 0;; 0) ;; *) exit 1;; esac;\
256 257 258 259
	    diff -u $(@)s $(@F)-t3; st=$$?; rm -f $(@F)-t?; exit $$st; \
	  fi; \
	else \
	  echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \
260
	  echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
261
	fi
262

263
# .libs/libvirt.so is built by libtool as a side-effect of the Makefile
264 265
# rule for libvirt.la.  However, checking symbols relies on Linux ELF layout
if WITH_LINUX
266 267 268
check-symfile: libvirt.syms libvirt.la
	$(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt.syms \
	  .libs/libvirt.so
269 270 271
check-admin-symfile: libvirt_admin.syms libvirt-admin.la
	$(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt_admin.syms \
	  .libs/libvirt-admin.so
272
else ! WITH_LINUX
273
check-symfile:
274
check-admin-symfile:
275
endif ! WITH_LINUX
276
check-symsorting:
277
	$(AM_V_GEN)$(PERL) $(srcdir)/check-symsorting.pl \
278
		$(srcdir) $(SYM_FILES)
279 280 281
check-admin-symsorting:
	$(AM_V_GEN)$(PERL) $(srcdir)/check-symsorting.pl \
		$(srcdir) $(ADMIN_SYM_FILES)
J
Jiri Denemark 已提交
282
EXTRA_DIST += check-symfile.pl check-symsorting.pl
283

E
Eric Blake 已提交
284
# Keep this list synced with RPC_PROBE_FILES
285 286
PROTOCOL_STRUCTS = \
	$(srcdir)/remote_protocol-structs \
287
	$(srcdir)/lxc_protocol-structs \
288
	$(srcdir)/qemu_protocol-structs \
J
Jiri Denemark 已提交
289
	$(srcdir)/virnetprotocol-structs \
E
Eric Blake 已提交
290 291 292
	$(srcdir)/virkeepaliveprotocol-structs \
	$(srcdir)/lxc_monitor_protocol-structs \
	$(srcdir)/lock_protocol-structs \
M
Martin Kletzander 已提交
293
	$(srcdir)/admin_protocol-structs \
E
Eric Blake 已提交
294 295
	$(NULL)

296
if WITH_REMOTE
297 298
check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct)

299 300
# The .o file that pdwtags parses is created as a side effect of running
# libtool; but from make's perspective we depend on the .lo file.
301 302 303
$(srcdir)/remote_protocol-struct \
	$(srcdir)/qemu_protocol-struct \
	$(srcdir)/lxc_protocol-struct: \
E
Eric Blake 已提交
304
		$(srcdir)/%-struct: remote/libvirt_driver_remote_la-%.lo
305
	$(PDWTAGS)
306
$(srcdir)/virnetprotocol-struct $(srcdir)/virkeepaliveprotocol-struct: \
E
Eric Blake 已提交
307
		$(srcdir)/%-struct: rpc/libvirt_net_rpc_la-%.lo
308
	$(PDWTAGS)
E
Eric Blake 已提交
309
$(srcdir)/lxc_monitor_protocol-struct: \
E
Eric Blake 已提交
310
		$(srcdir)/%-struct: lxc/libvirt_driver_lxc_impl_la-%.lo
E
Eric Blake 已提交
311 312
	$(PDWTAGS)
$(srcdir)/lock_protocol-struct: \
E
Eric Blake 已提交
313
		$(srcdir)/%-struct: locking/lockd_la-%.lo
E
Eric Blake 已提交
314
	$(PDWTAGS)
M
Martin Kletzander 已提交
315 316 317
$(srcdir)/admin_protocol-struct: \
		$(srcdir)/%-struct: admin/libvirt_admin_la-%.lo
	$(PDWTAGS)
E
Eric Blake 已提交
318

319
else !WITH_REMOTE
320 321 322
# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
# re-generated when configured --without-remote.
check-protocol:
323
endif !WITH_REMOTE
J
Jiri Denemark 已提交
324
EXTRA_DIST += $(PROTOCOL_STRUCTS)
325 326 327 328 329

check-drivername:
	$(AM_V_GEN)$(PERL) $(srcdir)/check-drivername.pl \
		$(srcdir)/driver.h \
		$(srcdir)/libvirt_public.syms \
330
		$(srcdir)/libvirt_admin_public.syms \
331 332 333 334 335
		$(srcdir)/libvirt_qemu.syms \
		$(srcdir)/libvirt_lxc.syms

EXTRA_DIST += check-drivername.pl

336 337
check-driverimpls:
	$(AM_V_GEN)$(PERL) $(srcdir)/check-driverimpls.pl \
338
		$(filter /%,$(DRIVER_SOURCE_FILES)) \
E
Eric Blake 已提交
339 340 341
		$(filter $(srcdir)/%,$(DRIVER_SOURCE_FILES)) \
		$(addprefix $(srcdir)/,$(filter-out $(srcdir)/%, \
			$(filter-out /%,$(DRIVER_SOURCE_FILES))))
342

343 344
check-aclrules:
	$(AM_V_GEN)$(PERL) $(srcdir)/check-aclrules.pl \
E
Eric Blake 已提交
345
		$(REMOTE_PROTOCOL) \
346
		$(addprefix $(srcdir)/,$(filter-out /%,$(STATEFUL_DRIVER_SOURCE_FILES)))
347

348 349 350 351 352
check-aclperms:
	$(AM_V_GEN)$(PERL) $(srcdir)/check-aclperms.pl \
		$(srcdir)/access/viraccessperm.h \
		$(srcdir)/access/viraccessperm.c

G
Guido Günther 已提交
353
EXTRA_DIST += check-driverimpls.pl check-aclrules.pl check-aclperms.pl
354

355
check-local: check-protocol check-symfile check-symsorting \
356
	check-drivername check-driverimpls check-aclrules \
357
	check-aclperms check-admin-symfile check-admin-symsorting
358
.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
359

360 361 362 363 364 365 366

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

367

368
noinst_LTLIBRARIES += libvirt_driver.la
369
libvirt_la_BUILT_LIBADD += libvirt_driver.la
370
libvirt_driver_la_SOURCES = $(DRIVER_SOURCES)
371

372
libvirt_driver_la_CFLAGS = \
373
		$(GNUTLS_CFLAGS) $(CURL_CFLAGS) $(XDR_CFLAGS) \
374
		-I$(srcdir)/conf $(AM_CFLAGS)
375
libvirt_driver_la_LIBADD = \
376
		$(GNUTLS_LIBS) $(CURL_LIBS) $(DLOPEN_LIBS)
377

378 379
# All .syms files should be placed in exactly one of these three lists,
# depending on whether they are stored in git and/or used in the build.
380 381 382
SYM_FILES += $(USED_SYM_FILES)
USED_SYM_FILES += $(srcdir)/libvirt_private.syms
GENERATED_SYM_FILES += \
383
	libvirt.syms libvirt.def libvirt_qemu.def libvirt_lxc.def \
384
	libvirt_admin.syms libvirt_admin.def \
385
	$(NULL)
386

C
Chris Lalancette 已提交
387

388

389
%protocol.c: %protocol.x %protocol.h $(srcdir)/rpc/genprotocol.pl
390
	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -c \
391
	       $< $(srcdir)/$(subst $(srcdir)/,,$@)
392

393
%protocol.h: %protocol.x $(srcdir)/rpc/genprotocol.pl
394
	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -h \
395
	       $< $(srcdir)/$(subst $(srcdir)/,,$@)
396

397 398
check-local: check-augeas

399 400 401 402 403 404 405 406 407 408 409 410
check-augeas: $(augeas_DATA) $(augeastest_DATA)
	$(AM_V_GEN) \
	if test -x "$(AUGPARSE)"; then \
	    for f in $(augeastest_DATA); do \
		DIR=$$(dirname "$$f"); \
		FILE=$$(basename "$$f"); \
		"$(AUGPARSE)" \
		    -I "$(srcdir)/$$DIR" -I "$(builddir)/$$DIR" \
		    "$$DIR/$$FILE"; \
	    done; \
	fi
.PHONY: check-augeas
411

412
AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl
413

414

415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
#
# 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.
#

434
USED_SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
435

436
if WITH_LINUX
437
USED_SYM_FILES += $(srcdir)/libvirt_linux.syms
438
else ! WITH_LINUX
439
SYM_FILES += $(srcdir)/libvirt_linux.syms
440
endif ! WITH_LINUX
441

442
if WITH_SASL
443
USED_SYM_FILES += $(srcdir)/libvirt_sasl.syms
444
else ! WITH_SASL
445
SYM_FILES += $(srcdir)/libvirt_sasl.syms
446
endif ! WITH_SASL
E
Eric Blake 已提交
447

448
if WITH_SSH2
449
USED_SYM_FILES += $(srcdir)/libvirt_libssh2.syms
450
else ! WITH_SSH2
451
SYM_FILES += $(srcdir)/libvirt_libssh2.syms
452
endif ! WITH_SSH2
453

454
if WITH_ATOMIC_OPS_PTHREAD
455
USED_SYM_FILES += $(srcdir)/libvirt_atomic.syms
456
else ! WITH_ATOMIC_OPS_PTHREAD
457
SYM_FILES += $(srcdir)/libvirt_atomic.syms
458
endif ! WITH_ATOMIC_OPS_PTHREAD
459

460 461 462 463 464 465
if WITH_LIBSSH
USED_SYM_FILES += $(srcdir)/libvirt_libssh.syms
else ! WITH_LIBSSH
SYM_FILES += $(srcdir)/libvirt_libssh.syms
endif ! WITH_LIBSSH

466
EXTRA_DIST += \
467 468 469 470 471 472
	libvirt_public.syms \
	libvirt_lxc.syms \
	libvirt_qemu.syms \
	libvirt_admin_public.syms \
	$(SYM_FILES) \
	$(ADMIN_SYM_FILES) \
473
	$(NULL)
474

475
BUILT_SOURCES += $(GENERATED_SYM_FILES)
476

477 478
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \
		$(ACCESS_DRIVER_SYM_FILES) \
479
		$(top_builddir)/config.status
480 481 482 483 484 485
	$(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 && \
486
	cat $(USED_SYM_FILES) $(ACCESS_DRIVER_SYM_FILES) >>$@-tmp && \
487 488
	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
	chmod a-w $@-tmp && \
489
	mv $@-tmp libvirt.syms
490

491
%.def: %.syms
492 493
	$(AM_V_GEN)rm -f -- $@-tmp $@ ; \
	printf 'EXPORTS\n' > $@-tmp && \
494
	sed -e '/^$$/d; /#/d; /:/d; /}/d; /\*/d; /LIBVIRT_/d' \
495
	    -e 's/[	 ]*\(.*\)\;/    \1/g' $^ >> $@-tmp && \
496
	chmod a-w $@-tmp && \
497
	mv $@-tmp $@
498

499 500 501 502 503 504 505 506 507 508 509 510 511
libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
		$(top_builddir)/config.status
	$(AM_V_GEN)rm -f $@-tmp $@ ; \
	printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
	cat $(srcdir)/libvirt_admin_public.syms >>$@-tmp && \
	printf '\n\n# Private symbols\n\n' >>$@-tmp && \
	printf 'LIBVIRT_ADMIN_PRIVATE_$(VERSION) {\n\n'  >>$@-tmp && \
	printf 'global:\n\n' >>$@-tmp && \
	cat $(ADMIN_SYM_FILES) >>$@-tmp && \
	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
	chmod a-w $@-tmp && \
	mv $@-tmp libvirt_admin.syms

512

M
Martin Kletzander 已提交
513 514
lib_LTLIBRARIES += libvirt-admin.la
libvirt_admin_la_SOURCES = \
515 516
		libvirt-admin.c \
		$(ADMIN_PROTOCOL_GENERATED) \
M
Martin Kletzander 已提交
517 518 519
		$(DATATYPES_SOURCES)

libvirt_admin_la_LDFLAGS = \
520 521
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_ADMIN_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
522 523 524
		$(LIBVIRT_NODELETE) \
		$(AM_LDFLAGS) \
		$(NULL)
M
Martin Kletzander 已提交
525 526

libvirt_admin_la_LIBADD = \
527
		libvirt.la \
M
Martin Kletzander 已提交
528 529 530
		$(CYGWIN_EXTRA_LIBADD)

libvirt_admin_la_CFLAGS = \
531 532 533
		$(AM_CFLAGS) \
		-I$(srcdir)/remote \
		-I$(srcdir)/rpc \
M
Martin Kletzander 已提交
534 535 536
		-I$(srcdir)/admin

libvirt_admin_la_CFLAGS += \
537 538
		$(XDR_CFLAGS) \
		$(CAPNG_CFLAGS) \
539
		$(YAJL_CFLAGS) \
540 541 542
		$(SSH2_CFLAGS) \
		$(SASL_CFLAGS) \
		$(GNUTLS_CFLAGS) \
543
		$(LIBSSH_CFLAGS)
M
Martin Kletzander 已提交
544 545

libvirt_admin_la_LIBADD += \
546
		$(CAPNG_LIBS) \
547
		$(YAJL_LIBS) \
548 549 550 551 552
		$(DEVMAPPER_LIBS) \
		$(LIBXML_LIBS) \
		$(SSH2_LIBS) \
		$(SASL_LIBS) \
		$(GNUTLS_LIBS) \
553
		$(LIBSSH_LIBS)
M
Martin Kletzander 已提交
554

555 556
ADMIN_SYM_FILES = $(srcdir)/libvirt_admin_private.syms

M
Martin Kletzander 已提交
557 558 559 560
if WITH_DTRACE_PROBES
libvirt_admin_la_LIBADD += libvirt_probes.lo
endif WITH_DTRACE_PROBES

561 562
# Empty source list - it merely links a bunch of convenience libs together
libvirt_la_SOURCES =
D
Daniel P. Berrange 已提交
563 564 565 566
libvirt_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
		$(LIBVIRT_NODELETE) \
567
		$(NO_UNDEFINED_LDFLAGS) \
D
Daniel P. Berrange 已提交
568 569
		$(AM_LDFLAGS) \
		$(NULL)
570
libvirt_la_BUILT_LIBADD += ../gnulib/lib/libgnu.la
571
libvirt_la_LIBADD += \
572
		    $(DRIVER_MODULES_LIBS) \
573
		    $(CYGWIN_EXTRA_LIBADD)
574
libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
575 576 577 578 579 580
# 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)
581

582
if WITH_DTRACE_PROBES
583
libvirt_la_BUILT_LIBADD += libvirt_probes.lo
584
libvirt_la_DEPENDENCIES += libvirt_probes.lo libvirt_probes.o
585
nodist_libvirt_la_SOURCES = libvirt_probes.h
E
Eric Blake 已提交
586
if WITH_REMOTE
E
Eric Blake 已提交
587
nodist_libvirt_driver_remote_la_SOURCES = libvirt_probes.h
E
Eric Blake 已提交
588
endif WITH_REMOTE
589
DTRACE2SYSTEMTAP_FLAGS = --with-modules
590

591 592
BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp

593 594

tapsetdir = $(datadir)/systemtap/tapset
595
tapset_DATA += libvirt_probes.stp libvirt_functions.stp
596

597
%_probes.h: %_probes.d
598 599
	$(AM_V_GEN)$(DTRACE) -o $@ -h -s $<

E
Eric Blake 已提交
600
.PRECIOUS: %_probes.o
601
%_probes.o: %_probes.d
602 603
	$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<

604 605 606 607 608 609 610 611 612
%_probes.lo: %_probes.o
	$(AM_V_GEN)printf %s\\n \
	  '# $@ - a libtool object file' \
	  '# Generated by libtool (GNU libtool) 2.4' \
	  '# Actually generated by Makefile.am, in order to shut up libtool' \
	  "pic_object='$<'" \
	  "non_pic_object='$<'" \
	> $@

E
Eric Blake 已提交
613
# Keep this list synced with PROTOCOL_STRUCTS
614
RPC_PROBE_FILES += $(srcdir)/rpc/virnetprotocol.x \
J
Jiri Denemark 已提交
615 616
		  $(srcdir)/rpc/virkeepaliveprotocol.x \
		  $(srcdir)/remote/remote_protocol.x \
617
		  $(srcdir)/remote/lxc_protocol.x \
618
		  $(srcdir)/remote/qemu_protocol.x \
M
Martin Kletzander 已提交
619
		  $(srcdir)/admin/admin_protocol.x
620 621

libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
622
	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
623

624 625
%_probes.stp: %_probes.d $(srcdir)/dtrace2systemtap.pl \
		$(top_builddir)/config.status
626
	$(AM_V_GEN)$(PERL) -w $(srcdir)/dtrace2systemtap.pl \
627
	  $(DTRACE2SYSTEMTAP_FLAGS) $(bindir) $(sbindir) $(libdir) $< > $@
628

629
CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
630
              libvirt_functions.stp libvirt_probes.stp
631
endif WITH_DTRACE_PROBES
632

633
EXTRA_DIST += libvirt_probes.d
634

C
Chris Lalancette 已提交
635
libvirt_qemu_la_SOURCES = libvirt-qemu.c
D
Daniel P. Berrange 已提交
636 637 638
libvirt_qemu_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
639
		$(LIBVIRT_NODELETE) \
D
Daniel P. Berrange 已提交
640 641
		$(AM_LDFLAGS) \
		$(NULL)
642
libvirt_qemu_la_CFLAGS = $(AM_CFLAGS)
C
Chris Lalancette 已提交
643
libvirt_qemu_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
644

645
libvirt_lxc_la_SOURCES = libvirt-lxc.c
D
Daniel P. Berrange 已提交
646 647 648
libvirt_lxc_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_LXC_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
649
		$(LIBVIRT_NODELETE) \
D
Daniel P. Berrange 已提交
650 651
		$(AM_LDFLAGS) \
		$(NULL)
652 653 654
libvirt_lxc_la_CFLAGS = $(AM_CFLAGS)
libvirt_lxc_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)

655
EXTRA_DIST += $(SYSCONF_FILES)
656 657

install-sysconfig:
E
Eric Blake 已提交
658
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
659 660 661
	for f in $(SYSCONF_FILES:%.sysconf=%) ; \
	do \
	  tgt=`basename $$f`; \
662
	  $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
663
	      $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
664
	done
665 666

uninstall-sysconfig:
667 668 669 670 671
	for f in $(SYSCONF_FILES:%.sysconf=%) ; \
	do \
	  tgt=`basename $$f`; \
	  rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
	done
E
Eric Blake 已提交
672
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
673

674
LOGROTATE_FILES := $(LOGROTATE_FILES_IN:remote/%.in=%)
675 676 677 678

EXTRA_DIST += $(LOGROTATE_FILES_IN)

BUILT_SOURCES += $(LOGROTATE_FILES)
679
CLEANFILES += $(LOGROTATE_FILES)
680 681 682 683 684 685 686

%.logrotate: remote/%.logrotate.in
	$(AM_V_GEN)sed \
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
	    < $< > $@-t && \
	mv $@-t $@

687
if WITH_LIBVIRTD
688 689 690 691 692 693 694 695 696 697 698 699
install-logrotate: $(LOGROTATE_FILES)
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/logrotate.d/
	for f in $(LOGROTATE_FILES) ; \
	do \
	  tgt=`echo $$f | sed -e 's/.logrotate//'`; \
	  $(INSTALL_DATA) $$f \
		$(DESTDIR)$(sysconfdir)/logrotate.d/$$tgt; \
	done

uninstall-logrotate:
	rm -f $(LOGROTATE_FILES:%.logrotate=$(DESTDIR)$(sysconfdir)/logrotate.d/%)
	rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
700 701 702 703

INSTALL_DATA_LOCAL += install-logrotate
UNINSTALL_LOCAL += uninstall-logrotate
endif WITH_LIBVIRTD
704

705

706
%.8: %.8.in $(top_srcdir)/configure.ac
707
	$(AM_V_GEN)sed \
708 709 710
		-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
		-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
		< $< > $@-t && \
711 712
	mv $@-t $@

713
CLEANFILES += $(man8_MANS)
A
Andrea Bolognani 已提交
714
MAINTAINERCLEANFILES += $(MANINFILES)
715 716

EXTRA_DIST += \
717
        $(SYSTEMD_UNIT_FILES_IN) \
A
Andrea Bolognani 已提交
718 719
        $(PODFILES) \
        $(MANINFILES) \
720
        $(NULL)
721

722 723 724 725

if WITH_LIBVIRTD
if LIBVIRT_INIT_SCRIPT_SYSTEMD

726
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
727
SYSTEMD_UNIT_FILES = $(notdir $(SYSTEMD_UNIT_FILES_IN:%.in=%))
728

729 730
BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
731

732
install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
E
Eric Blake 已提交
733
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
734 735 736 737
	for f in $(SYSTEMD_UNIT_FILES); \
	do \
	  $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
	done
738 739

uninstall-systemd: uninstall-sysconfig
740
	rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
E
Eric Blake 已提交
741
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
742 743 744 745 746

INSTALL_DATA_LOCAL += install-systemd
UNINSTALL_LOCAL += uninstall-systemd
endif LIBVIRT_INIT_SCRIPT_SYSTEMD
endif WITH_LIBVIRTD
747 748


749
EXTRA_DIST += dtrace2systemtap.pl
750

751

752
if WITH_LIBVIRTD
753 754
libexec_PROGRAMS += libvirt_iohelper
libvirt_iohelper_SOURCES = $(UTIL_IO_HELPER_SOURCES)
D
Daniel P. Berrange 已提交
755 756 757 758
libvirt_iohelper_LDFLAGS = \
		$(AM_LDFLAGS) \
		$(PIE_LDFLAGS) \
		$(NULL)
759
libvirt_iohelper_LDADD = \
760
		libvirt.la \
761
		../gnulib/lib/libgnu.la
762 763
if WITH_DTRACE_PROBES
libvirt_iohelper_LDADD += libvirt_probes.lo
764
endif WITH_DTRACE_PROBES
765

D
Daniel P. Berrange 已提交
766 767 768 769
libvirt_iohelper_CFLAGS = \
		$(AM_CFLAGS) \
		$(PIE_CFLAGS) \
		$(NULL)
770 771


772
endif WITH_LIBVIRTD
773

774

775 776
install-data-local: $(INSTALL_DATA_LOCAL) \
		$(INSTALL_DATA_DIRS:%=install-data-%)
777 778
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images"
779
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems"
780
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot"
781

782
uninstall-local: $(UNINSTALL_LOCAL) \
783
		$(INSTALL_DATA_DIRS:%=uninstall-data-%)
784 785
	rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||:
786
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||:
787 788
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt" ||:
R
Richard W.M. Jones 已提交
789

790 791
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
DISTCLEANFILES += $(GENERATED_SYM_FILES)