Makefile.am 13.3 KB
Newer Older
1 2
## Copyright (C) 2005-2016 Red Hat, Inc.
## Copyright (C) 2013 Yuto KAWAMURA(kawamuray) <kawamuray.dadada@gmail.com>
E
Eric Blake 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16
##
## 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/>.
17

18
INCLUDES = \
19 20 21 22 23
	-I$(top_builddir)/include -I$(top_srcdir)/include	\
	-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib	\
	-I$(top_builddir)/src -I$(top_srcdir)/src		\
	-I$(top_srcdir)/src/util				\
	-I$(top_srcdir)						\
24 25
	$(GETTEXT_CPPFLAGS)

G
Guido Günther 已提交
26 27
AM_LDFLAGS = \
	$(RELRO_LDFLAGS)					\
28
	$(NO_INDIRECT_LDFLAGS)					\
G
Guido Günther 已提交
29 30
	$(NULL)

31 32 33 34 35 36 37 38 39
POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"

ICON_FILES = \
	libvirt_win_icon_16x16.ico \
	libvirt_win_icon_32x32.ico \
	libvirt_win_icon_48x48.ico \
	libvirt_win_icon_64x64.ico \
	virsh_win_icon.rc

40
EXTRA_DIST = \
E
Eric Blake 已提交
41
	$(ICON_FILES)					\
42
	$(conf_DATA)					\
E
Eric Blake 已提交
43 44
	virt-xml-validate.in				\
	virt-pki-validate.in				\
45
	virt-sanlock-cleanup.in				\
E
Eric Blake 已提交
46
	virt-sanlock-cleanup.8				\
D
Dan Walsh 已提交
47
	virt-login-shell.pod				\
48
	virsh.pod					\
49 50 51 52 53 54 55 56 57 58 59
	libvirt-guests.sysconf				\
	virsh-edit.c					\
	virsh-domain.c					\
	virsh-domain-monitor.c				\
	virsh-host.c virsh-interface.c			\
	virsh-network.c virsh-nodedev.c			\
	virsh-nwfilter.c virsh-pool.c			\
	virsh-secret.c virsh-snapshot.c			\
	virsh-volume.c


60
CLEANFILES =
E
Eric Blake 已提交
61 62
DISTCLEANFILES =

D
Dan Walsh 已提交
63
confdir = $(sysconfdir)/libvirt
64
conf_DATA =
D
Dan Walsh 已提交
65

66
bin_SCRIPTS = virt-xml-validate virt-pki-validate
67
bin_PROGRAMS = virsh virt-host-validate virt-admin
68
libexec_SCRIPTS = libvirt-guests.sh
69

70
if WITH_SANLOCK
71
sbin_SCRIPTS = virt-sanlock-cleanup
E
Eric Blake 已提交
72
DISTCLEANFILES += virt-sanlock-cleanup
73
endif WITH_SANLOCK
74

75
if WITH_LOGIN_SHELL
76 77
conf_DATA += virt-login-shell.conf
bin_PROGRAMS += virt-login-shell
78
else ! WITH_LOGIN_SHELL
E
Eric Blake 已提交
79
EXTRA_DIST += virt-login-shell.conf
80
endif ! WITH_LOGIN_SHELL
81 82


83 84 85 86
dist_man1_MANS = \
		virt-host-validate.1 \
		virt-pki-validate.1 \
		virt-xml-validate.1 \
87 88
		virsh.1 \
		virt-admin.1
89
if WITH_LOGIN_SHELL
90
dist_man1_MANS += virt-login-shell.1
91
else ! WITH_LOGIN_SHELL
E
Eric Blake 已提交
92
EXTRA_DIST += virt-login-shell.1
93
endif ! WITH_LOGIN_SHELL
94
if WITH_SANLOCK
95
dist_man8_MANS = virt-sanlock-cleanup.8
96
endif WITH_SANLOCK
97 98

