Makefile.am 20.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
AM_CFLAGS =	$(LIBXML_CFLAGS) \
D
Daniel P. Berrangé 已提交
35
		$(GLIB_CFLAGS) \
36 37 38
		$(WARN_CFLAGS) \
		$(LOCK_CHECKING_CFLAGS) \
		$(WIN32_EXTRA_CFLAGS) \
39
		$(COVERAGE_CFLAGS) \
40
		$(NULL)
41
AM_LDFLAGS =	$(DRIVER_MODULES_LDFLAGS) \
42
		$(COVERAGE_LDFLAGS) \
43 44 45
		$(RELRO_LDFLAGS) \
		$(NO_INDIRECT_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
EXTRA_DIST = $(conf_DATA)
55

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

92
COMMON_UNIT_VARS = \
93
	-e 's|[@]runstatedir[@]|$(runstatedir)|g' \
94 95 96 97
	-e 's|[@]sbindir[@]|$(sbindir)|g' \
	-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
	$(NULL)

98 99 100 101
# Set these variables before we include any of the subdirs as libvirt-admin.la
# has to be installed after libvirt.la.
lib_LTLIBRARIES += libvirt.la libvirt-qemu.la libvirt-lxc.la

102
include util/Makefile.inc.am
103
include conf/Makefile.inc.am
104
include cpu/Makefile.inc.am
105
include cpu_map/Makefile.inc.am
106
include security/Makefile.inc.am
107
include access/Makefile.inc.am
108
include logging/Makefile.inc.am
109
include locking/Makefile.inc.am
110
include admin/Makefile.inc.am
111
include rpc/Makefile.inc.am
112
include test/Makefile.inc.am
113
include esx/Makefile.inc.am
114
include hyperv/Makefile.inc.am
115
include vmx/Makefile.inc.am
116
include vmware/Makefile.inc.am
117
include vbox/Makefile.inc.am
118
include openvz/Makefile.inc.am
119
include qemu/Makefile.inc.am
120
include bhyve/Makefile.inc.am
121
include libxl/Makefile.inc.am
122
include vz/Makefile.inc.am
123
include lxc/Makefile.inc.am
124
include interface/Makefile.inc.am
125
include network/Makefile.inc.am
126
include nwfilter/Makefile.inc.am
127
include node_device/Makefile.inc.am
128
include secret/Makefile.inc.am
129
include storage/Makefile.inc.am
130
include remote/Makefile.inc.am
131

132

E
Eric Blake 已提交
133 134
THREAD_LIBS = $(LIB_PTHREAD) $(LTLIBMULTITHREAD)

J
Jim Fehlig 已提交
135
SECDRIVER_CFLAGS =
136 137
SECDRIVER_LIBS =
if WITH_SECDRIVER_SELINUX
J
Jim Fehlig 已提交
138
SECDRIVER_CFLAGS += $(SELINUX_CFLAGS)
139
SECDRIVER_LIBS += $(SELINUX_LIBS)
140
endif WITH_SECDRIVER_SELINUX
141
if WITH_SECDRIVER_APPARMOR
J
Jim Fehlig 已提交
142
SECDRIVER_CFLAGS += $(APPARMOR_CFLAGS)
143
SECDRIVER_LIBS += $(APPARMOR_LIBS)
144
endif WITH_SECDRIVER_APPARMOR
145

146

147
moddir = $(libdir)/libvirt/connection-driver
148

A
Amy Griffis 已提交
149
confdir = $(sysconfdir)/libvirt
150
conf_DATA += libvirt.conf
151

152 153 154
CLEANFILES += $(nodist_conf_DATA)
BUILT_SOURCES += $(nodist_conf_DATA)

155 156 157 158
augeasdir = $(datadir)/augeas/lenses

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

159
CLEANFILES += $(augeastest_DATA)
L
Lai Jiangshan 已提交
160

161
# Internal generic driver infrastructure
O
Osier Yang 已提交
162
DATATYPES_SOURCES = datatypes.h datatypes.c
163
DRIVER_SOURCES += \
164 165 166 167 168 169 170 171 172 173 174 175 176 177
		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 \
178
		libvirt-domain-checkpoint.c \
179 180 181 182 183 184 185 186 187
		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 \
188
		$(NULL)
189

190

191

M
Martin Kletzander 已提交
192

193
# .libs/libvirt.so is built by libtool as a side-effect of the Makefile
194 195
# rule for libvirt.la.  However, checking symbols relies on Linux ELF layout
if WITH_LINUX
196
check-symfile: libvirt.syms libvirt.la
197 198
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-symfile.py \
		libvirt.syms .libs/libvirt.so
199
else ! WITH_LINUX
200
check-symfile:
201
endif ! WITH_LINUX
202
check-symsorting:
203
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-symsorting.py \
204
		$(srcdir) $(SYM_FILES)
205

E
Eric Blake 已提交
206
# Keep this list synced with RPC_PROBE_FILES
207 208
PROTOCOL_STRUCTS = \
	$(srcdir)/remote_protocol-structs \
209
	$(srcdir)/lxc_protocol-structs \
210
	$(srcdir)/qemu_protocol-structs \
J
Jiri Denemark 已提交
211
	$(srcdir)/virnetprotocol-structs \
E
Eric Blake 已提交
212 213 214
	$(srcdir)/virkeepaliveprotocol-structs \
	$(srcdir)/lxc_monitor_protocol-structs \
	$(srcdir)/lock_protocol-structs \
M
Martin Kletzander 已提交
215
	$(srcdir)/admin_protocol-structs \
E
Eric Blake 已提交
216 217
	$(NULL)

218
if WITH_REMOTE
219 220
check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct)

