30f246da6f776d73ca5b14c954a55408162a45f6
[libguestfs.git] / fish / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009-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 include $(top_srcdir)/subdir-rules.mk
19
20 CLEANFILES = \
21         stamp-guestfish.pod \
22         stamp-virt-copy-in.pod \
23         stamp-virt-copy-out.pod \
24         stamp-virt-tar-in.pod \
25         stamp-virt-tar-out.pod
26
27 bin_PROGRAMS = guestfish
28
29 generator_built = \
30         cmds.c \
31         cmds_gperf.gperf \
32         completion.c \
33         guestfish-actions.pod \
34         guestfish-commands.pod \
35         prepopts.h \
36         prepopts.c
37
38 BUILT_SOURCES = \
39         $(generator_built) \
40         cmds_gperf.c \
41         rc_protocol.h \
42         rc_protocol.c
43
44 EXTRA_DIST = \
45         $(BUILT_SOURCES) \
46         rc_protocol.x \
47         guestfish.pod \
48         guestfish-bash-completion.sh
49
50 # These source files (all related to option parsing) are shared
51 # between guestfish and guestmount.  Keep a convenient list here just
52 # so we know which ones are shared.  These files must not include
53 # other guestfish files.
54 SHARED_SOURCE_FILES = \
55         inspect.c \
56         keys.c \
57         options.h \
58         options.c \
59         virt.c
60
61 guestfish_SOURCES = \
62         $(generator_built) \
63         $(SHARED_SOURCE_FILES) \
64         alloc.c \
65         cmds_gperf.h \
66         copy.c \
67         destpaths.c \
68         echo.c \
69         edit.c \
70         fish.c \
71         fish.h \
72         glob.c \
73         help.c \
74         hexedit.c \
75         lcd.c \
76         man.c \
77         more.c \
78         prep.c \
79         prep_disk.c \
80         prep_part.c \
81         prep_fs.c \
82         prep_lv.c \
83         prep_boot.c \
84         progress.c \
85         rc.c \
86         reopen.c \
87         rmsd.h \
88         supported.c \
89         tilde.c \
90         time.c
91
92 # This convenience library is solely to compile its generated sources with
93 # custom flags.
94 librc_protocol_la_SOURCES = rc_protocol.c rc_protocol.h
95 librc_protocol_la_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
96
97 # Build the command lookup perfect hash code.  The generated code has
98 # lots of warnings so we must compile it in a separate mini-library.
99 libcmds_la_SOURCES = cmds_gperf.c
100 libcmds_la_CFLAGS =
101
102 cmds_gperf.c: cmds_gperf.gperf
103         rm -f $@
104         $(GPERF) -t $< > $@-t
105         mv $@-t $@
106
107 guestfish_CFLAGS = \
108         -I$(top_srcdir)/src -I$(top_builddir)/src \
109         -I$(top_srcdir)/fish -I$(top_builddir)/fish \
110         -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
111         -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
112         -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
113         $(WARN_CFLAGS) $(WERROR_CFLAGS)
114
115 guestfish_LDADD = \
116         $(top_builddir)/src/libguestfs.la $(LIBREADLINE) -lm
117
118 # Make guestfish use the convenience libraries.
119 noinst_LTLIBRARIES = libcmds.la librc_protocol.la
120 guestfish_LDADD += libcmds.la librc_protocol.la ../gnulib/lib/libgnu.la
121
122 if HAVE_RPCGEN
123 rc_protocol.c: rc_protocol.x
124         rm -f $@-t $@-t2
125         $(RPCGEN) -c -o $@-t $<
126         sed 's,\.\./\.\./fish/,,' < $@-t > $@-t2
127         rm $@-t
128         mv $@-t2 $@
129
130 rc_protocol.h: rc_protocol.x
131         rm -f $@-t
132         $(RPCGEN) -h -o $@-t $<
133         mv $@-t $@
134 endif
135
136 # Manual page.
137
138 man_MANS = guestfish.1
139 noinst_DATA = $(top_builddir)/html/guestfish.1.html
140
141 guestfish.1 $(top_builddir)/html/guestfish.1.html: stamp-guestfish.pod
142
143 stamp-guestfish.pod: guestfish.pod guestfish-actions.pod guestfish-commands.pod
144         $(top_srcdir)/podwrapper.sh \
145           --man guestfish.1 \
146           --html $(top_builddir)/html/guestfish.1.html \
147           --insert guestfish-actions.pod:@ACTIONS@ \
148           --insert guestfish-commands.pod:@FISH_COMMANDS@ \
149           $<
150         touch $@
151
152 # Bash completion script.
153
154 bashcompletiondir = $(sysconfdir)/bash_completion.d
155 bashcompletion_DATA = guestfish-bash-completion.sh