virt-xml-validate: virt-xml-validate.in Makefile
99 100 101
	$(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \
		       -e 's|[@]VERSION@|$(VERSION)|g' \
	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
102

103
virt-xml-validate.1: virt-xml-validate.in $(top_srcdir)/configure.ac
E
Eric Blake 已提交
104 105
	$(AM_V_GEN)$(POD2MAN) --name VIRT-XML-VALIDATE $< $(srcdir)/$@ \
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
106
		rm $(srcdir)/$@; exit 1; fi
107

108
virt-pki-validate: virt-pki-validate.in Makefile
109 110 111
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
		       -e 's|[@]VERSION@|$(VERSION)|g' \
	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
112

113
virt-pki-validate.1: virt-pki-validate.in $(top_srcdir)/configure.ac
E
Eric Blake 已提交
114 115
	$(AM_V_GEN)$(POD2MAN) --name VIRT-PKI-VALIDATE $< $(srcdir)/$@ \
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
116
		rm $(srcdir)/$@; exit 1; fi
117

118
virt-host-validate.1: virt-host-validate.c $(top_srcdir)/configure.ac
E
Eric Blake 已提交
119 120
	$(AM_V_GEN)$(POD2MAN) --name VIRT-HOST-VALIDATE $< $(srcdir)/$@ \
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
121
		rm $(srcdir)/$@; exit 1; fi
122

123
virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
124 125
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \
	    -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \
126 127
	    || (rm $@ && exit 1) && chmod +x $@

128
virt-sanlock-cleanup.8: virt-sanlock-cleanup.in $(top_srcdir)/configure.ac
129 130
	$(AM_V_GEN)$(POD2MAN) --name VIRT-SANLOCK-CLEANUP --section=8 \
	    $< $(srcdir)/$@ \
E
Eric Blake 已提交
131
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
132
		rm $(srcdir)/$@; exit 1; fi
133

134 135 136 137 138 139 140 141 142 143 144 145 146 147
noinst_LTLIBRARIES = libvirt_shell.la
libvirt_shell_la_CFLAGS = \
		$(AM_CFLAGS)						\
		$(PIE_CFLAGS)						\
		$(READLINE_CFLAGS)					\
		$(LIBXML_CFLAGS)					\
		$(NULL)
libvirt_shell_la_LDFLAGS = \
		$(AM_LDFLAGS)						\
		$(PIE_LDFLAGS)						\
		$(COVERAGE_LDFLAGS)					\
		$(NULL)
libvirt_shell_la_LIBADD = \
		$(LIBXML_LIBS)						\
148 149
		$(READLINE_LIBS)					\
		../src/libvirt.la					\
150 151 152 153
		../gnulib/lib/libgnu.la				\
		$(NULL)
libvirt_shell_la_SOURCES = vsh.c vsh.h

154 155 156 157 158 159 160 161
virt_host_validate_SOURCES = \
		virt-host-validate.c \
		virt-host-validate-common.c virt-host-validate-common.h \
		virt-host-validate-qemu.c virt-host-validate-qemu.h \
		virt-host-validate-lxc.c virt-host-validate-lxc.h \
		$(NULL)

virt_host_validate_LDFLAGS = \
G
Guido Günther 已提交
162
		$(AM_LDFLAGS) \
D
Daniel P. Berrange 已提交
163
		$(PIE_LDFLAGS) \
164 165 166 167 168 169 170 171 172
		$(COVERAGE_LDFLAGS) \
		$(NULL)

virt_host_validate_LDADD = \
		../src/libvirt.la				\
		../gnulib/lib/libgnu.la				\
		$(NULL)

virt_host_validate_CFLAGS = \
173
		$(LIBXML_CFLAGS)				\
174
		$(WARN_CFLAGS)					\
D
Daniel P. Berrange 已提交
175
		$(PIE_CFLAGS)					\
176 177 178
		$(COVERAGE_CFLAGS)				\
		$(NULL)

179 180 181 182 183
# Since virt-login-shell will be setuid, we must do everything
# we can to avoid linking to other libraries. Many of them do
# unsafe things in functions marked __atttribute__((constructor)).
# This we statically link to a library containing only the minimal
# libvirt client code, not libvirt.so itself.
D
Dan Walsh 已提交
184 185 186
virt_login_shell_SOURCES =					\
		virt-login-shell.c

G
Guido Günther 已提交
187 188
virt_login_shell_LDFLAGS = \
		$(AM_LDFLAGS) 					\
189
		$(PIE_LDFLAGS)					\
G
Guido Günther 已提交
190 191
		$(COVERAGE_LDFLAGS)				\
		$(NULL)
D
Dan Walsh 已提交
192 193
virt_login_shell_LDADD =					\
		$(STATIC_BINARIES)				\
194
		../src/libvirt-setuid-rpc-client.la		\
D
Dan Walsh 已提交
195 196 197
		../gnulib/lib/libgnu.la

virt_login_shell_CFLAGS =					\
198
		-DLIBVIRT_SETUID_RPC_CLIENT			\
199
		$(LIBXML_CFLAGS)				\
D
Dan Walsh 已提交
200 201 202 203
		$(WARN_CFLAGS)					\
		$(PIE_CFLAGS)					\
		$(COVERAGE_CFLAGS)

204
virsh_SOURCES =							\
E
Eric Blake 已提交
205
		virsh.c virsh.h					\
206
		virsh-console.c virsh-console.h			\
E
Eric Blake 已提交
207
		virsh-domain.c virsh-domain.h			\
208
		virsh-domain-monitor.c virsh-domain-monitor.h	\
E
Eric Blake 已提交
209
		virsh-host.c virsh-host.h			\
E
Eric Blake 已提交
210
		virsh-interface.c virsh-interface.h		\
E
Eric Blake 已提交
211
		virsh-network.c virsh-network.h			\
E
Eric Blake 已提交
212
		virsh-nodedev.c virsh-nodedev.h			\
E
Eric Blake 已提交
213
		virsh-nwfilter.c virsh-nwfilter.h		\
E
Eric Blake 已提交
214
		virsh-pool.c virsh-pool.h			\
E
Eric Blake 已提交
215
		virsh-secret.c virsh-secret.h			\
E
Eric Blake 已提交
216
		virsh-snapshot.c virsh-snapshot.h		\
E
Eric Blake 已提交
217
		virsh-volume.c virsh-volume.h			\
E
Eric Blake 已提交
218
		$(NULL)
219

G
Guido Günther 已提交
220 221
virsh_LDFLAGS = \
		$(AM_LDFLAGS) 					\
222
		$(PIE_LDFLAGS)					\
G
Guido Günther 已提交
223 224
		$(COVERAGE_LDFLAGS)				\
		$(NULL)
225 226
virsh_LDADD =							\
		$(STATIC_BINARIES)				\
227
		../src/libvirt-lxc.la				\
228
		../src/libvirt-qemu.la				\
229
		libvirt_shell.la
E
Eric Blake 已提交
230
virsh_CFLAGS =							\
231
		$(WARN_CFLAGS)					\
D
Daniel P. Berrange 已提交
232
		$(PIE_CFLAGS)					\
233
		$(COVERAGE_CFLAGS)				\
234
		$(LIBXML_CFLAGS)
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256

virt_admin_SOURCES =						\
		virt-admin.c virt-admin.h			\
		$(NULL)

virt_admin_LDFLAGS =						\
		$(AM_LDFLAGS)					\
		$(COVERAGE_LDFLAGS)				\
		$(STATIC_BINARIES)				\
		$(PIE_LDFLAGS)					\
		$(NULL)
virt_admin_LDADD =						\
		../src/libvirt-admin.la				\
		libvirt_shell.la				\
		$(LIBXML_LIBS)					\
		$(NULL)
virt_admin_CFLAGS =						\
		$(WARN_CFLAGS)					\
		$(PIE_CFLAGS)					\
		$(COVERAGE_CFLAGS)				\
		$(LIBXML_CFLAGS)				\
		$(READLINE_CFLAGS)
257
BUILT_SOURCES =
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279

if WITH_WIN_ICON
virsh_LDADD += virsh_win_icon.$(OBJEXT)

# Before you edit virsh_win_icon.rc, please note the following
# limitations of the resource file format:
#
# (1) '..' is not permitted in the icon filename field.
# (2) '-' is not permitted in the icon filename field.
# (3) Comments are not permitted in the file.
#
# Windows appears to choose the first <= 32x32 icon it finds
# in the resource file.  Therefore you should list the available
# icons from largest to smallest, and make sure that the 32x32
# icon is the most legible.
#
# Windows .ICO is a special MS-only format.  GIMP and other
# tools can write it.  However there are several variations,
# and Windows seems to do its own colour quantization.  More
# information is needed in this area.

virsh_win_icon.$(OBJEXT): virsh_win_icon.rc
280
	$(AM_V_GEN)$(WINDRES) \
281 282
	  --input-format rc --input $< \
	  --output-format coff --output $@
283
endif WITH_WIN_ICON
284

285
%.1: %.pod $(top_srcdir)/configure.ac
D
Dan Walsh 已提交
286
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ \
287
		&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
288
		rm $(srcdir)/$@; exit 1; fi
289

290
install-data-local: install-init install-systemd
291

292
uninstall-local: uninstall-init uninstall-systemd
293

294
install-sysconfig:
295
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
296 297 298 299 300
	$(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests

uninstall-sysconfig:
	rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
301
	rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
302

303
EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
304

305
install-initscript: libvirt-guests.init
306
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
307 308 309
	$(INSTALL_SCRIPT) libvirt-guests.init \
	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests

310
uninstall-initscript:
311
	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
312
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d ||:
313

314 315 316 317 318

if LIBVIRT_INIT_SCRIPT_RED_HAT
BUILT_SOURCES += libvirt-guests.init
install-init: install-sysconfig install-initscript
uninstall-init: uninstall-sysconfig uninstall-initscript
319
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
320 321
install-init:
uninstall-init:
322
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
323

324
libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
325 326 327 328 329 330 331 332 333
	$(AM_V_GEN)sed						\
	    -e 's|[@]PACKAGE[@]|$(PACKAGE)|g'			\
	    -e 's|[@]bindir[@]|$(bindir)|g'			\
	    -e 's|[@]localedir[@]|$(localedir)|g'		\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    < $< > $@-t &&					\
	    chmod a+x $@-t &&					\
334
	    mv $@-t $@
335
BUILT_SOURCES += libvirt-guests.sh
336

337 338
libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
	$(AM_V_GEN)sed \
339
		-e 's|[@]libexecdir[@]|$(libexecdir)|g' \
340 341 342
	< $< > $@-t && \
	chmod a+x $@-t && \
	mv $@-t $@
343 344 345


EXTRA_DIST += libvirt-guests.service.in
346
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
347

348
if LIBVIRT_INIT_SCRIPT_SYSTEMD
349
install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
350
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
351
	$(INSTALL_DATA) libvirt-guests.service \
352
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
353

354
uninstall-systemd: uninstall-sysconfig
355
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
356
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
357 358 359

BUILT_SOURCES += libvirt-guests.service

360
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
361 362
install-systemd:
uninstall-systemd:
363
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
364 365

libvirt-guests.service: libvirt-guests.service.in $(top_builddir)/config.status
366 367 368 369 370 371 372 373 374
	$(AM_V_GEN)sed						\
	    -e 's|[@]PACKAGE[@]|$(PACKAGE)|g'			\
	    -e 's|[@]bindir[@]|$(bindir)|g'			\
	    -e 's|[@]localedir[@]|$(localedir)|g'		\
	    -e 's|[@]localstatedir[@]|$(localstatedir)|g'	\
	    -e 's|[@]sbindir[@]|$(sbindir)|g'			\
	    -e 's|[@]sysconfdir[@]|$(sysconfdir)|g'		\
	    -e 's|[@]libexecdir[@]|$(libexecdir)|g'		\
	    < $< > $@-t &&					\
375
	    mv $@-t $@
376

377

378 379 380 381 382 383
EXTRA_DIST += \
	wireshark/util/genxdrstub.pl \
	wireshark/util/make-dissector-reg

if WITH_WIRESHARK_DISSECTOR

384
ws_plugindir = $(plugindir)
385 386 387 388
ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la
wireshark_src_libvirt_la_CPPFLAGS = \
	-I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS)
wireshark_src_libvirt_la_LDFLAGS = -avoid-version -module
389
nodist_wireshark_src_libvirt_la_SOURCES = wireshark/src/plugin.c
390 391
wireshark_src_libvirt_la_SOURCES = \
	wireshark/src/packet-libvirt.h \
392
	wireshark/src/packet-libvirt.c
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419

wireshark/src/packet-libvirt.c: wireshark/src/packet-libvirt.h \
		wireshark/src/libvirt/protocol.h

wireshark/src/plugin.c: wireshark/src/packet-libvirt.c
	cd wireshark/src && \
		$(abs_top_srcdir)/tools/wireshark/util/make-dissector-reg \
		. plugin packet-libvirt.c

WS_DISSECTOR_PROTO_FILES  = \
  $(abs_top_srcdir)/src/remote/remote_protocol.x \
  $(abs_top_srcdir)/src/remote/qemu_protocol.x \
  $(abs_top_srcdir)/src/remote/lxc_protocol.x \
  $(abs_top_srcdir)/src/rpc/virkeepaliveprotocol.x

wireshark/src/libvirt/protocol.h: wireshark/util/genxdrstub.pl \
		$(WS_DISSECTOR_PROTO_FILES)
	$(MKDIR_P) wireshark/src/libvirt
	cd wireshark/src && \
	LIBVIRT_VERSION=$(LIBVIRT_VERSION) \
		  $(PERL) $(abs_top_srcdir)/tools/wireshark/util/genxdrstub.pl \
		  $(WS_DISSECTOR_PROTO_FILES)

CLEANFILES += wireshark/src/plugin.c

endif WITH_WIRESHARK_DISSECTOR

420 421 422 423 424 425 426
LIBVIRT_NSS_SYMBOL_FILE = \
	$(srcdir)/nss/libvirt_nss.syms

LIBVIRT_NSS_SOURCES = \
	nss/libvirt_nss.c	\
	nss/libvirt_nss.h

427
if WITH_NSS
428 429 430 431 432
noinst_LTLIBRARIES += nss/libnss_libvirt_impl.la
nss_libnss_libvirt_impl_la_SOURCES = \
	$(LIBVIRT_NSS_SOURCES)

nss_libnss_libvirt_impl_la_CFLAGS = \
433
	-DLIBVIRT_NSS		\
434 435 436
	$(AM_CFLAGS)		\
	$(WARN_CFLAGS)		\
	$(PIE_CFLAGS)		\
437 438 439 440 441 442
	$(COVERAGE_CFLAGS)	\
	$(LIBXML_CFLAGS)

nss_libnss_libvirt_impl_la_LIBADD = \
	../gnulib/lib/libgnu.la		\
	../src/libvirt-nss.la
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463

nss_libnss_libvirt_la_SOURCES =
nss_libnss_libvirt_la_LDFLAGS = \
	$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_NSS_SYMBOL_FILE)	\
	$(AM_LDFLAGS) \
	-module \
	-export-dynamic \
	-avoid-version \
	-shared \
	-shrext .so.2

nss_libnss_libvirt_la_LIBADD =  \
	nss/libnss_libvirt_impl.la

lib_LTLIBRARIES = \
	nss/libnss_libvirt.la

endif WITH_NSS

EXTRA_DIST += $(LIBVIRT_NSS_SYMBOL_FILE) \
	$(LIBVIRT_NSS_SOURCES)
464 465 466 467 468

clean-local:
	-rm -rf wireshark/src/libvirt

CLEANFILES += $(bin_SCRIPTS)
469
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
470
MAINTAINERCLEANFILES = $(dist_man1_MANS)
471

E
Eric Blake 已提交
472
DISTCLEANFILES += $(BUILT_SOURCES)