Create a new libfishcommon convenience static library to build just once
(instead of 12 times!) the majority of the guestfish sources used in the
rest of the C tools (mostly for command line stuff, inspection, and
mount).
The notable exceptions not using libfishcommon are guestfish itself, and
virt-rescue: both need to build at least one of the common sources using
additional CPPFLAGS.
---
align/Makefile.am | 13 ++-----------
cat/Makefile.am | 14 ++++----------
df/Makefile.am | 14 +-------------
diff/Makefile.am | 13 ++-----------
edit/Makefile.am | 11 +----------
fish/Makefile.am | 33 ++++++++++++++++++++++++++++-----
format/Makefile.am | 14 +-------------
fuse/Makefile.am | 13 ++-----------
inspector/Makefile.am | 14 +-------------
make-fs/Makefile.am | 10 +---------
10 files changed, 43 insertions(+), 106 deletions(-)
diff --git a/align/Makefile.am b/align/Makefile.am
index 13f8812..8cf7e5c 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -31,17 +31,7 @@ SHARED_SOURCE_FILES = \
../df/estimate-max-threads.c \
../df/estimate-max-threads.h \
../df/parallel.c \
- ../df/parallel.h \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
+ ../df/parallel.h
virt_alignment_scan_SOURCES = \
$(SHARED_SOURCE_FILES) \
@@ -64,6 +54,7 @@ virt_alignment_scan_CFLAGS = \
virt_alignment_scan_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/cat/Makefile.am b/cat/Makefile.am
index 5e55742..796e808 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -31,16 +31,6 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-cat virt-filesystems virt-log virt-ls
SHARED_SOURCE_FILES = \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c \
../fish/windows.h \
../fish/windows.c
@@ -62,6 +52,7 @@ virt_cat_CFLAGS = \
virt_cat_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
@@ -85,6 +76,7 @@ virt_filesystems_CFLAGS = \
virt_filesystems_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
@@ -108,6 +100,7 @@ virt_log_CFLAGS = \
virt_log_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
@@ -133,6 +126,7 @@ virt_ls_CFLAGS = \
virt_ls_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/df/Makefile.am b/df/Makefile.am
index f4a8602..0735a8c 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -26,20 +26,7 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-df
-SHARED_SOURCE_FILES = \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
-
virt_df_SOURCES = \
- $(SHARED_SOURCE_FILES) \
virt-df.h \
domains.c \
domains.h \
@@ -67,6 +54,7 @@ virt_df_CFLAGS = \
virt_df_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/diff/Makefile.am b/diff/Makefile.am
index 7dfe2cd..921cf23 100644
--- a/diff/Makefile.am
+++ b/diff/Makefile.am
@@ -26,17 +26,7 @@ bin_PROGRAMS = virt-diff
SHARED_SOURCE_FILES = \
../cat/visit.h \
- ../cat/visit.c \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
+ ../cat/visit.c
virt_diff_SOURCES = \
$(SHARED_SOURCE_FILES) \
@@ -56,6 +46,7 @@ virt_diff_CFLAGS = \
virt_diff_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/edit/Makefile.am b/edit/Makefile.am
index 48ad52f..cac9e6a 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -25,18 +25,8 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-edit
SHARED_SOURCE_FILES = \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
../fish/file-edit.h \
../fish/file-edit.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c \
../fish/windows.h \
../fish/windows.c
@@ -58,6 +48,7 @@ virt_edit_CFLAGS = \
virt_edit_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/fish/Makefile.am b/fish/Makefile.am
index 8fdcd27..924de1f 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -71,8 +71,7 @@ EXTRA_DIST = \
# between guestfish, guestmount and some other virt tools. Keep a
# convenient list here just so we know which ones are shared. These
# files must not include other guestfish files.
-SHARED_SOURCE_FILES = \
- config.c \
+FISHCOMMON_SOURCE_FILES = \
decrypt.c \
display-options.h \
display-options.c \
@@ -81,11 +80,35 @@ SHARED_SOURCE_FILES = \
keys.c \
options.h \
options.c \
- progress.h \
- progress.c \
uri.h \
uri.c
+SHARED_SOURCE_FILES = \
+ $(FISHCOMMON_SOURCE_FILES) \
+ config.c \
+ progress.h \
+ progress.c
+
+# libfishcommon.la contains guestfish code which is used in other
+# C tools. Note this convenience static library is *not* used in
+# guestfish, as the sources are built with extra defines
+# (e.g. -DCOMPILING_GUESTFISH) in that case.
+libfishcommon_la_SOURCES = \
+ $(FISHCOMMON_SOURCE_FILES)
+libfishcommon_la_CPPFLAGS = \
+ -DGUESTFS_WARN_DEPRECATED=1 \
+ -I$(top_srcdir)/src -I$(top_builddir)/src \
+ -I$(top_srcdir)/fish -I$(top_builddir)/fish \
+ -I$(srcdir)/../gnulib/lib -I../gnulib/lib
+libfishcommon_la_CFLAGS = \
+ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
+ $(LIBXML2_CFLAGS)
+libfishcommon_la_LIBADD = \
+ $(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/src/libutils.la \
+ $(LIBXML2_LIBS) \
+ $(LTLIBINTL)
+
guestfish_SOURCES = \
$(generator_built) \
$(SHARED_SOURCE_FILES) \
@@ -159,7 +182,7 @@ guestfish_LDADD = \
-lm
# Make guestfish use the convenience libraries.
-noinst_LTLIBRARIES = libcmds.la librc_protocol.la
+noinst_LTLIBRARIES = libcmds.la librc_protocol.la libfishcommon.la
guestfish_LDADD += libcmds.la librc_protocol.la ../gnulib/lib/libgnu.la
if HAVE_RPCGEN
diff --git a/format/Makefile.am b/format/Makefile.am
index 6c22beb..6eabd8a 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -24,20 +24,7 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-format
-SHARED_SOURCE_FILES = \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
-
virt_format_SOURCES = \
- $(SHARED_SOURCE_FILES) \
format.c
virt_format_CPPFLAGS = \
@@ -55,6 +42,7 @@ virt_format_CFLAGS = \
virt_format_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index b8f5ad6..9db0215 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -33,17 +33,7 @@ bin_PROGRAMS = \
# These source files (all related to option parsing) are shared
# between guestfish and guestmount.
SHARED_SOURCE_FILES = \
- ../fish/config.c \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
+ ../fish/config.c
# guestmount
@@ -69,6 +59,7 @@ guestmount_LDADD = \
$(LIBCONFIG_LIBS) \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index fe7bdab..275bc7c 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -52,20 +52,7 @@ dist_doc_DATA = \
bin_PROGRAMS = virt-inspector
-SHARED_SOURCE_FILES = \
- ../fish/decrypt.c \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/inspect.c \
- ../fish/keys.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.h \
- ../fish/uri.c
-
virt_inspector_SOURCES = \
- $(SHARED_SOURCE_FILES) \
inspector.c
virt_inspector_CPPFLAGS = \
@@ -82,6 +69,7 @@ virt_inspector_CFLAGS = \
virt_inspector_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LIBVIRT_LIBS) \
$(LTLIBINTL) \
diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am
index f4cf0f1..719bc51 100644
--- a/make-fs/Makefile.am
+++ b/make-fs/Makefile.am
@@ -24,16 +24,7 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-make-fs
-SHARED_SOURCE_FILES = \
- ../fish/display-options.h \
- ../fish/display-options.c \
- ../fish/domain.c \
- ../fish/options.h \
- ../fish/options.c \
- ../fish/uri.c
-
virt_make_fs_SOURCES = \
- $(SHARED_SOURCE_FILES) \
make-fs.c
virt_make_fs_CPPFLAGS = \
@@ -50,6 +41,7 @@ virt_make_fs_CFLAGS = \
virt_make_fs_LDADD = \
$(top_builddir)/src/libutils.la \
$(top_builddir)/src/libguestfs.la \
+ $(top_builddir)/fish/libfishcommon.la \
$(LIBXML2_LIBS) \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
--
2.7.4