2 # Copyright (C) 2009 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
24 guestfs-internal-actions.h \
28 guestfs-availability.pod \
32 $(generator_built): stamp-generator
46 # Rerun the generator if it has changed.
47 # Git removes empty directories, so in cases where the
48 # generator is creating the sole file in a directory, we
49 # have to create the directory first.
50 noinst_DATA = stamp-generator
52 stamp-generator: generator.ml
53 mkdir -p $(top_srcdir)/perl/lib/Sys
54 mkdir -p $(top_srcdir)/ruby/ext/guestfs
55 mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
56 mkdir -p $(top_srcdir)/csharp
57 cd $(top_srcdir) && ocaml -warn-error A src/generator.ml
59 include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h
61 lib_LTLIBRARIES = libguestfs.la
63 # This convenience library is solely to avoid compiler warnings
64 # in its generated sources.
65 libprotocol_la_SOURCES = \
69 libprotocol_la_CFLAGS =
71 # From the libtool info file, with comments:
73 # | 1. Start with version information of `0:0:0' for each libtool library.
75 # | 2. Update the version information only immediately before a public
76 # | release of your software. More frequent updates are unnecessary,
77 # | and only guarantee that the current interface number gets larger
80 # | 3. If the library source code has changed at all since the last
81 # | update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
83 # [So it seems like we should always update the middle 'R' field
86 # | 4. If any interfaces have been added, removed, or changed since the
87 # | last update, increment CURRENT, and set REVISION to 0.
89 # | 5. If any interfaces have been added since the last public release,
90 # | then increment AGE.
92 # [These two rules seem to mean that if any change is made to the
93 # generator, we should increment C and A, and set R to 0, so:
96 # | 6. If any interfaces have been removed since the last public release,
97 # | then set AGE to 0.
99 # [Our ABI guarantee means we won't remove interfaces except in
100 # very exceptional circumstances.]
102 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
103 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that. It
104 # is always incremented when we add a new appliance interface, and easy to
107 # The middle number is hard to increment-and-reset as described in rules
108 # 4 & 5, so for the moment it is always set to 0.
110 # Note that this scheme means the real library version will always be
111 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
112 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
114 libguestfs_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)libguestfs.syms
116 libguestfs_la_SOURCES = \
121 guestfs-bindtests.c \
127 libguestfs_la_LIBADD = $(LTLIBTHREAD)
129 # Make libguestfs include the convenience library.
130 noinst_LTLIBRARIES = libprotocol.la
131 libguestfs_la_LIBADD += libprotocol.la
133 libguestfs_la_CFLAGS = \
134 -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
135 $(WARN_CFLAGS) $(WERROR_CFLAGS)
137 libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
140 guestfs_protocol.c: guestfs_protocol.x
142 $(RPCGEN) -c -o $@-t $<
143 sed 's,\.\./\.\./src/,,' < $@-t > $@-t2
147 guestfs_protocol.h: guestfs_protocol.x
149 $(RPCGEN) -h -o $@-t $<
154 # guestfs-actions.pod, guestfs-availability.pod and guestfs-structs
155 # are autogenerated. There is no include mechanism for POD, so we
156 # have to do it by hand.
158 man_MANS = guestfs.3 libguestfs.3
160 guestfs.3: guestfs.pod \
161 guestfs-actions.pod \
162 guestfs-availability.pod \
165 -e '/@ACTIONS@/rguestfs-actions.pod' \
167 -e '/@AVAILABILITY@/rguestfs-availability.pod' \
168 -e 's/@AVAILABILITY@//' \
169 -e '/@STRUCTS@/rguestfs-structs.pod' \
174 -c "Virtualization Support" \
176 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \