67589b4b03c1d6fca8807400d4a74c7231353f2d
[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 noinst_PROGRAMS = guestfsd
90 guestfsd_SOURCES = \
91         9p.c \
92         actions.h \
93         available.c \
94         augeas.c \
95         base64.c \
96         blkid.c \
97         blockdev.c \
98         btrfs.c \
99         checksum.c \
100         cmp.c \
101         command.c \
102         cpmv.c \
103         daemon.h \
104         dd.c \
105         debug.c \
106         devsparts.c \
107         df.c \
108         dir.c \
109         dmesg.c \
110         dropcaches.c \
111         du.c \
112         echo_daemon.c \
113         ext2.c \
114         fallocate.c \
115         file.c \
116         findfs.c \
117         fill.c \
118         find.c \
119         fsck.c \
120         glob.c \
121         grep.c \
122         grub.c \
123         guestfsd.c \
124         headtail.c \
125         hexdump.c \
126         htonl.c \
127         initrd.c \
128         inotify.c \
129         is.c \
130         link.c \
131         ls.c \
132         luks.c \
133         lvm.c \
134         lvm-filter.c \
135         mkfs.c \
136         mknod.c \
137         modprobe.c \
138         mount.c \
139         names.c \
140         ntfs.c \
141         optgroups.c \
142         optgroups.h \
143         parted.c \
144         pingdaemon.c \
145         proto.c \
146         readdir.c \
147         realpath.c \
148         scrub.c \
149         selinux.c \
150         sfdisk.c \
151         sleep.c \
152         stat.c \
153         statvfs.c \
154         strings.c \
155         stubs.c \
156         swap.c \
157         sync.c \
158         tar.c \
159         truncate.c \
160         umask.c \
161         upload.c \
162         utimens.c \
163         wc.c \
164         xattr.c \
165         zero.c \
166         zerofree.c
167 guestfsd_LDADD = \
168         liberrnostring.a \
169         libprotocol.a \
170         lib/libgnu.a \
171         $(GETADDRINFO_LIB) \
172         $(HOSTENT_LIB) \
173         $(INET_NTOP_LIB) \
174         $(LIBSOCKET) \
175         $(LIB_CLOCK_GETTIME) \
176         $(LIBINTL) \
177         $(SERVENT_LIB)
178
179 AM_CPPFLAGS = -I$(srcdir)/lib -Ilib
180 guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)