221 222 223 224 225 226
# Ensure that we don't change the struct or member names or member ordering
# in remote_protocol.x  The check-remote-protocol.py script post-processes
# output to extract the bits we want.

CHECK_REMOTE_PROTOCOL = $(top_srcdir)/scripts/check-remote-protocol.py

227 228
# 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.
229 230 231
$(srcdir)/remote_protocol-struct \
	$(srcdir)/qemu_protocol-struct \
	$(srcdir)/lxc_protocol-struct: \
E
Eric Blake 已提交
232
		$(srcdir)/%-struct: remote/libvirt_driver_remote_la-%.lo
233 234
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(CHECK_REMOTE_PROTOCOL) \
		"$(CC)" "$(OBJEXT)" $< $(@)s
235
$(srcdir)/virnetprotocol-struct $(srcdir)/virkeepaliveprotocol-struct: \
E
Eric Blake 已提交
236
		$(srcdir)/%-struct: rpc/libvirt_net_rpc_la-%.lo
237 238
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(CHECK_REMOTE_PROTOCOL) \
		"$(CC)" "$(OBJEXT)" $< $(@)s
239
if WITH_LXC
E
Eric Blake 已提交
240
$(srcdir)/lxc_monitor_protocol-struct: \
E
Eric Blake 已提交
241
		$(srcdir)/%-struct: lxc/libvirt_driver_lxc_impl_la-%.lo
242 243
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(CHECK_REMOTE_PROTOCOL) \
		"$(CC)" "$(OBJEXT)" $< $(@)s
244
endif WITH_LXC
E
Eric Blake 已提交
245
$(srcdir)/lock_protocol-struct: \
E
Eric Blake 已提交
246
		$(srcdir)/%-struct: locking/lockd_la-%.lo
247 248
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(CHECK_REMOTE_PROTOCOL) \
		"$(CC)" "$(OBJEXT)" $< $(@)s
M
Martin Kletzander 已提交
249 250
$(srcdir)/admin_protocol-struct: \
		$(srcdir)/%-struct: admin/libvirt_admin_la-%.lo
251 252
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(CHECK_REMOTE_PROTOCOL) \
		"$(CC)" "$(OBJEXT)" $< $(@)s
E
Eric Blake 已提交
253

254
else !WITH_REMOTE
255 256 257
# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
# re-generated when configured --without-remote.
check-protocol:
258
endif !WITH_REMOTE
J
Jiri Denemark 已提交
259
EXTRA_DIST += $(PROTOCOL_STRUCTS)
260

