2 # Copyright (C) 2010 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 include $(top_srcdir)/subdir-rules.mk
20 CLEANFILES = stamp-guestfs.pod
25 guestfs-internal-actions.h \
28 errnostring_gperf.gperf \
32 guestfs-availability.pod \
49 api-support/update-from-tarballs.sh
51 include_HEADERS = guestfs.h
53 lib_LTLIBRARIES = libguestfs.la
55 # This convenience library is solely to compile its generated sources with
57 libprotocol_la_SOURCES = guestfs_protocol.c guestfs_protocol.h
58 libprotocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
60 # Build the errnostring perfect hash code. The generated code has lots
61 # of warnings so we must compile it in a separate mini-library.
62 liberrnostring_la_SOURCES = \
66 liberrnostring_la_CFLAGS =
68 errnostring_gperf.c: errnostring_gperf.gperf
73 # From the libtool info file, with comments:
75 # | 1. Start with version information of `0:0:0' for each libtool library.
77 # | 2. Update the version information only immediately before a public
78 # | release of your software. More frequent updates are unnecessary,
79 # | and only guarantee that the current interface number gets larger
82 # | 3. If the library source code has changed at all since the last
83 # | update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
85 # [So it seems like we should always update the middle 'R' field
88 # | 4. If any interfaces have been added, removed, or changed since the
89 # | last update, increment CURRENT, and set REVISION to 0.
91 # | 5. If any interfaces have been added since the last public release,
92 # | then increment AGE.
94 # [These two rules seem to mean that if any change is made to the
95 # generator, we should increment C and A, and set R to 0, so:
98 # | 6. If any interfaces have been removed since the last public release,
99 # | then set AGE to 0.
101 # [Our ABI guarantee means we won't remove interfaces except in
102 # very exceptional circumstances.]
104 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
105 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that. It
106 # is always incremented when we add a new appliance interface, and easy to
109 # The middle number is hard to increment-and-reset as described in rules
110 # 4 & 5, so for the moment it is always set to 0.
112 # Note that this scheme means the real library version will always be
113 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
114 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
116 libguestfs_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
118 libguestfs_la_SOURCES = \
135 inspect_fs_windows.c \
144 libguestfs_la_LIBADD = \
145 $(HIVEX_LIBS) $(AUGEAS_LIBS) $(PCRE_LIBS) $(MAGIC_LIBS) \
146 $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \
147 ../gnulib/lib/libgnu.la \
152 $(LIB_CLOCK_GETTIME) \
157 # Make libguestfs include the convenience libraries.
158 noinst_LTLIBRARIES = liberrnostring.la libprotocol.la
159 libguestfs_la_LIBADD += liberrnostring.la libprotocol.la
161 libguestfs_la_CFLAGS = \
162 -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
163 -DGUESTFS_WARN_DEPRECATED=1 \
164 $(HIVEX_CFLAGS) $(AUGEAS_CFLAGS) $(PCRE_CFLAGS) \
165 $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
166 $(WARN_CFLAGS) $(WERROR_CFLAGS)
168 libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
171 guestfs_protocol.c: guestfs_protocol.x
173 $(RPCGEN) -c -o $@-t $(srcdir)/$<
174 sed 's,\.\./\.\./src/,,' < $@-t > $@-t2
178 guestfs_protocol.h: guestfs_protocol.x
180 $(RPCGEN) -h -o $@-t $(srcdir)/$<
186 man_MANS = guestfs.3 libguestfs.3
187 noinst_DATA = $(top_builddir)/html/guestfs.3.html
189 guestfs.3 $(top_builddir)/html/guestfs.3.html: stamp-guestfs.pod
191 stamp-guestfs.pod: guestfs.pod \
192 guestfs-actions.pod \
193 guestfs-availability.pod \
195 $(top_builddir)/podwrapper.sh \
198 --html $(top_builddir)/html/guestfs.3.html \
199 --insert $(srcdir)/guestfs-actions.pod:@ACTIONS@ \
200 --insert $(srcdir)/guestfs-availability.pod:@AVAILABILITY@ \
201 --insert $(srcdir)/guestfs-structs.pod:@STRUCTS@ \