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

17
INCLUDES = \
18 19 20 21 22
	-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)						\
23 24
	$(GETTEXT_CPPFLAGS)

25 26 27 28 29 30 31 32 33
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

34
EXTRA_DIST = \
E
Eric Blake 已提交
35
	$(ICON_FILES)					\
36
	$(conf_DATA)					\
E
Eric Blake 已提交
37 38
	virt-xml-validate.in				\
	virt-pki-validate.in				\
39
	virt-sanlock-cleanup.in				\
E
Eric Blake 已提交
40
	virt-sanlock-cleanup.8				\
D
Dan Walsh 已提交
41
	virt-login-shell.pod				\
42
	virsh.pod					\
43 44 45 46 47 48 49 50 51 52 53
	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


54

E
Eric Blake 已提交
55 56
DISTCLEANFILES =

D
Dan Walsh 已提交
57 58 59
confdir = $(sysconfdir)/libvirt
conf_DATA = virt-login-shell.conf

60
bin_SCRIPTS = virt-xml-validate virt-pki-validate
D
Dan Walsh 已提交
61
bin_PROGRAMS = virsh virt-host-validate virt-login-shell
62
libexec_SCRIPTS = libvirt-guests.sh
63

64
if WITH_SANLOCK
65
sbin_SCRIPTS = virt-sanlock-cleanup
E
Eric Blake 已提交
66
DISTCLEANFILES += virt-sanlock-cleanup
67
endif
68

69 70 71 72
dist_man1_MANS = \
		virt-host-validate.1 \
		virt-pki-validate.1 \
		virt-xml-validate.1 \
D
Dan Walsh 已提交
73
		virt-login-shell.1 \
74
		virsh.1
75
if WITH_SANLOCK
76 77
dist_man8_MANS = virt-sanlock-cleanup.8
endif
78 79

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

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

89
virt-pki-validate: virt-pki-validate.in Makefile
90 91 92
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|g' \
		       -e 's|[@]VERSION@|$(VERSION)|g' \
	  < $< > $@ || (rm $@ && exit 1) && chmod +x $@
93

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

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

104
virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
105 106
	$(AM_V_GEN)sed -e 's|[@]sysconfdir@|$(sysconfdir)|' \
	    -e 's|[@]localstatedir@|$(localstatedir)|' < $< > $@ \
107 108
	    || (rm $@ && exit 1) && chmod +x $@

109
virt-sanlock-cleanup.8: virt-sanlock-cleanup.in $(top_srcdir)/configure.ac
110 111
	$(AM_V_GEN)$(POD2MAN) --name VIRT-SANLOCK-CLEANUP --section=8 \
	    $< $(srcdir)/$@ \
E
Eric Blake 已提交
112
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
113
		rm $(srcdir)/$@; exit 1; fi
114

115 116 117 118 119 120 121 122
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 = \
D
Daniel P. Berrange 已提交
123
		$(PIE_LDFLAGS) \
D
Daniel P. Berrange 已提交
124
		$(RELRO_LDFLAGS) \
125 126 127 128 129 130 131 132 133 134
		$(COVERAGE_LDFLAGS) \
		$(NULL)

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

virt_host_validate_CFLAGS = \
		$(WARN_CFLAGS)					\
D
Daniel P. Berrange 已提交
135
		$(PIE_CFLAGS)					\
136 137 138
		$(COVERAGE_CFLAGS)				\
		$(NULL)

D
Dan Walsh 已提交
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
virt_login_shell_SOURCES =					\
		virt-login-shell.c

virt_login_shell_LDFLAGS = $(COVERAGE_LDFLAGS)
virt_login_shell_LDADD =					\
		$(STATIC_BINARIES)				\
		$(PIE_LDFLAGS)					\
		$(RELRO_LDFLAGS) \
		../src/libvirt.la				\
		../src/libvirt-lxc.la				\
		../gnulib/lib/libgnu.la

virt_login_shell_CFLAGS =					\
		$(WARN_CFLAGS)					\
		$(PIE_CFLAGS)					\
		$(COVERAGE_CFLAGS)

156 157
virsh_SOURCES =							\
		console.c console.h				\
E
Eric Blake 已提交
158
		virsh.c virsh.h					\
E
Eric Blake 已提交
159
		virsh-domain.c virsh-domain.h			\
160
		virsh-domain-monitor.c virsh-domain-monitor.h	\
E
Eric Blake 已提交
161
		virsh-host.c virsh-host.h			\
E
Eric Blake 已提交
162
		virsh-interface.c virsh-interface.h		\
E
Eric Blake 已提交
163
		virsh-network.c virsh-network.h			\