261 262 263 264 265 266 267 268 269 270 271 272
DRIVERS = \
	$(srcdir)/driver-hypervisor.h \
	$(srcdir)/driver-interface.h \
	$(srcdir)/driver-network.h \
	$(srcdir)/driver-nodedev.h \
	$(srcdir)/driver-nwfilter.h \
	$(srcdir)/driver-secret.h \
	$(srcdir)/driver-state.h \
	$(srcdir)/driver-storage.h \
	$(srcdir)/driver-stream.h \
	$(NULL)

273
check-drivername:
274 275
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-drivername.py \
		$(DRIVERS) \
276 277 278 279
		$(srcdir)/libvirt_public.syms \
		$(srcdir)/libvirt_qemu.syms \
		$(srcdir)/libvirt_lxc.syms

280
check-driverimpls:
281
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-driverimpls.py \
282
		$(DRIVER_SOURCE_FILES)
283

284
check-aclrules:
285
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-aclrules.py \
E
Eric Blake 已提交
286
		$(REMOTE_PROTOCOL) \
287
		$(STATEFUL_DRIVER_SOURCE_FILES)
288

289
check-aclperms:
290
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/check-aclperms.py \
291 292 293
		$(srcdir)/access/viraccessperm.h \
		$(srcdir)/access/viraccessperm.c

294
check-local: check-protocol check-symfile check-symsorting \
295
	check-drivername check-driverimpls check-aclrules \
296
	check-aclperms check-admin
297
.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
298

299 300 301 302 303 304 305

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

306

307
noinst_LTLIBRARIES += libvirt_driver.la
308
libvirt_la_BUILT_LIBADD += libvirt_driver.la
309
libvirt_driver_la_SOURCES = $(DRIVER_SOURCES)
310

311
libvirt_driver_la_CFLAGS = \
312
		$(GNUTLS_CFLAGS) $(CURL_CFLAGS) $(XDR_CFLAGS) \
313
		-I$(srcdir)/conf $(AM_CFLAGS)
314
libvirt_driver_la_LIBADD = \
315
		$(GNUTLS_LIBS) $(CURL_LIBS) $(DLOPEN_LIBS)
316

317 318
# 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.
319 320 321
SYM_FILES += $(USED_SYM_FILES)
USED_SYM_FILES += $(srcdir)/libvirt_private.syms
GENERATED_SYM_FILES += \
322 323
	libvirt.syms libvirt.def libvirt_qemu.def libvirt_lxc.def \
	$(NULL)
324

C
Chris Lalancette 已提交
325

326

327
%protocol.c: %protocol.x %protocol.h $(srcdir)/rpc/genprotocol.pl
328
	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -c \
329
	       $< $(subst $(srcdir)/,,$@)
330

331
%protocol.h: %protocol.x $(srcdir)/rpc/genprotocol.pl
332
	$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/genprotocol.pl $(RPCGEN) -h \
333
	       $< $(subst $(srcdir)/,,$@)
334

335 336
check-local: check-augeas

337 338 339 340 341 342 343 344
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" \
345
		    "$$DIR/$$FILE" || exit 1; \
346 347 348
	    done; \
	fi
.PHONY: check-augeas
349

350 351
AUG_GENTEST_SCRIPT = $(top_srcdir)/scripts/augeas-gentest.py
AUG_GENTEST = $(RUNUTF8) $(PYTHON) $(AUG_GENTEST_SCRIPT)
352

353

354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
#
# 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.
#

373
USED_SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
374

375
if WITH_LINUX
376
USED_SYM_FILES += $(srcdir)/libvirt_linux.syms
377
else ! WITH_LINUX
378
SYM_FILES += $(srcdir)/libvirt_linux.syms
379
endif ! WITH_LINUX
380

381
if WITH_SASL
382
USED_SYM_FILES += $(srcdir)/libvirt_sasl.syms
383
else ! WITH_SASL
384
SYM_FILES += $(srcdir)/libvirt_sasl.syms
385
endif ! WITH_SASL
E
Eric Blake 已提交
386

