You need to sign in or sign up before continuing.
Makefile.am 13.6 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 71 72 73 74
dist_man1_MANS = \
		virt-host-validate.1 \
		virt-pki-validate.1 \
		virt-xml-validate.1 \
		virsh.1 \
		virt-admin.1
75

76
if WITH_SANLOCK
77
sbin_SCRIPTS = virt-sanlock-cleanup
78
dist_man8_MANS = virt-sanlock-cleanup.8
E
Eric Blake 已提交
79
DISTCLEANFILES += virt-sanlock-cleanup
80
endif WITH_SANLOCK
81

82
if WITH_LOGIN_SHELL
83 84 85
conf_DATA += virt-login-shell.conf
bin_PROGRAMS += virt-login-shell
dist_man1_MANS += virt-login-shell.1
86
else ! WITH_LOGIN_SHELL
87 88 89
EXTRA_DIST += \
		virt-login-shell.conf \
		virt-login-shell.1
90
endif ! WITH_LOGIN_SHELL
91 92

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

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

102
virt-pki-validate: virt-pki-validate.in Makefile
103 104 105
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
		       -e 's|[@]VERSION@|$(VERSION)|g' \
	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
106

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

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

117
virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
118 119
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \
	    -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \
120 121
	    || (rm $@ && exit 1) && chmod +x $@

122
virt-sanlock-cleanup.8: virt-sanlock-cleanup.in $(top_srcdir)/configure.ac
123 124
	$(AM_V_GEN)$(POD2MAN) --name VIRT-SANLOCK-CLEANUP --section=8 \
	    $< $(srcdir)/$@ \
E
Eric Blake 已提交
125
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
126
		rm $(srcdir)/$@; exit 1; fi
127

128 129 130 131 132 133 134 135 136 137 138 139 140 141
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)						\
142 143
		$(READLINE_LIBS)					\
		../src/libvirt.la					\
144 145 146 147
		../gnulib/lib/libgnu.la				\
		$(NULL)
libvirt_shell_la_SOURCES = vsh.c vsh.h

148 149 150 151 152 153 154 155
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 已提交
156
		$(AM_LDFLAGS) \
D
Daniel P. Berrange 已提交
157
		$(PIE_LDFLAGS) \
158 159 160 161 162 163 164 165 166
		$(COVERAGE_LDFLAGS) \
		$(NULL)

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

virt_host_validate_CFLAGS = \
167
		$(LIBXML_CFLAGS)				\
168
		$(WARN_CFLAGS)					\
D
Daniel P. Berrange 已提交
169
		$(PIE_CFLAGS)					\
170 171 172
		$(COVERAGE_CFLAGS)				\
		$(NULL)

173 174 175 176 177
# 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 已提交
178 179 180
virt_login_shell_SOURCES =					\
		virt-login-shell.c

G
Guido Günther 已提交
181 182
virt_login_shell_LDFLAGS = \
		$(AM_LDFLAGS) 					\
183
		$(PIE_LDFLAGS)					\
G
Guido Günther 已提交
184 185
		$(COVERAGE_LDFLAGS)				\
		$(NULL)
D
Dan Walsh 已提交
186 187
virt_login_shell_LDADD =					\
		$(STATIC_BINARIES)				\
188
		../src/libvirt-setuid-rpc-client.la		\
D
Dan Walsh 已提交
189 190 191
		../gnulib/lib/libgnu.la

virt_login_shell_CFLAGS =					\
192
		-DLIBVIRT_SETUID_RPC_CLIENT			\
193
		$(LIBXML_CFLAGS)				\
D
Dan Walsh 已提交
194 195 196 197
		$(WARN_CFLAGS)					\
		$(PIE_CFLAGS)					\
		$(COVERAGE_CFLAGS)

198
virsh_SOURCES =							\
E
Eric Blake 已提交
199
		virsh.c virsh.h					\
200
		virsh-console.c virsh-console.h			\
E
Eric Blake 已提交
201
		virsh-domain.c virsh-domain.h			\
202
		virsh-domain-monitor.c virsh-domain-monitor.h	\
E
Eric Blake 已提交
203
		virsh-host.c virsh-host.h			\
E
Eric Blake 已提交
204
		virsh-interface.c virsh-interface.h		\
E
Eric Blake 已提交
205
		virsh-network.c virsh-network.h			\
E
Eric Blake 已提交
206
		virsh-nodedev.c virsh-nodedev.h			\
E
Eric Blake 已提交
207
		virsh-nwfilter.c virsh-nwfilter.h		\
E
Eric Blake 已提交
208
		virsh-pool.c virsh-pool.h			\
E
Eric Blake 已提交
209
		virsh-secret.c virsh-secret.h			\
E
Eric Blake 已提交
210
		virsh-snapshot.c virsh-snapshot.h		\
E
Eric Blake 已提交
211
		virsh-volume.c virsh-volume.h			\
E
Eric Blake 已提交
212
		$(NULL)
213

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

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)
251
BUILT_SOURCES =
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

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
274
	$(AM_V_GEN)$(WINDRES) \
