ee1959f5830b9a84a48a48d1d0a6654e3bd0b22a
[libguestfs.git] / daemon / Makefile.am
1 # libguestfs-daemon
2 # Copyright (C) 2010 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 ACLOCAL_AMFLAGS = -I m4
19
20 SUBDIRS = lib tests .
21
22 libsrcdir = $(top_builddir)/../src
23 generatorsrcdir = $(top_builddir)/../generator
24
25 generator_built = \
26         actions.h \
27         stubs.c \
28         names.c
29
30 .PHONY: force
31
32 $(generator_built): $(generatorsrcdir)/stamp-generator
33 $(generatorsrcdir)/stamp-generator: force
34         $(MAKE) -C $(generatorsrcdir) stamp-generator
35
36 BUILT_SOURCES = \
37         $(generator_built) \
38         guestfs_protocol.c \
39         guestfs_protocol.h \
40         errnostring_gperf.c \
41         errnostring_gperf.gperf \
42         errnostring.c \
43         errnostring.h
44
45 EXTRA_DIST = $(BUILT_SOURCES) \
46         .gitignore
47
48 # This convenience library is solely to avoid compiler warnings
49 # in its generated sources.
50 noinst_LIBRARIES = libprotocol.a
51 libprotocol_a_SOURCES = \
52         guestfs_protocol.c \
53         guestfs_protocol.h
54 libprotocol_a_CFLAGS =
55
56 guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
57         rm -f $@
58         ln $< $@
59 guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
60         rm -f $@
61         ln $< $@
62 $(libsrcdir)/guestfs_protocol.c: force
63         $(MAKE) -C $(libsrcdir) guestfs_protocol.c
64 $(libsrcdir)/guestfs_protocol.h: force
65         $(MAKE) -C $(libsrcdir) guestfs_protocol.h
66
67 # Build the errnostring perfect hash code.  The generated code has lots
68 # of warnings so we must compile it in a separate mini-library.
69 noinst_LIBRARIES += liberrnostring.a
70 liberrnostring_a_SOURCES = \
71         errnostring_gperf.c \
72         errnostring.h \
73         errnostring.c
74 liberrnostring_a_CFLAGS =
75
76 errnostring_gperf.c: errnostring_gperf.gperf
77         rm -f $@
78         $(GPERF) -t $< > $@-t
79         mv $@-t $@
80 errnostring_gperf.gperf: $(libsrcdir)/errnostring_gperf.gperf
81         rm -f $@
82         ln $< $@
83 errnostring.c: $(libsrcdir)/errnostring.c
84         rm -f $@
85         ln $< $@
86 errnostring.h: $(libsrcdir)/errnostring.h
87         rm -f $@
88         ln $< $@
89
90 noinst_PROGRAMS = guestfsd
91 guestfsd_SOURCES = \
92         actions.h \
93         available.c \
94         augeas.c \
95         base64.c \
96         blkid.c \
97         blockdev.c \
98         checksum.c \
99         cmp.c \
100         command.c \
101         cpmv.c \
102         daemon.h \
103         dd.c \
104         debug.c \
105         devsparts.c \
106         df.c \
107         dir.c \
108         dmesg.c \
109         dropcaches.c \
110         du.c \
111         echo_daemon.c \
112         ext2.c \
113         fallocate.c \
114         file.c \
115         findfs.c \
116         fill.c \
117         find.c \
118         fsck.c \
119         glob.c \
120         grep.c \
121         grub.c \
122         guestfsd.c \
123         headtail.c \
124         hexdump.c \
125         htonl.c \
126         initrd.c \
127         inotify.c \
128         is.c \
129         link.c \
130         ls.c \
131         luks.c \
132         lvm.c \
133         lvm-filter.c \
134         mkfs.c \
135         mknod.c \
136         modprobe.c \
137         mount.c \
138         names.c \
139         ntfs.c \
140         optgroups.c \
141         optgroups.h \
142         parted.c \
143         pingdaemon.c \
144         proto.c \
145         readdir.c \
146         realpath.c \
147         scrub.c \
148         selinux.c \
149         sfdisk.c \
150         sleep.c \
151         stat.c \
152         statvfs.c \
153         strings.c \
154         stubs.c \
155         swap.c \
156         sync.c \
157         tar.c \
158         truncate.c \
159         umask.c \
160         upload.c \
161         utimens.c \
162         wc.c \
163         xattr.c \
164         zero.c \
165         zerofree.c
166 guestfsd_LDADD = \
167         liberrnostring.a \
168         libprotocol.a \
169         lib/libgnu.a \
170         $(GETADDRINFO_LIB) \
171         $(HOSTENT_LIB) \
172         $(INET_NTOP_LIB) \
173         $(LIBSOCKET) \
174         $(LIB_CLOCK_GETTIME) \
175         $(LIBINTL) \
176         $(SERVENT_LIB)
177
178 AM_CPPFLAGS = -I$(srcdir)/lib -Ilib
179 guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)