387
if WITH_SSH2
388
USED_SYM_FILES += $(srcdir)/libvirt_libssh2.syms
389
else ! WITH_SSH2
390
SYM_FILES += $(srcdir)/libvirt_libssh2.syms
391
endif ! WITH_SSH2
392

393
if WITH_ATOMIC_OPS_PTHREAD
394
USED_SYM_FILES += $(srcdir)/libvirt_atomic.syms
395
else ! WITH_ATOMIC_OPS_PTHREAD
396
SYM_FILES += $(srcdir)/libvirt_atomic.syms
397
endif ! WITH_ATOMIC_OPS_PTHREAD
398

399 400 401 402 403 404
if WITH_LIBSSH
USED_SYM_FILES += $(srcdir)/libvirt_libssh.syms
else ! WITH_LIBSSH
SYM_FILES += $(srcdir)/libvirt_libssh.syms
endif ! WITH_LIBSSH

405
EXTRA_DIST += \
406 407 408 409
	libvirt_public.syms \
	libvirt_lxc.syms \
	libvirt_qemu.syms \
	$(SYM_FILES) \
410
	$(NULL)
411

412
BUILT_SOURCES += $(GENERATED_SYM_FILES)
413

414 415
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \
		$(ACCESS_DRIVER_SYM_FILES) \
416
		$(top_builddir)/config.status
417 418 419 420 421 422
	$(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 && \
423
	cat $(USED_SYM_FILES) $(ACCESS_DRIVER_SYM_FILES) >>$@-tmp && \
424 425
	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
	chmod a-w $@-tmp && \
426
	mv $@-tmp libvirt.syms
427

428
%.def: %.syms
429 430
	$(AM_V_GEN)rm -f -- $@-tmp $@ ; \
	printf 'EXPORTS\n' > $@-tmp && \
431
	sed -e '/^$$/d; /#/d; /:/d; /}/d; /\*/d; /LIBVIRT_/d' \
432
	    -e 's/[	 ]*\(.*\)\;/    \1/g' $^ >> $@-tmp && \
433
	chmod a-w $@-tmp && \
434
	mv $@-tmp $@
435

436 437
# Empty source list - it merely links a bunch of convenience libs together
libvirt_la_SOURCES =
D
Daniel P. Berrange 已提交
438 439 440 441
libvirt_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
		$(LIBVIRT_NODELETE) \
442
		$(NO_UNDEFINED_LDFLAGS) \
443 444 445 446 447 448 449
		$(AM_LDFLAGS)
if WITH_MACOS
# macOS has two-level namespaces by default.
# Override it to allow symbol replacement with DYLD_INSERT_LIBRARIES
libvirt_la_LDFLAGS += -Wl,-flat_namespace
endif WITH_MACOS
libvirt_la_LDFLAGS += $(NULL)
450
libvirt_la_BUILT_LIBADD += ../gnulib/lib/libgnu.la
451
libvirt_la_LIBADD += \
452
		    $(DRIVER_MODULES_LIBS)
453
libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
454 455 456 457 458 459
# 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)
460

461
if WITH_DTRACE_PROBES
462
libvirt_la_BUILT_LIBADD += libvirt_probes.lo
463
libvirt_la_DEPENDENCIES += libvirt_probes.lo libvirt_probes.o
464
nodist_libvirt_la_SOURCES = libvirt_probes.h
465

466 467
BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp

468 469

tapsetdir = $(datadir)/systemtap/tapset
470
tapset_DATA += libvirt_probes.stp libvirt_functions.stp
471

472
%_probes.h: %_probes.d
473 474
	$(AM_V_GEN)$(DTRACE) -o $@ -h -s $<

E
Eric Blake 已提交
475
.PRECIOUS: %_probes.o
476
%_probes.o: %_probes.d
477 478
	$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<

479 480 481 482 483 484 485 486 487
%_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 已提交
488
# Keep this list synced with PROTOCOL_STRUCTS
489
RPC_PROBE_FILES += $(srcdir)/rpc/virnetprotocol.x \
J
Jiri Denemark 已提交
490 491
		  $(srcdir)/rpc/virkeepaliveprotocol.x \
		  $(srcdir)/remote/remote_protocol.x \
492
		  $(srcdir)/remote/lxc_protocol.x \
493
		  $(srcdir)/remote/qemu_protocol.x \
M
Martin Kletzander 已提交
494
		  $(srcdir)/admin/admin_protocol.x
495

496 497 498
libvirt_functions.stp: $(RPC_PROBE_FILES) $(top_srcdir)/scripts/gensystemtap.py
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/gensystemtap.py \
	  $(RPC_PROBE_FILES) > $@
499

500
%_probes.stp: %_probes.d $(top_srcdir)/scripts/dtrace2systemtap.py \
501
		$(top_builddir)/config.status
502 503
	$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/dtrace2systemtap.py \
	  $(bindir) $(sbindir) $(libdir) $< > $@
504

505
CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
506
              libvirt_functions.stp libvirt_probes.stp
507
endif WITH_DTRACE_PROBES
508

509
EXTRA_DIST += libvirt_probes.d
510

C
Chris Lalancette 已提交
511
libvirt_qemu_la_SOURCES = libvirt-qemu.c
D
Daniel P. Berrange 已提交
512 513 514
libvirt_qemu_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
515
		$(LIBVIRT_NODELETE) \
D
Daniel P. Berrange 已提交
516 517
		$(AM_LDFLAGS) \
		$(NULL)
518
libvirt_qemu_la_CFLAGS = $(AM_CFLAGS)
519
libvirt_qemu_la_LIBADD = libvirt.la
520

521
libvirt_lxc_la_SOURCES = libvirt-lxc.c
D
Daniel P. Berrange 已提交
522 523 524
libvirt_lxc_la_LDFLAGS = \
		$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_LXC_SYMBOL_FILE) \
		-version-info $(LIBVIRT_VERSION_INFO) \
