daemon: debug segv correct use of dereferencing NULL.
[libguestfs.git] / daemon / Makefile.am
1 # libguestfs-daemon
2 # Copyright (C) 2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 include $(top_srcdir)/subdir-rules.mk
19
20 libsrcdir = $(top_builddir)/src
21
22 generator_built = \
23         actions.h \
24         stubs.c \
25         names.c
26
27 BUILT_SOURCES = \
28         $(generator_built) \
29         guestfs_protocol.c \
30         guestfs_protocol.h \
31         errnostring_gperf.c \
32         errnostring_gperf.gperf \
33         errnostring.c \
34         errnostring.h
35
36 EXTRA_DIST = $(BUILT_SOURCES)
37
38 noinst_LIBRARIES = libprotocol.a
39
40 # This convenience library is solely to compile its generated sources with
41 # custom flags.
42 libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h
43 libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
44
45 guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
46         rm -f $@
47         ln $< $@
48 guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
49         rm -f $@
50         ln $< $@
51 $(libsrcdir)/guestfs_protocol.c: force
52         $(MAKE) -C $(libsrcdir) guestfs_protocol.c
53 $(libsrcdir)/guestfs_protocol.h: force
54         $(MAKE) -C $(libsrcdir) guestfs_protocol.h
55
56 # Build the errnostring perfect hash code.  The generated code has lots
57 # of warnings so we must compile it in a separate mini-library.
58 noinst_LIBRARIES += liberrnostring.a
59 liberrnostring_a_SOURCES = \
60         errnostring_gperf.c \
61         errnostring.h \
62         errnostring.c
63 liberrnostring_a_CFLAGS =
64
65 errnostring_gperf.c: errnostring_gperf.gperf
66         rm -f $@
67         $(GPERF) -t $< > $@-t
68         mv $@-t $@
69 errnostring_gperf.gperf: $(libsrcdir)/errnostring_gperf.gperf
70         rm -f $@
71         ln $< $@
72 errnostring.c: $(libsrcdir)/errnostring.c
73         rm -f $@
74         ln $< $@
75 errnostring.h: $(libsrcdir)/errnostring.h
76         rm -f $@
77         ln $< $@
78
79 if INSTALL_DAEMON
80 sbin_PROGRAMS = guestfsd
81 else
82 noinst_PROGRAMS = guestfsd
83 endif
84
85 guestfsd_SOURCES = \
86         9p.c \
87         actions.h \
88         available.c \
89         augeas.c \
90         base64.c \
91         blkid.c \
92         blockdev.c \
93         btrfs.c \
94         checksum.c \
95         cmp.c \
96         command.c \
97         compress.c \
98         copy.c \
99         cpmv.c \
100         daemon.h \
101         dd.c \
102         debug.c \
103         devsparts.c \
104         df.c \
105         dir.c \
106         dmesg.c \
107         dropcaches.c \
108         du.c \
109         echo_daemon.c \
110         ext2.c \
111         fallocate.c \
112         file.c \
113         findfs.c \
114         fill.c \
115         find.c \
116         fsck.c \
117         glob.c \
118         grep.c \
119         grub.c \
120         guestfsd.c \
121         headtail.c \
122         hexdump.c \
123         htonl.c \
124         initrd.c \
125         inotify.c \
126         is.c \
127         link.c \
128         ls.c \
129         luks.c \
130         lvm.c \
131         lvm-filter.c \
132         md.c \
133         mkfs.c \
134         mknod.c \
135         modprobe.c \
136         mount.c \
137         names.c \
138         ntfs.c \
139         optgroups.c \
140         optgroups.h \
141         parted.c \
142         pingdaemon.c \
143         proto.c \
144         readdir.c \
145         realpath.c \
146         scrub.c \
147         selinux.c \
148         sfdisk.c \
149         sleep.c \
150         stat.c \
151         statvfs.c \
152         strings.c \
153         stubs.c \
154         swap.c \
155         sync.c \
156         tar.c \
157         truncate.c \
158         umask.c \
159         upload.c \
160         utimens.c \
161         wc.c \
162         xattr.c \
163         zero.c \
164         zerofree.c
165 guestfsd_LDADD = \
166         liberrnostring.a \
167         libprotocol.a \
168         $(SELINUX_LIB) \
169         $(AUGEAS_LIBS) \
170         $(top_builddir)/gnulib/lib/.libs/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 guestfsd_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
180 guestfsd_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(AUGEAS_CFLAGS)
181
182 .PHONY: force