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.
24 # Rerun the generator if it has changed.
25 # Git removes empty directories, so in cases where the
26 # generator is creating the sole file in a directory, we
27 # have to create the directory first.
28 noinst_DATA = stamp-generator
30 stamp-generator: generator.ml
31 mkdir -p $(top_srcdir)/perl/lib/Sys
32 mkdir -p $(top_srcdir)/ruby/ext/guestfs
33 mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
34 cd $(top_srcdir) && ocaml -warn-error A src/generator.ml
36 guestfs_protocol.x: stamp-generator
38 include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h
40 lib_LTLIBRARIES = libguestfs.la
49 guestfs-internal-actions.h \
52 # This convenience library is solely to avoid compiler warnings
53 # in its generated sources.
54 libprotocol_la_SOURCES = \
58 libprotocol_la_CFLAGS =
60 $(BUILT_SOURCES): stamp-generator
62 CLEANFILES = guestfs_protocol.c guestfs_protocol.h
64 # From the libtool info file, with comments:
66 # | 1. Start with version information of `0:0:0' for each libtool library.
68 # | 2. Update the version information only immediately before a public
69 # | release of your software. More frequent updates are unnecessary,
70 # | and only guarantee that the current interface number gets larger
73 # | 3. If the library source code has changed at all since the last
74 # | update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
76 # [So it seems like we should always update the middle 'R' field
79 # | 4. If any interfaces have been added, removed, or changed since the
80 # | last update, increment CURRENT, and set REVISION to 0.
82 # | 5. If any interfaces have been added since the last public release,
83 # | then increment AGE.
85 # [These two rules seem to mean that if any change is made to the
86 # generator, we should increment C and A, and set R to 0, so:
89 # | 6. If any interfaces have been removed since the last public release,
90 # | then set AGE to 0.
92 # [Our ABI guarantee means we won't remove interfaces except in
93 # very exceptional circumstances.]
95 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
96 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that. It
97 # is always incremented when we add a new appliance interface, and easy to
100 # The middle number is hard to increment-and-reset as described in rules
101 # 4 & 5, so for the moment it is always set to 0.
103 # Note that this scheme means the real library version will always be
104 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
106 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
107 libguestfs_la_SOURCES = \
112 guestfs-bindtests.c \
115 # Make libguestfs include the convenience library.
116 noinst_LTLIBRARIES = libprotocol.la
117 libguestfs_la_LIBADD = libprotocol.la
119 libguestfs_la_CFLAGS = \
120 -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
121 $(WARN_CFLAGS) $(WERROR_CFLAGS)
123 libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
126 guestfs_protocol.c: guestfs_protocol.x
128 $(RPCGEN) -c -o $@-t $<
129 sed 's,\.\./\.\./src/,,' < $@-t > $@-t2
133 guestfs_protocol.h: guestfs_protocol.x
135 $(RPCGEN) -h -o $@-t $<