525
		$(LIBVIRT_NODELETE) \
D
Daniel P. Berrange 已提交
526 527
		$(AM_LDFLAGS) \
		$(NULL)
528
libvirt_lxc_la_CFLAGS = $(AM_CFLAGS)
529
libvirt_lxc_la_LIBADD = libvirt.la
530

531 532 533
EXTRA_DIST += \
	$(SYSCONF_FILES) \
	$(OPENRC_CONF_FILES)
534 535

install-sysconfig:
E
Eric Blake 已提交
536
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
537 538 539
	for f in $(SYSCONF_FILES:%.sysconf=%) ; \
	do \
	  tgt=`basename $$f`; \
540
	  $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
541
	      $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
542
	done
543 544

uninstall-sysconfig:
545 546 547 548 549
	for f in $(SYSCONF_FILES:%.sysconf=%) ; \
	do \
	  tgt=`basename $$f`; \
	  rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
	done
E
Eric Blake 已提交
550
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
551

552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
OPENRC_CONF_DIR = $(sysconfdir)/conf.d

install-openrc-conf:
	$(MKDIR_P) $(DESTDIR)$(OPENRC_CONF_DIR)
	for f in $(OPENRC_CONF_FILES:%.confd=%) ; \
	do \
		tgt=`basename $$f`; \
		$(INSTALL_DATA) $(srcdir)/$$f.confd \
			$(DESTDIR)$(OPENRC_CONF_DIR)/$$tgt; \
	done

uninstall-openrc-conf:
	for f in $(OPENRC_CONF_FILES:%.confd=%) ; \
	do \
		tgt=`basename $$f`; \
		rm -f $(DESTDIR)$(OPENRC_CONF_DIR)/$$tgt; \
	done
	rmdir $(DESTDIR)$(OPENRC_CONF_DIR) || :

571
LOGROTATE_FILES := $(LOGROTATE_FILES_IN:remote/%.in=%)
572 573 574 575

EXTRA_DIST += $(LOGROTATE_FILES_IN)

BUILT_SOURCES += $(LOGROTATE_FILES)
576
CLEANFILES += $(LOGROTATE_FILES)
577 578 579 580 581 582 583

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