E
Eric Blake 已提交
164
		virsh-nodedev.c virsh-nodedev.h			\
E
Eric Blake 已提交
165
		virsh-nwfilter.c virsh-nwfilter.h		\
E
Eric Blake 已提交
166
		virsh-pool.c virsh-pool.h			\
E
Eric Blake 已提交
167
		virsh-secret.c virsh-secret.h			\
E
Eric Blake 已提交
168
		virsh-snapshot.c virsh-snapshot.h		\
E
Eric Blake 已提交
169
		virsh-volume.c virsh-volume.h			\
E
Eric Blake 已提交
170
		$(NULL)
171

172
virsh_LDFLAGS = $(COVERAGE_LDFLAGS)
173 174
virsh_LDADD =							\
		$(STATIC_BINARIES)				\
D
Daniel P. Berrange 已提交
175
		$(PIE_LDFLAGS)					\
D
Daniel P. Berrange 已提交
176
		$(RELRO_LDFLAGS) \
177
		../src/libvirt.la				\
178
		../src/libvirt-lxc.la				\
179
		../src/libvirt-qemu.la				\
180
		../gnulib/lib/libgnu.la				\
181
		$(LIBXML_LIBS)					\
182
		$(VIRSH_LIBS)
E
Eric Blake 已提交
183
virsh_CFLAGS =							\
184
		$(WARN_CFLAGS)					\
D
Daniel P. Berrange 已提交
185
		$(PIE_CFLAGS)					\
186 187 188
		$(COVERAGE_CFLAGS)				\
		$(LIBXML_CFLAGS)				\
		$(READLINE_CFLAGS)
189
BUILT_SOURCES =
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211

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
212
	$(AM_V_GEN)$(WINDRES) \
213 214 215 216
	  --input-format rc --input $< \
	  --output-format coff --output $@
endif

D
Dan Walsh 已提交
217 218 219 220 221
virt-login-shell.1: virt-login-shell.pod $(top_srcdir)/configure.ac
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ \
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
		rm $(srcdir)/$@; exit 1; fi

222
virsh.1: virsh.pod $(top_srcdir)/configure.ac
E
Eric Blake 已提交
223 224
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@ \
	    && if grep 'POD ERROR' $(srcdir)/$@ ; then \
E
Eric Blake 已提交
225
		rm $(srcdir)/$@; exit 1; fi
226

227
install-data-local: install-init install-systemd
228

229
uninstall-local: uninstall-init uninstall-systemd
230

231
install-sysconfig:
232
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
233 234 235 236 237
	$(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests

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

240
EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
241

242
install-initscript: libvirt-guests.init
243
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
244 245 246
	$(INSTALL_SCRIPT) libvirt-guests.init \
	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests

247
uninstall-initscript:
248
	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
249
	rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d ||:
250

251 252 253 254 255

if LIBVIRT_INIT_SCRIPT_RED_HAT
BUILT_SOURCES += libvirt-guests.init
install-init: install-sysconfig install-initscript
uninstall-init: uninstall-sysconfig uninstall-initscript
256 257 258 259 260
else
install-init:
uninstall-init:
endif # LIBVIRT_INIT_SCRIPT_RED_HAT

261
libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
262 263 264 265 266 267 268 269 270
	$(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 &&					\
271
	    mv $@-t $@
272
BUILT_SOURCES += libvirt-guests.sh
273

274 275
libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
	$(AM_V_GEN)sed \
276
		-e 's|[@]libexecdir[@]|$(libexecdir)|g' \
277 278 279
	< $< > $@-t && \
	chmod a+x $@-t && \
	mv $@-t $@
280 281 282


EXTRA_DIST += libvirt-guests.service.in
283 284
SYSTEMD_UNIT_DIR = /lib/systemd/system

285
if LIBVIRT_INIT_SCRIPT_SYSTEMD
286
install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
287
	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
288
	$(INSTALL_DATA) libvirt-guests.service \
289
	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
290

291
uninstall-systemd: uninstall-sysconfig
292
	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
293
	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
294 295 296

BUILT_SOURCES += libvirt-guests.service

297
else
298 299 300 301 302
install-systemd:
uninstall-systemd:
endif # LIBVIRT_INIT_SCRIPT_SYSTEMD

libvirt-guests.service: libvirt-guests.service.in $(top_builddir)/config.status
303 304 305 306 307 308 309 310 311
	$(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 &&					\
312
	    mv $@-t $@
313

314

315
CLEANFILES = $(bin_SCRIPTS)
316
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
317
MAINTAINERCLEANFILES = $(dist_man1_MANS)
318

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