Skip to content

Commit

Permalink
Support custom build directories and move includes
Browse files Browse the repository at this point in the history
One of the neat tricks an autoconf style project is capable of
is allow configurion/building in a directory other than the
source directory.  The major advantage to this is that you can
build the project various different ways while making changes
in a single source tree.

For example, this project is designed to work on various different
Linux distributions each of which work slightly differently.  This
means that changes need to verified on each of those supported
distributions perferably before the change is committed to the
public git repo.

Using nfs and custom build directories makes this much easier.
I now have a single source tree in nfs mounted on several different
systems each running a supported distribution.  When I make a
change to the source base I suspect may break things I can
concurrently build from the same source on all the systems each
in their own subdirectory.

wget -c http://github.com/downloads/behlendorf/zfs/zfs-x.y.z.tar.gz
tar -xzf zfs-x.y.z.tar.gz
cd zfs-x-y-z

------------------------- run concurrently ----------------------
<ubuntu system>  <fedora system>  <debian system>  <rhel6 system>
mkdir ubuntu     mkdir fedora     mkdir debian     mkdir rhel6
cd ubuntu        cd fedora        cd debian        cd rhel6
../configure     ../configure     ../configure     ../configure
make             make             make             make
make check       make check       make check       make check

This change also moves many of the include headers from individual
incude/sys directories under the modules directory in to a single
top level include directory.  This has the advantage of making
the build rules cleaner and logically it makes a bit more sense.
  • Loading branch information
behlendorf committed Sep 8, 2010
1 parent 5e61214 commit 6283f55
Show file tree
Hide file tree
Showing 188 changed files with 10,643 additions and 2,454 deletions.
10 changes: 5 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
include $(top_srcdir)/config/rpm.am
include ${top_srcdir}/config/deb.am
include ${top_srcdir}/config/tgz.am
include $(top_srcdir)/config/deb.am
include $(top_srcdir)/config/tgz.am

if CONFIG_USER
USER_DIR = config etc man scripts lib cmd
USER_DIR = etc man scripts lib cmd
endif
if CONFIG_KERNEL
KERNEL_DIR = module
endif
SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
SUBDIRS = $(USER_DIR) $(KERNEL_DIR) include

AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh zfs.spec.in zfs-modules.spec.in
Expand All @@ -34,7 +34,7 @@ if CONFIG_KERNEL
install-data-local:
destname=zfs-$(ZFS_META_VERSION)/$(LINUX_VERSION); \
instdest=$(DESTDIR)/usr/src/$$destname; \
echo "${ZFS_META_VERSION}" >$$instdest/zfs.release; \
echo "$(ZFS_META_VERSION)" >$$instdest/zfs.release; \
for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
$(INSTALL) -D $$instfile $$instdest/$$instfile; \
done
Expand Down
99 changes: 82 additions & 17 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(am__configure_deps) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/zfs-modules.spec.in $(srcdir)/zfs.spec.in \
$(srcdir)/zfs_config.h.in $(top_srcdir)/config/rpm.am \
$(srcdir)/zfs-modules.spec.in \
$(srcdir)/zfs-script-config.sh.in $(srcdir)/zfs.spec.in \
$(srcdir)/zfs_config.h.in $(top_srcdir)/config/deb.am \
$(top_srcdir)/config/rpm.am $(top_srcdir)/config/tgz.am \
$(top_srcdir)/configure $(top_srcdir)/module/Makefile.in \
$(top_srcdir)/module/avl/Makefile.in \
$(top_srcdir)/module/nvpair/Makefile.in \
$(top_srcdir)/module/unicode/Makefile.in \
$(top_srcdir)/module/zcommon/Makefile.in \
$(top_srcdir)/module/zfs/Makefile.in \
$(top_srcdir)/module/zpios/Makefile.in AUTHORS COPYING \
ChangeLog
ChangeLog config/config.guess config/config.sub config/depcomp \
config/install-sh config/ltmain.sh config/missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
Expand Down Expand Up @@ -88,7 +91,8 @@ CONFIG_HEADER = zfs_config.h
CONFIG_CLEAN_FILES = module/Makefile module/avl/Makefile \
module/nvpair/Makefile module/unicode/Makefile \
module/zcommon/Makefile module/zfs/Makefile \
module/zpios/Makefile zfs.spec zfs-modules.spec
module/zpios/Makefile zfs.spec zfs-modules.spec \
zfs-script-config.sh
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
Expand All @@ -113,7 +117,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = config etc man scripts lib cmd module
DIST_SUBDIRS = etc man scripts lib cmd module include
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down Expand Up @@ -160,14 +164,12 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILDDIR = @BUILDDIR@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CMDDIR = @CMDDIR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
Expand Down Expand Up @@ -205,7 +207,6 @@ KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBDIR = @LIBDIR@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
Expand All @@ -220,7 +221,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MODDIR = @MODDIR@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
Expand All @@ -239,7 +239,6 @@ RPM = @RPM@
RPMBUILD = @RPMBUILD@
RPMBUILD_VERSION = @RPMBUILD_VERSION@
RPM_VERSION = @RPM_VERSION@
SCRIPTDIR = @SCRIPTDIR@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
Expand All @@ -249,7 +248,6 @@ SPL_SYMBOLS = @SPL_SYMBOLS@
SPL_VERSION = @SPL_VERSION@
STRIP = @STRIP@
TARGET_ASM_DIR = @TARGET_ASM_DIR@
TOPDIR = @TOPDIR@
VENDOR = @VENDOR@
VERSION = @VERSION@
ZFS_CONFIG = @ZFS_CONFIG@
Expand Down Expand Up @@ -320,9 +318,9 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@CONFIG_USER_TRUE@USER_DIR = config etc man scripts lib cmd
@CONFIG_USER_TRUE@USER_DIR = etc man scripts lib cmd
@CONFIG_KERNEL_TRUE@KERNEL_DIR = module
SUBDIRS = $(USER_DIR) $(KERNEL_DIR)
SUBDIRS = $(USER_DIR) $(KERNEL_DIR) include
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh zfs.spec.in zfs-modules.spec.in \
config/config.awk config/rpm.am config/deb.am config/tgz.am \
Expand All @@ -335,7 +333,7 @@ all: zfs_config.h
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/rpm.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/rpm.am $(top_srcdir)/config/deb.am $(top_srcdir)/config/tgz.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
Expand Down Expand Up @@ -402,6 +400,8 @@ zfs.spec: $(top_builddir)/config.status $(srcdir)/zfs.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
zfs-modules.spec: $(top_builddir)/config.status $(srcdir)/zfs-modules.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
zfs-script-config.sh: $(top_builddir)/config.status $(srcdir)/zfs-script-config.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $@