584
if WITH_LIBVIRTD
585 586 587 588 589 590 591 592 593 594 595 596
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 || :
597 598 599 600

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

602

603
EXTRA_DIST += \
604
        $(SYSTEMD_UNIT_FILES_IN) \
605
        $(OPENRC_INIT_FILES_IN) \
606
        $(NULL)
607

608 609 610 611

if WITH_LIBVIRTD
if LIBVIRT_INIT_SCRIPT_SYSTEMD

612
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
613

614 615
BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
616

617
install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
E
Eric Blake 已提交
618
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
619 620 621 622
	for f in $(SYSTEMD_UNIT_FILES); \
	do \
	  $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
	done
623 624

uninstall-systemd: uninstall-sysconfig
625
	rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
E
Eric Blake 已提交
626
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
627 628 629 630

INSTALL_DATA_LOCAL += install-systemd
UNINSTALL_LOCAL += uninstall-systemd
endif LIBVIRT_INIT_SCRIPT_SYSTEMD
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659

if LIBVIRT_INIT_SCRIPT_OPENRC

OPENRC_INIT_DIR = $(sysconfdir)/init.d

BUILT_SOURCES += $(OPENRC_INIT_FILES)
DISTCLEANFILES += $(OPENRC_INIT_FILES)

install-openrc: $(OPENRC_INIT_FILES) install-openrc-conf
	$(MKDIR_P) $(DESTDIR)$(OPENRC_INIT_DIR)
	for f in $(OPENRC_INIT_FILES:%.init=%) ; \
	do \
		tgt=`basename $$f`; \
		$(INSTALL_SCRIPT) $$f.init \
		$(DESTDIR)$(OPENRC_INIT_DIR)/$$tgt ; \
	done

uninstall-openrc: uninstall-openrc-conf
	for f in $(OPENRC_INIT_FILES:%.init=%) ; \
	do \
		tgt=`basename $$f`; \
		rm -f $(DESTDIR)$(OPENRC_INIT_DIR)/$$tgt ; \
	done
	rmdir $(DESTDIR)$(OPENRC_INIT_DIR) || :

INSTALL_DATA_LOCAL += install-openrc
UNINSTALL_LOCAL += uninstall-openrc
endif LIBVIRT_INIT_SCRIPT_OPENRC

660
endif WITH_LIBVIRTD
661 662


663
if WITH_LIBVIRTD
664 665
libexec_PROGRAMS += libvirt_iohelper
libvirt_iohelper_SOURCES = $(UTIL_IO_HELPER_SOURCES)
D
Daniel P. Berrange 已提交
666 667 668 669
libvirt_iohelper_LDFLAGS = \
		$(AM_LDFLAGS) \
		$(PIE_LDFLAGS) \
		$(NULL)
670
libvirt_iohelper_LDADD = \
671
		libvirt.la \
D
Daniel P. Berrangé 已提交
672
		$(GLIB_LIBS) \
673
		../gnulib/lib/libgnu.la
674 675
if WITH_DTRACE_PROBES
libvirt_iohelper_LDADD += libvirt_probes.lo
676
endif WITH_DTRACE_PROBES
677

D
Daniel P. Berrange 已提交
678 679 680 681
libvirt_iohelper_CFLAGS = \
		$(AM_CFLAGS) \
		$(PIE_CFLAGS) \
		$(NULL)
682 683


684
endif WITH_LIBVIRTD
685

686

687 688 689
generated-sources: $(BUILT_SOURCES)


690 691
install-data-local: $(INSTALL_DATA_LOCAL) \
		$(INSTALL_DATA_DIRS:%=install-data-%)
692 693
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt"
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images"
694
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems"
695
	$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot"
696

697
uninstall-local: $(UNINSTALL_LOCAL) \
698
		$(INSTALL_DATA_DIRS:%=uninstall-data-%)
699 700
	rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||:
701
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||:
702 703
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" ||:
	rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt" ||:
R
Richard W.M. Jones 已提交
704

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