Add list of function_names to the daemon.
[libguestfs.git] / src / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009 Red Hat Inc.
3 #
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.
8 #
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.
13 #
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.
17
18 EXTRA_DIST = \
19         guestfs_protocol.x \
20         guestfs_protocol.c \
21         guestfs_protocol.h \
22         MAX_PROC_NR \
23         stamp-generator \
24         generator.ml
25
26 # Rerun the generator if it has changed.
27 # Git removes empty directories, so in cases where the
28 # generator is creating the sole file in a directory, we
29 # have to create the directory first.
30 noinst_DATA = stamp-generator
31
32 stamp-generator: generator.ml
33         mkdir -p $(top_srcdir)/perl/lib/Sys
34         cd .. && ocaml -warn-error A $(srcdir)/src/$<
35
36 guestfs_protocol.x: stamp-generator
37
38 include_HEADERS = guestfs.h guestfs-actions.h guestfs-structs.h
39
40 lib_LTLIBRARIES = libguestfs.la
41
42 # From the libtool info file, with comments:
43 #
44 # |  1. Start with version information of `0:0:0' for each libtool library.
45 # |
46 # |  2. Update the version information only immediately before a public
47 # |     release of your software.  More frequent updates are unnecessary,
48 # |     and only guarantee that the current interface number gets larger
49 # |     faster.
50 # |
51 # |  3. If the library source code has changed at all since the last
52 # |     update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
53 #
54 # [So it seems like we should always update the middle 'R' field
55 # for any release.]
56 #
57 # |  4. If any interfaces have been added, removed, or changed since the
58 # |     last update, increment CURRENT, and set REVISION to 0.
59 # |
60 # |  5. If any interfaces have been added since the last public release,
61 # |     then increment AGE.
62 #
63 # [These two rules seem to mean that if any change is made to the
64 # generator, we should increment C and A, and set R to 0, so:
65 # C+1:0:A+1.]
66 #
67 # |  6. If any interfaces have been removed since the last public release,
68 # |     then set AGE to 0.
69 #
70 # [Our ABI guarantee means we won't remove interfaces except in
71 # very exceptional circumstances.]
72 #
73 # The maximum proc number (see guestfs_protocol.x:guestfs_procedure) is
74 # a mostly accurate stand-in for C & A in rules 5 & 6, so we use that.  It
75 # is always incremented when we add a new appliance interface, and easy to
76 # calculate.
77 #
78 # The middle number is hard to increment-and-reset as described in rules
79 # 4 & 5, so for the moment it is always set to 0.
80 #
81 # Note that this scheme means the real library version will always be
82 # 'libguestfs.so.0.$(MAX_PROC_NR).0'.
83
84 BUILT_SOURCES = \
85   guestfs_protocol.x \
86   guestfs-structs.h \
87   guestfs-actions.h \
88   guestfs-actions.c \
89   guestfs-bindtests.c
90
91 $(BUILT_SOURCES): stamp-generator
92
93 libguestfs_la_LDFLAGS = -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
94 libguestfs_la_SOURCES = \
95         guestfs.c \
96         guestfs.h \
97         guestfs_protocol.c \
98         guestfs_protocol.h \
99         guestfs-actions.h \
100         guestfs-actions.c \
101         guestfs-bindtests.c \
102         gettext.h
103
104 libguestfs_la_CFLAGS = -Wall -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"'
105
106 if HAVE_RPCGEN
107 guestfs_protocol.c: guestfs_protocol.x
108         rm -f $@-t
109         $(RPCGEN) -c -o $@-t $<
110         mv $@-t $@
111
112 guestfs_protocol.h: guestfs_protocol.x
113         rm -f $@-t
114         $(RPCGEN) -h -o $@-t $<
115         mv $@-t $@
116 endif