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
47 # Rerun the generator if it has changed.
48 # Git removes empty directories, so in cases where the
49 # generator is creating the sole file in a directory, we
50 # have to create the directory first.
51 noinst_DATA = stamp-generator
53 stamp-generator: generator.ml
54 mkdir -p $(top_srcdir)/perl/lib/Sys
55 mkdir -p $(top_srcdir)/ruby/ext/guestfs
56 mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
57 mkdir -p $(top_srcdir)/csharp
58 cd $(top_srcdir) && ocaml -warn-error A src/generator.ml
60 include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h
62 lib_LTLIBRARIES = libguestfs.la
64 # This convenience library is solely to avoid compiler warnings
65 # in its generated sources.
66 libprotocol_la_SOURCES = \
70 libprotocol_la_CFLAGS =
72 # From the libtool info file, with comments:
74 # | 1. Start with version information of `0:0:0' for each libtool library.
76 # | 2. Update the version information only immediately before a public
77 # | release of your software. More frequent updates are unnecessary,
78 # | and only guarantee that the current interface number gets larger
81 # | 3. If the library source code has changed at all since the last
82 # | update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
84 # [So it seems like we should always update the middle 'R' field
87 # | 4. If any interfaces have been added, removed, or changed since the
88 # | last update, increment CURRENT, and set REVISION to 0.
90 # | 5. If any interfaces have been added since the last public release,
91 # | then increment AGE.
93 # [These two rules seem to mean that if any change is made to the
94 # generator, we should increment C and A, and set R to 0, so:
97 # | 6. If any interfaces have been removed since the last public release,
98 # | then set AGE to 0.
100 # [Our ABI guarantee means we won't remove interfaces except in
101 # very exceptional circumstances.]
103 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
104 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that. It
105 # is always incremented when we add a new appliance interface, and easy to
108 # The middle number is hard to increment-and-reset as described in rules
109 # 4 & 5, so for the moment it is always set to 0.
111 # Note that this scheme means the real library version will always be
112 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
113 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
115 libguestfs_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)libguestfs.syms
117 libguestfs_la_SOURCES = \
122 guestfs-bindtests.c \
129 libguestfs_la_LIBADD = $(LTLIBTHREAD) ../gnulib/lib/libgnu.la
131 # Make libguestfs include the convenience library.
132 noinst_LTLIBRARIES = libprotocol.la
133 libguestfs_la_LIBADD += libprotocol.la
135 libguestfs_la_CFLAGS = \
136 -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
137 $(WARN_CFLAGS) $(WERROR_CFLAGS)
139 libguestfs_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib
142 guestfs_protocol.c: guestfs_protocol.x
144 $(RPCGEN) -c -o $@-t $<
145 sed 's,\.\./\.\./src/,,' < $@-t > $@-t2
149 guestfs_protocol.h: guestfs_protocol.x
151 $(RPCGEN) -h -o $@-t $<
156 # guestfs-actions.pod, guestfs-availability.pod and guestfs-structs
157 # are autogenerated. There is no include mechanism for POD, so we
158 # have to do it by hand.
160 man_MANS = guestfs.3 libguestfs.3
162 guestfs.3: guestfs.pod \
163 guestfs-actions.pod \
164 guestfs-availability.pod \
167 -e '/@ACTIONS@/rguestfs-actions.pod' \
169 -e '/@AVAILABILITY@/rguestfs-availability.pod' \
170 -e 's/@AVAILABILITY@//' \
171 -e '/@STRUCTS@/rguestfs-structs.pod' \
176 -c "Virtualization Support" \
178 --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
181 # Check user doesn't try to do 'make all' or 'make check' as root.
182 # https://www.redhat.com/archives/libguestfs/2010-April/msg00098.html
185 check-local: checkroot
187 @if [ "`id -u`" = 0 ]; then \
188 echo "*** Error: Don't run 'make' or 'make check' as root."; \