3fe8c8827b0466926ebac04c492e5684d8be4d35
[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 noinst_LIBRARIES = libprotocol.a
49
50 # This convenience library is solely to compile its generated sources with
51 # custom flags.
52 libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h
53 libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
54
55 guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
56         rm -f $@
57         ln $< $@
58 guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
59         rm -f $@
60         ln $< $@
61 $(libsrcdir)/guestfs_protocol.c: force
62         $(MAKE) -C $(libsrcdir) guestfs_protocol.c
63 $(libsrcdir)/guestfs_protocol.h: force
64         $(MAKE) -C $(libsrcdir) guestfs_protocol.h
65
66 # Build the errnostring perfect hash code.  The generated code has lots
67 # of warnings so we must compile it in a separate mini-library.
68 noinst_LIBRARIES += liberrnostring.a
69 liberrnostring_a_SOURCES = \
70         errnostring_gperf.c \
71         errnostring.h \
72         errnostring.c
73 liberrnostring_a_CFLAGS =
74
75 errnostring_gperf.c: errnostring_gperf.gperf
76         rm -f $@
77         $(GPERF) -t $< > $@-t
78         mv $@-t $@
79 errnostring_gperf.gperf: $(libsrcdir)/errnostring_gperf.gperf
80         rm -f $@
81         ln $< $@
82 errnostring.c: $(libsrcdir)/errnostring.c
83         rm -f $@
84         ln $< $@
85 errnostring.h: $(libsrcdir)/errnostring.h
86         rm -f $@
87         ln $< $@
88
89 if INSTALL_DAEMON
90 sbin_PROGRAMS = guestfsd
91 else
92 noinst_PROGRAMS = guestfsd
93 endif
94
95 guestfsd_SOURCES = \
96         9p.c \
97         actions.h \
98         available.c \
99         augeas.c \
100         base64.c \
101         blkid.c \
102         blockdev.c \
103         btrfs.c \
104         checksum.c \
105         cmp.c \
106         command.c \
107         cpmv.c \
108         daemon.h \
109         dd.c \
110         debug.c \
111         devsparts.c \
112         df.c \
113         dir.c \
114         dmesg.c \
115         dropcaches.c \
116         du.c \
117         echo_daemon.c \
118         ext2.c \
119         fallocate.c \
120         file.c \
121         findfs.c \
122         fill.c \
123         find.c \
124         fsck.c \
125         glob.c \
126         grep.c \
127         grub.c \
128         guestfsd.c \
129         headtail.c \
130         hexdump.c \
131         htonl.c \
132         initrd.c \
133         inotify.c \
134         is.c \
135         link.c \
136         ls.c \
137         luks.c \
138         lvm.c \
139         lvm-filter.c \
140         mkfs.c \
141         mknod.c \
142         modprobe.c \
143         mount.c \
144         names.c \
145         ntfs.c \
146         optgroups.c \
147         optgroups.h \
148         parted.c \
149         pingdaemon.c \
150         proto.c \
151         readdir.c \
152         realpath.c \
153         scrub.c \
154         selinux.c \
155         sfdisk.c \
156         sleep.c \
157         stat.c \
158         statvfs.c \
159         strings.c \
160         stubs.c \
161         swap.c \
162         sync.c \
163         tar.c \
164         truncate.c \
165         umask.c \
166         upload.c \
167         utimens.c \
168         wc.c \
169         xattr.c \
170         zero.c \
171         zerofree.c
172 guestfsd_LDADD = \
173         liberrnostring.a \
174         libprotocol.a \
175         lib/libgnu.a \
176         $(GETADDRINFO_LIB) \
177         $(HOSTENT_LIB) \
178         $(INET_NTOP_LIB) \
179         $(LIBSOCKET) \
180         $(LIB_CLOCK_GETTIME) \
181         $(LIBINTL) \
182         $(SERVENT_LIB)
183
184 AM_CPPFLAGS = -I$(srcdir)/lib -Ilib
185 guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)