]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: separate out userspace only files
authorDave Chinner <dchinner@redhat.com>
Wed, 17 Dec 2014 02:45:36 +0000 (13:45 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 17 Dec 2014 02:45:36 +0000 (13:45 +1100)
To make checking that libxfs is identical between the kernel and
userspace code bases, lift all the userspace-only libxfs files into
a "support" subdirectory and build them there. Also, move all the
"kernel equivalent" XFS header files (e.g. include/xfs_mount.h) into
the support directory as well. This provides a clean separation of
libxfs from both kernel-specific and userspace-specific code bases,
and allows us to easily identify dependencies that must be fulfilled
for the libxfs code to work in userspace.

To make this work effectively, we have to enable sub-directory build
awareness in automake and slightly tweak the build rules to enable
libxfs/support to be built using the libxfs/Makefile.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
28 files changed:
configure.ac
include/Makefile
include/buildrules
libxfs/Makefile
libxfs/support/cache.c [moved from libxfs/cache.c with 100% similarity]
libxfs/support/crc32.c [moved from libxfs/crc32.c with 100% similarity]
libxfs/support/crc32defs.h [moved from libxfs/crc32defs.h with 100% similarity]
libxfs/support/darwin.c [moved from libxfs/darwin.c with 100% similarity]
libxfs/support/freebsd.c [moved from libxfs/freebsd.c with 100% similarity]
libxfs/support/gen_crc32table.c [moved from libxfs/gen_crc32table.c with 100% similarity]
libxfs/support/init.c [moved from libxfs/init.c with 100% similarity]
libxfs/support/init.h [moved from libxfs/init.h with 100% similarity]
libxfs/support/irix.c [moved from libxfs/irix.c with 100% similarity]
libxfs/support/kmem.c [moved from libxfs/kmem.c with 100% similarity]
libxfs/support/libxfs_io.h [moved from libxfs/libxfs_io.h with 100% similarity]
libxfs/support/linux.c [moved from libxfs/linux.c with 100% similarity]
libxfs/support/logitem.c [moved from libxfs/logitem.c with 100% similarity]
libxfs/support/radix-tree.c [moved from libxfs/radix-tree.c with 100% similarity]
libxfs/support/rdwr.c [moved from libxfs/rdwr.c with 100% similarity]
libxfs/support/trans.c [moved from libxfs/trans.c with 100% similarity]
libxfs/support/util.c [moved from libxfs/util.c with 100% similarity]
libxfs/support/xfs.h [moved from libxfs/xfs.h with 100% similarity]
libxfs/support/xfs_arch.h [moved from include/xfs_arch.h with 100% similarity]
libxfs/support/xfs_btree_trace.h [moved from include/xfs_btree_trace.h with 100% similarity]
libxfs/support/xfs_inode.h [moved from include/xfs_inode.h with 100% similarity]
libxfs/support/xfs_mount.h [moved from include/xfs_mount.h with 100% similarity]
libxfs/support/xfs_trace.h [moved from include/xfs_trace.h with 100% similarity]
libxfs/support/xfs_trans.h [moved from include/xfs_trans.h with 100% similarity]

index ae17c68d52829e65261bbeb677da969911cbce4f..3977ec7db58d5c204af6b9af9895895d82dded1e 100644 (file)
@@ -1,4 +1,5 @@
 AC_INIT([xfsprogs], [3.2.0-alpha2])
+AM_INIT_AUTOMAKE([subdir-objects])
 AC_PREREQ(2.50)
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
index 70e43a05be08d12c092fe7ba683bd865ffda39dd..937502eb70ddaeb40869ccce5ae66d7d76946955 100644 (file)
@@ -21,14 +21,8 @@ include $(TOPDIR)/include/builddefs
 QAHFILES = libxfs.h libxlog.h \
        atomic.h bitops.h cache.h kmem.h list.h hlist.h parent.h radix-tree.h \
        swab.h \
-       xfs_arch.h \
-       xfs_btree_trace.h \
-       xfs_inode.h \
        xfs_log_recover.h \
-       xfs_metadump.h \
-       xfs_mount.h \
-       xfs_trace.h \
-       xfs_trans.h
+       xfs_metadump.h
 
 HFILES = handle.h jdm.h xqm.h xfs.h
 HFILES += $(PKG_PLATFORM).h
index dbd9e10a7045ffe08b2fb5d206e583c9e1993c27..6fe0930eb26e7f21906a17566f71294fa25b320c 100644 (file)
@@ -40,11 +40,11 @@ $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
 
 %.lo: %.c
        @echo "    [CC]     $@"
-       $(Q)$(LTCOMPILE) -c $<
+       $(Q)$(LTCOMPILE) -c $< -o $@
 else
 %.o: %.c
        @echo "    [CC]     $@"
-       $(Q)$(CC) $(CFLAGS) -c $<
+       $(Q)$(CC) $(CFLAGS) -c $< -o $@
 
 endif
 
index 51b98ec6736c0daf4174d765582eea888b524890..95c33fc0045396a3a1c9cff6632907d9094ce36e 100644 (file)
@@ -15,14 +15,25 @@ PKGHFILES = xfs_fs.h \
        xfs_types.h
 
 # headers with build dependencies
-HFILES = xfs.h \
+SHFILES = xfs.h \
        init.h \
        crc32defs.h \
-       crc32table.h \
-       xfs_dir2_priv.h \
+       crc32table.h
+
+HFILES = $(addprefix support/, $(SHFILES)) \
+       xfs_dir2_priv.h
 
 # headers installed in QA targets
-QAHFILES = xfs_alloc.h \
+SQAHFILES = libxfs_io.h \
+       xfs_arch.h \
+       xfs_btree_trace.h \
+       xfs_inode.h \
+       xfs_mount.h \
+       xfs_trace.h \
+       xfs_trans.h
+
+QAHFILES = $(addprefix support/, $(SQAHFILES)) \
+       xfs_alloc.h \
        xfs_alloc_btree.h \
        xfs_attr_leaf.h \
        xfs_attr_sf.h \
@@ -46,11 +57,19 @@ QAHFILES = xfs_alloc.h \
        xfs_shared.h \
        xfs_trans_resv.h \
        xfs_trans_space.h \
-       libxfs_io.h
 
-CFILES = cache.c \
+# supporting C files
+SCFILES = cache.c \
        crc32.c \
-       init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \
+       init.c \
+       kmem.c \
+       logitem.c \
+       radix-tree.c \
+       rdwr.c \
+       trans.c \
+       util.c
+
+CFILES = $(addprefix support/, $(SCFILES)) \
        xfs_alloc.c \
        xfs_alloc_btree.c \
        xfs_attr.c \
@@ -78,10 +97,12 @@ CFILES = cache.c \
        xfs_symlink_remote.c \
        xfs_trans_resv.c
 
-CFILES += $(PKG_PLATFORM).c
-PCFILES = darwin.c freebsd.c irix.c linux.c
-LSRCFILES = $(shell echo $(PCFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
-LSRCFILES += gen_crc32table.c
+CFILES += $(addprefix support/, $(PKG_PLATFORM).c)
+
+SPCFILES = darwin.c freebsd.c irix.c linux.c
+SLSRCFILES = $(shell echo $(SPCFILES) | sed -e "s/$(PKG_PLATFORM).c//g")
+SLSRCFILES += gen_crc32table.c
+LSRCFILES = $(addprefix support/, $(SLSRCFILES))
 
 #
 # Tracing flags:
@@ -92,39 +113,39 @@ LSRCFILES += gen_crc32table.c
 #
 #LCFLAGS +=
 
-FCFLAGS = -I.
+FCFLAGS = -I. -Isupport
 
 LTLIBS = $(LIBPTHREAD) $(LIBRT)
 
 # don't try linking xfs_repair with a debug libxfs.
 DEBUG = -DNDEBUG
 
-LDIRT = gen_crc32table crc32table.h crc32selftest
+LDIRT = $(addprefix support/, gen_crc32table crc32table.h crc32selftest)
+
+default: xfs support/crc32selftest ltdepend $(LTLIBRARY)
+
+# set up include/xfs header directory
+xfs: $(addsuffix -hdrs, $(PKGHFILES) $(QAHFILES))
 
-default: xfs crc32selftest ltdepend $(LTLIBRARY)
+%-hdrs:
+       $(Q)$(LN_S) -f $(PWD)/libxfs/$* $(TOPDIR)/include/xfs/$(notdir $*)
 
-crc32table.h: gen_crc32table.c
-       @echo "    [CC]     gen_crc32table"
-       $(Q) $(CC) $(CFLAGS) -o gen_crc32table $<
+support/crc32table.h: support/gen_crc32table.c
+       @echo "    [CC]     support/gen_crc32table"
+       $(Q) $(CC) $(CFLAGS) -o support/gen_crc32table $<
        @echo "    [GENERATE] $@"
-       $(Q) ./gen_crc32table > crc32table.h
+       $(Q) support/gen_crc32table > support/crc32table.h
 
 # The selftest binary will return an error if it fails. This is made a
 # dependency of the build process so that we refuse to build the tools on broken
 # systems/architectures. Hence we make sure that xfsprogs will never use a
 # busted CRC calculation at build time and hence avoid putting bad CRCs down on
 # disk.
-crc32selftest: gen_crc32table.c crc32table.h crc32.c
+support/crc32selftest: $(addprefix support/, gen_crc32table.c crc32table.h crc32.c)
        @echo "    [TEST]    CRC32"
-       $(Q) $(CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+       $(Q) $(CC) $(CFLAGS) -D CRC32_SELFTEST=1 support/crc32.c -o $@
        $(Q) ./$@
 
-# set up include/xfs header directory
-xfs: $(addsuffix -hdrs, $(PKGHFILES) $(QAHFILES))
-
-%-hdrs:
-       $(Q)$(LN_S) -f $(PWD)/libxfs/$* $(TOPDIR)/include/xfs/$*
-
 include $(BUILDRULES)
 
 install: default
similarity index 100%
rename from libxfs/cache.c
rename to libxfs/support/cache.c
similarity index 100%
rename from libxfs/crc32.c
rename to libxfs/support/crc32.c
similarity index 100%
rename from libxfs/darwin.c
rename to libxfs/support/darwin.c
similarity index 100%
rename from libxfs/freebsd.c
rename to libxfs/support/freebsd.c
similarity index 100%
rename from libxfs/init.c
rename to libxfs/support/init.c
similarity index 100%
rename from libxfs/init.h
rename to libxfs/support/init.h
similarity index 100%
rename from libxfs/irix.c
rename to libxfs/support/irix.c
similarity index 100%
rename from libxfs/kmem.c
rename to libxfs/support/kmem.c
similarity index 100%
rename from libxfs/linux.c
rename to libxfs/support/linux.c
similarity index 100%
rename from libxfs/logitem.c
rename to libxfs/support/logitem.c
similarity index 100%
rename from libxfs/rdwr.c
rename to libxfs/support/rdwr.c
similarity index 100%
rename from libxfs/trans.c
rename to libxfs/support/trans.c
similarity index 100%
rename from libxfs/util.c
rename to libxfs/support/util.c
similarity index 100%
rename from libxfs/xfs.h
rename to libxfs/support/xfs.h
similarity index 100%
rename from include/xfs_arch.h
rename to libxfs/support/xfs_arch.h