mostlyclean-libtool:
-rm -f *.lo
Expand Down Expand Up @@ -914,8 +914,73 @@ rpm-common:
--nodeps --rebuild $$rpmpkg || exit 1; \
cp $$rpmbuild/RPMS/*/* . || exit 1; \
$(RM) -R $$rpmbuild
include ${top_srcdir}/config/deb.am
include ${top_srcdir}/config/tgz.am
deb-local:
@(if test "${HAVE_DPKGBUILD}" = "no"; then \
echo -e "\n" \
"*** Required util ${DPKGBUILD} missing. Please install the\n" \
"*** package for your distribution which provides ${DPKGBUILD},\n" \
"*** re-run configure, and try again.\n"; \
exit 1; \
fi; \
if test "${HAVE_ALIEN}" = "no"; then \
echo -e "\n" \
"*** Required util ${ALIEN} missing. Please install the\n" \
"*** package for your distribution which provides ${ALIEN},\n" \
"*** re-run configure, and try again.\n"; \
exit 1; \
fi)

deb-modules: deb-local rpm-modules
name=${PACKAGE}-modules; \
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2

deb-utils: deb-local rpm-utils
name=${PACKAGE}; \
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3

deb: deb-modules deb-utils
tgz-local:
@(if test "${HAVE_ALIEN}" = "no"; then \
echo -e "\n" \
"*** Required util ${ALIEN} missing. Please install the\n" \
"*** package for your distribution which provides ${ALIEN},\n" \
"*** re-run configure, and try again.\n"; \
exit 1; \
fi)

tgz-modules: tgz-local rpm-modules
name=${PACKAGE}-modules; \
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2

tgz-utils: tgz-local rpm-utils
name=${PACKAGE}; \
version=${ZFS_META_VERSION}-${ZFS_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch}`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}.$${arch}.rpm; \
pkg3=$${name}-test-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \
$(RM) $$pkg1 $$pkg2 $$pkg3

tgz: tgz-modules tgz-utils

distclean-local::
-$(RM) -R autom4te*.cache
Expand All @@ -932,7 +997,7 @@ distclean-local::
@CONFIG_KERNEL_TRUE@install-data-local:
@CONFIG_KERNEL_TRUE@ destname=zfs-$(ZFS_META_VERSION)/$(LINUX_VERSION); \
@CONFIG_KERNEL_TRUE@ instdest=$(DESTDIR)/usr/src/$$destname; \
@CONFIG_KERNEL_TRUE@ echo "${ZFS_META_VERSION}" >$$instdest/zfs.release; \
@CONFIG_KERNEL_TRUE@ echo "$(ZFS_META_VERSION)" >$$instdest/zfs.release; \
@CONFIG_KERNEL_TRUE@ for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
@CONFIG_KERNEL_TRUE@ $(INSTALL) -D $$instfile $$instdest/$$instfile; \
@CONFIG_KERNEL_TRUE@ done
Expand Down
6 changes: 0 additions & 6 deletions cmd/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,12 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILDDIR = @BUILDDIR@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CMDDIR = @CMDDIR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
Expand Down Expand Up @@ -177,7 +175,6 @@ KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBDIR = @LIBDIR@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
Expand All @@ -192,7 +189,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MODDIR = @MODDIR@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
Expand All @@ -211,7 +207,6 @@ RPM = @RPM@
RPMBUILD = @RPMBUILD@
RPMBUILD_VERSION = @RPMBUILD_VERSION@
RPM_VERSION = @RPM_VERSION@
SCRIPTDIR = @SCRIPTDIR@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
Expand All @@ -221,7 +216,6 @@ SPL_SYMBOLS = @SPL_SYMBOLS@
SPL_VERSION = @SPL_VERSION@
STRIP = @STRIP@
TARGET_ASM_DIR = @TARGET_ASM_DIR@
TOPDIR = @TOPDIR@
VENDOR = @VENDOR@
VERSION = @VERSION@
ZFS_CONFIG = @ZFS_CONFIG@
Expand Down
16 changes: 4 additions & 12 deletions cmd/zdb/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
include $(top_srcdir)/config/Rules.am

DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libzpool/include \
-I${top_srcdir}/lib/libnvpair/include \
-I${top_srcdir}/lib/libzfs/include \
-I${top_srcdir}/module/zfs/include \
-I${top_srcdir}/module/zcommon/include \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/module/unicode/include
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include

sbin_PROGRAMS = zdb

zdb_SOURCES = \
${top_srcdir}/cmd/zdb/zdb.c \
${top_srcdir}/cmd/zdb/zdb_il.c
$(top_srcdir)/cmd/zdb/zdb.c \
$(top_srcdir)/cmd/zdb/zdb_il.c

zdb_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
Expand Down
Loading

0 comments on commit 6283f55

Please sign in to comment.