+ -I$(top_srcdir)/src -I$(top_builddir)/src \
+ -I$(top_srcdir)/fish -I$(top_builddir)/fish \
+ -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
+ -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
+ $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
+ $(WARN_CFLAGS) $(WERROR_CFLAGS)
+
+guestfish_LDADD = \
+ $(LIBVIRT_LIBS) $(LIBXML2_LIBS) \
+ $(top_builddir)/src/libguestfs.la $(LIBREADLINE) -lm
+
+# Make libguestfs use the convenience library.
+noinst_LTLIBRARIES = librc_protocol.la
+guestfish_LDADD += librc_protocol.la ../gnulib/lib/libgnu.la
+
+if HAVE_RPCGEN
+rc_protocol.c: rc_protocol.x
+ rm -f $@-t $@-t2
+ $(RPCGEN) -c -o $@-t $<
+ sed 's,\.\./\.\./fish/,,' < $@-t > $@-t2
+ rm $@-t
+ mv $@-t2 $@
+
+rc_protocol.h: rc_protocol.x
+ rm -f $@-t
+ $(RPCGEN) -h -o $@-t $<
+ mv $@-t $@
+endif
+
+# Build a partly-static library (for the binary distribution).
+
+guestfish.static$(EXEEXT): $(guestfish_OBJECTS) $(guestfish_DEPENDENCIES)
+ $(top_srcdir)/relink-static.sh \
+ $(guestfish_LINK) $(guestfish_OBJECTS) -static $(guestfish_LDADD) $(guestfish_LIBS) -ltinfo -lpcre -lhivex -lmagic -lz -lm
+
+# Manual page.
+# guestfish-actions.pod and guestfish-commands.pod are autogenerated.
+# There is no include mechanism for POD, so we have to do it by hand.
+
+man_MANS = guestfish.1
+
+guestfish.1: guestfish.pod guestfish-actions.pod guestfish-commands.pod
+ sed \
+ -e '/@ACTIONS@/rguestfish-actions.pod' -e 's/@ACTIONS@//' \
+ -e '/@FISH_COMMANDS@/rguestfish-commands.pod' -e 's/@FISH_COMMANDS@//' \
+ < $< | \
+ $(POD2MAN) \
+ --section 1 \
+ -c "Virtualization Support" \
+ --name "guestfish" \
+ --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
+ > $@
+
+# Bash completion script.
+
+bashcompletiondir = $(sysconfdir)/bash_completion.d
+bashcompletion_DATA = guestfish-bash-completion.sh