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., 675 Mass Ave, Cambridge, MA 02139, 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 avoid compiler warnings
56 # in its generated sources.
57 libprotocol_la_SOURCES = \
61 libprotocol_la_CFLAGS =
63 # Build the errnostring perfect hash code. The generated code has lots
64 # of warnings so we must compile it in a separate mini-library.
65 liberrnostring_la_SOURCES = \
69 liberrnostring_la_CFLAGS =
71 errnostring_gperf.c: errnostring_gperf.gperf
76 # From the libtool info file, with comments:
78 # | 1. Start with version information of `0:0:0' for each libtool library.
80 # | 2. Update the version information only immediately before a public
81 # | release of your software. More frequent updates are unnecessary,
82 # | and only guarantee that the current interface number gets larger
85 # | 3. If the library source code has changed at all since the last
86 # | update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
88 # [So it seems like we should always update the middle 'R' field
91 # | 4. If any interfaces have been added, removed, or changed since the
92 # | last update, increment CURRENT, and set REVISION to 0.
94 # | 5. If any interfaces have been added since the last public release,
95 # | then increment AGE.
97 # [These two rules seem to mean that if any change is made to the
98 # generator, we should increment C and A, and set R to 0, so:
101 # | 6. If any interfaces have been removed since the last public release,
102 # | then set AGE to 0.
104 # [Our ABI guarantee means we won't remove interfaces except in
105 # very exceptional circumstances.]
107 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
108 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that. It
109 # is always incremented when we add a new appliance interface, and easy to
112 # The middle number is hard to increment-and-reset as described in rules
113 # 4 & 5, so for the moment it is always set to 0.
115 # Note that this scheme means the real library version will always be
116 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
117 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
119 libguestfs_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)libguestfs.syms
121 libguestfs_la_SOURCES = \
138 libguestfs_la_LIBADD = \
139 $(HIVEX_LIBS) $(AUGEAS_LIBS) $(PCRE_LIBS) $(MAGIC_LIBS) \
140 $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \
141 $(LTLIBTHREAD) ../gnulib/lib/libgnu.la
143 # Make libguestfs include the convenience libraries.
144 noinst_LTLIBRARIES = liberrnostring.la libprotocol.la
145 libguestfs_la_LIBADD += liberrnostring.la libprotocol.la
147 libguestfs_la_CFLAGS = \
148 -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
149 $(HIVEX_CFLAGS) $(AUGEAS_CFLAGS) $(PCRE_CFLAGS) \
150 $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
151 $(WARN_CFLAGS) $(WERROR_CFLAGS)
153 libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
156 guestfs_protocol.c: guestfs_protocol.x
158 $(RPCGEN) -c -o $@-t $<
159 sed 's,\.\./\.\./src/,,' < $@-t > $@-t2
163 guestfs_protocol.h: guestfs_protocol.x
165 $(RPCGEN) -h -o $@-t $<
171 man_MANS = guestfs.3 libguestfs.3
172 noinst_DATA = $(top_builddir)/html/guestfs.3.html
174 guestfs.3 $(top_builddir)/html/guestfs.3.html: stamp-guestfs.pod
176 stamp-guestfs.pod: guestfs.pod \
177 guestfs-actions.pod \
178 guestfs-availability.pod \
180 $(top_srcdir)/podwrapper.sh \
183 --html $(top_builddir)/html/guestfs.3.html \
184 --insert guestfs-actions.pod:@ACTIONS@ \
185 --insert guestfs-availability.pod:@AVAILABILITY@ \
186 --insert guestfs-structs.pod:@STRUCTS@ \