Makefile.am 5.5 KB
Newer Older
1 2
## Copyright (C) 2005-2011 Red Hat, Inc.
## See COPYING.LIB for the License of this software
3

4 5 6 7 8 9 10 11 12
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

13
EXTRA_DIST = \
E
Eric Blake 已提交
14 15 16
	$(ICON_FILES)					\
	virt-xml-validate.in				\
	virt-pki-validate.in				\
17
	virt-sanlock-cleanup.in				\
E
Eric Blake 已提交
18
	virt-sanlock-cleanup.8				\
19
	virsh.pod					\
20
	libvirt-guests.init.sh				\
21
	libvirt-guests.sysconf
22

23
bin_SCRIPTS = virt-xml-validate virt-pki-validate
24 25
bin_PROGRAMS = virsh

26 27 28
if HAVE_SANLOCK
sbin_SCRIPTS = virt-sanlock-cleanup
endif
29

30 31 32 33
dist_man1_MANS = virt-xml-validate.1 virt-pki-validate.1 virsh.1
if HAVE_SANLOCK
dist_man8_MANS = virt-sanlock-cleanup.8
endif
34 35

virt-xml-validate: virt-xml-validate.in Makefile
36
	$(AM_V_GEN)sed -e 's,[@]SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \
37
	    || (rm $@ && exit 1) && chmod +x $@
38

39 40
virt-xml-validate.1: virt-xml-validate.in
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
41

42
virt-pki-validate: virt-pki-validate.in Makefile
43
	$(AM_V_GEN)sed -e 's,[@]SYSCONFDIR@,$(sysconfdir),' < $< > $@ \
44
	    || (rm $@ && exit 1) && chmod +x $@
45

46 47
virt-pki-validate.1: virt-pki-validate.in
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
48

49 50 51 52 53 54 55 56
virt-sanlock-cleanup: virt-sanlock-cleanup.in Makefile
	$(AM_V_GEN)sed -e 's,[@]SYSCONFDIR@,$(sysconfdir),' \
	    -e 's,[@]LOCALSTATEDIR@,$(localstatedir),' < $< > $@ \
	    || (rm $@ && exit 1) && chmod +x $@

virt-sanlock-cleanup.8: virt-sanlock-cleanup.in
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@

57 58 59 60
virsh_SOURCES =							\
		console.c console.h				\
		virsh.c

E
Eric Blake 已提交
61
virsh_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
62 63 64 65
virsh_LDADD =							\
		$(STATIC_BINARIES)				\
		$(WARN_CFLAGS)					\
		../src/libvirt.la				\
66
		../src/libvirt-qemu.la				\
67
		../gnulib/lib/libgnu.la				\
68
		$(LIBXML_LIBS)					\
69
		$(VIRSH_LIBS)
E
Eric Blake 已提交
70
virsh_CFLAGS =							\
71
		-I$(top_srcdir)/gnulib/lib -I../gnulib/lib	\
72
		-I../include -I$(top_srcdir)/include		\
73 74
		-I$(top_srcdir)/src				\
		-I$(top_srcdir)/src/util			\
75
		-I$(top_srcdir)					\
76
		$(WARN_CFLAGS)					\
77 78 79 80 81 82
		$(COVERAGE_CFLAGS)				\
		$(LIBXML_CFLAGS)				\
		$(READLINE_CFLAGS)
BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c

virsh-net-edit.c: virsh.c Makefile.am
83 84
	$(AM_V_GEN)rm -f $@-tmp && \
	echo '/* Automatically generated from: $^ */' > $@-tmp && \
E
Eric Blake 已提交
85
	echo 'static bool' >> $@-tmp && \
86 87 88 89 90 91
	awk '/^cmdEdit/, /^}/' $< \
	  | sed -e 's/domain/network/g' \
	      -e 's/Domain/Network/g' \
	      -e 's/cmdEdit/cmdNetworkEdit/g' \
	      -e 's/dom/network/g' \
	      -e 's/int flags.*/int flags = 0;/g' \
92 93 94
	>> $@-tmp && \
	chmod a-w $@-tmp && \
	rm -f $@ && \
95 96 97
	mv $@-tmp $@

virsh-pool-edit.c: virsh.c Makefile.am
98 99
	$(AM_V_GEN)rm -f $@-tmp && \
	echo '/* Automatically generated from: $^ */' > $@-tmp && \
E
Eric Blake 已提交
100
	echo 'static bool' >> $@-tmp && \
101 102 103 104 105 106 107 108 109 110
	awk '/^cmdEdit/, /^}/' $< \
	  | sed -e 's/domain/pool/g' \
	      -e 's/vshCommandOptDomain/vshCommandOptPool/g' \
	      -e 's/Domain %s/Pool %s/g' \
	      -e 's/(ctl, cmd, NULL);/(ctl, cmd, "pool", NULL);/' \
	      -e 's/Domain/StoragePool/g' \
	      -e 's/cmdEdit/cmdPoolEdit/g' \
	      -e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
	      -e 's/dom/pool/g' \
	      -e 's/int flags.*/int flags = 0;/g' \
111 112 113
	>> $@-tmp && \
	chmod a-w $@-tmp && \
	rm -f $@ && \
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
	mv $@-tmp $@


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
138
	$(AM_V_GEN)$(WINDRES) \
139 140 141 142 143
	  --input-format rc --input $< \
	  --output-format coff --output $@
endif

virsh.1: virsh.pod
144
	$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
145

146 147 148 149 150 151 152 153 154 155
install-data-local: install-init

uninstall-local: uninstall-init

if LIBVIRT_INIT_SCRIPT_RED_HAT
install-init: libvirt-guests.init
	mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
	$(INSTALL_SCRIPT) libvirt-guests.init \
	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
	mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
156
	$(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
157 158 159 160 161 162 163 164
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests

uninstall-init:
	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests \
	  $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests

BUILT_SOURCES += libvirt-guests.init

165
libvirt-guests.init: libvirt-guests.init.sh $(top_builddir)/config.status
166
	$(AM_V_GEN)sed					\
167 168 169 170 171 172
	    -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'	\
173 174 175 176 177 178 179 180 181
	    < $< > $@-t &&				\
	    chmod a+x $@-t &&				\
	    mv $@-t $@
else
install-init:
uninstall-init:
libvirt-guests.init:
endif # LIBVIRT_INIT_SCRIPT_RED_HAT

182

183
CLEANFILES = $(bin_SCRIPTS)
184
CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s
185
MAINTAINERCLEANFILES = $(dist_man1_MANS)
186

187
DISTCLEANFILES = $(BUILT_SOURCES)