275 276
	  --input-format rc --input $< \
	  --output-format coff --output $@
277
endif WITH_WIN_ICON
278

279
%.1: %.pod $(top_srcdir)/configure.ac
D
Dan Walsh 已提交
280
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ \
281
		&& if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
282
		rm $(srcdir)/$@; exit 1; fi
283

284
install-data-local: install-init install-systemd
285

286
uninstall-local: uninstall-init uninstall-systemd
287

288
install-sysconfig:
289
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
290 291 292 293 294
	$(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests

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

297
EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
298

299
install-initscript: libvirt-guests.init
300
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
301 302 303
	$(INSTALL_SCRIPT) libvirt-guests.init \
	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests

304
uninstall-initscript:
305
	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
306
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d ||:
307

308 309 310 311 312

if LIBVIRT_INIT_SCRIPT_RED_HAT
BUILT_SOURCES += libvirt-guests.init
install-init: install-sysconfig install-initscript
uninstall-init: uninstall-sysconfig uninstall-initscript
313
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
314 315
install-init:
uninstall-init:
316
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
317

318
libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
319 320 321 322 323 324 325 326 327
	$(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 &&					\
328
	    mv $@-t $@
329
BUILT_SOURCES += libvirt-guests.sh
330

331 332
libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
	$(AM_V_GEN)sed \
333
		-e 's|[@]libexecdir[@]|$(libexecdir)|g' \
334 335 336
	< $< > $@-t && \
	chmod a+x $@-t && \
	mv $@-t $@
337 338 339


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

342
if LIBVIRT_INIT_SCRIPT_SYSTEMD
343
install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
344
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
345
	$(INSTALL_DATA) libvirt-guests.service \
346
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
347

348
uninstall-systemd: uninstall-sysconfig
349
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
350
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
351 352 353

BUILT_SOURCES += libvirt-guests.service

354
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
355 356
install-systemd:
uninstall-systemd:
357
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
358 359

libvirt-guests.service: libvirt-guests.service.in $(top_builddir)/config.status
360 361 362 363 364 365 366 367 368
	$(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 &&					\
369
	    mv $@-t $@
370

371

372 373 374 375 376 377
EXTRA_DIST += \
	wireshark/util/genxdrstub.pl \
	wireshark/util/make-dissector-reg

if WITH_WIRESHARK_DISSECTOR

378
ws_plugindir = $(plugindir)
379 380 381 382
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
383
nodist_wireshark_src_libvirt_la_SOURCES = wireshark/src/plugin.c
384 385
wireshark_src_libvirt_la_SOURCES = \
	wireshark/src/packet-libvirt.h \
386
	wireshark/src/packet-libvirt.c
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413

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

R
Roman Bogorodskiy 已提交
414 415 416 417 418 419 420 421 422 423 424 425
if WITH_BSD_NSS
LIBVIRT_NSS_SYMBOL_FILE = \
	$(srcdir)/nss/libvirt_nss_bsd.syms
NSS_SO_VER = 1

install-exec-hook:
	cd $(DESTDIR)$(libdir) && \
	  $(LN_S) libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER)

uninstall-local:
	rm $(DESTDIR)$(libdir)/libnss_libvirt.so.$(NSS_SO_VER)
else ! WITH_BSD_NSS
426 427
LIBVIRT_NSS_SYMBOL_FILE = \
	$(srcdir)/nss/libvirt_nss.syms
R
Roman Bogorodskiy 已提交
428 429
NSS_SO_VER = 2
endif ! WITH_BSD_NSS
430 431 432 433 434

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

435
if WITH_NSS
436 437 438 439 440
noinst_LTLIBRARIES += nss/libnss_libvirt_impl.la
nss_libnss_libvirt_impl_la_SOURCES = \
	$(LIBVIRT_NSS_SOURCES)

nss_libnss_libvirt_impl_la_CFLAGS = \
441
	-DLIBVIRT_NSS		\
442 443 444
	$(AM_CFLAGS)		\
	$(WARN_CFLAGS)		\
	$(PIE_CFLAGS)		\
445 446 447 448 449 450
	$(COVERAGE_CFLAGS)	\
	$(LIBXML_CFLAGS)

nss_libnss_libvirt_impl_la_LIBADD = \
	../gnulib/lib/libgnu.la		\
	../src/libvirt-nss.la
451 452 453 454 455 456 457 458 459

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 \
R
Roman Bogorodskiy 已提交
460
	-shrext .so.$(NSS_SO_VER)
461 462 463 464 465 466 467 468 469

nss_libnss_libvirt_la_LIBADD =  \
	nss/libnss_libvirt_impl.la

lib_LTLIBRARIES = \
	nss/libnss_libvirt.la

endif WITH_NSS

470 471 472
EXTRA_DIST += $(LIBVIRT_NSS_SOURCES) \
	$(srcdir)/nss/libvirt_nss.syms \
	$(srcdir)/nss/libvirt_nss_bsd.syms
473 474 475 476 477

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

CLEANFILES += $(bin_SCRIPTS)
478
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
479
MAINTAINERCLEANFILES = $(dist_man1_MANS)
480

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