more build stuff

This commit is contained in:
Joe Thornber 2011-12-09 12:54:51 +00:00
parent 1735982eb5
commit b4e678b42e
5 changed files with 3306 additions and 33 deletions

View File

@ -31,11 +31,16 @@ PROGRAM_SOURCE=\
thin_repair.cc \
thin_restore.cc
CXX=g++
OBJECTS=$(subst .cc,.o,$(SOURCE))
TOP_DIR:=$(PWD)
CPPFLAGS=-Wall -g -I$(TOP_DIR) -O8
#CPPFLAGS=-Wall -std=c++0x -g -I$(TOP_DIR)
TOP_DIR:=@top_srcdir@
CXXFLAGS=-Wall -I$(TOP_DIR)
CXXFLAGS+=@CXXOPTIMISE_FLAG@
CXXFLAGS+=@CXXDEBUG_FLAG@
LIBS=-lstdc++ -lboost_program_options -lexpat
INSTALL=@INSTALL@
INSTALL_PROGRAM=$(INSTALL) -m 555
BINDIR=@prefix@/bin
.PHONEY: test-programs
@ -44,27 +49,41 @@ test-programs: $(TEST_PROGRAMS)
.SUFFIXES: .cc .o .d
%.d: %.cc
g++ -MM -MT $(subst .cc,.o,$<) $(CPPFLAGS) $< > $@.$$$$; \
$(CXX) -MM -MT $(subst .cc,.o,$<) $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
.cc.o:
g++ -c $(CPPFLAGS) $(INCLUDES) -o $@ $<
$(CXX) -c $(CXXFLAGS) $(INCLUDES) -o $@ $<
thin_dump: $(OBJECTS) thin_dump.o
g++ $(CPPFLAGS) -o $@ $+ $(LIBS)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
thin_restore: $(OBJECTS) thin_restore.o
g++ $(CPPFLAGS) -o $@ $+ $(LIBS)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
thin_repair: $(OBJECTS) thin_repair.o
g++ $(CPPFLAGS) -o $@ $+ $(LIBS)
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
.PHONEY: clean
clean:
rm -f *.o unit-tests/*.o $(TEST_PROGRAMS) $(PROGRAMS)
include unit-tests/Makefile.in
.PHONEY: install
install: $(PROGRAMS)
$(INSTALL_PROGRAM) -D thin_repair $(BINDIR)/thin_repair
$(INSTALL_PROGRAM) -D thin_dump $(BINDIR)/thin_dump
$(INSTALL_PROGRAM) -D thin_restore $(BINDIR)/thin_restore
.PHONEY: release
release:
include $(subst .cc,.d,$(SOURCE))
include $(subst .cc,.d,$(TEST_SOURCE))
include $(subst .cc,.d,$(PROGRAM_SOURCE))
ifeq ("$(TESTING)", "yes")
include unit-tests/Makefile.in
endif

1501
autoconf/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1705
autoconf/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -28,44 +28,57 @@ AC_CONFIG_HEADERS([configure.h])
################################################################################
dnl -- Setup the directory where autoconf has auxilary files
AC_CONFIG_AUX_DIR(autoconf)
AC_CANONICAL_TARGET([])
AC_PROG_CXX([g++])
AC_LANG(C++)
################################################################
dnl -- Checks for programs.
AC_PROG_SED
AC_PROG_AWK
AC_PROG_CXX([g++])
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
################################################################
dnl -- Check for header files.
AC_CHECK_HEADERS(expat.h)
AC_CHECK_HEADERS(boost/shared_ptr.hpp)
AC_PROG_INSTALL
################################################################################
dnl -- Prefix is /usr by default, the exec_prefix default is setup later
AC_PREFIX_DEFAULT(/usr)
AC_CHECK_HEADERS([expat.h \
iostream \
boost/bind.hpp \
boost/crc.hpp \
boost/intrusive/circular_list_algorithms.hpp \
boost/intrusive/rbtree_algorithms.hpp \
boost/lexical_cast.hpp \
boost/noncopyable.hpp \
boost/optional.hpp \
boost/program_options.hpp \
boost/shared_ptr.hpp \
boost/static_assert.hpp],
[], [AC_MSG_ERROR(bailing out)])
################################################################################
dnl -- Setup the ownership of the files
AC_MSG_CHECKING(file owner)
AC_ARG_WITH(user,
AC_HELP_STRING([--with-user=USER],
[set the owner of installed files [[USER=]]]),
OWNER=$withval)
[set the owner of installed files [[USER=]]]),
OWNER=$withval)
AC_MSG_RESULT($OWNER)
if test x$OWNER != x; then
INSTALL="$INSTALL -o $OWNER"
INSTALL="$INSTALL -o $OWNER"
fi
################################################################################
dnl -- Setup the group ownership of the files
AC_MSG_CHECKING(group owner)
AC_ARG_WITH(group,
AC_HELP_STRING([--with-group=GROUP],
[set the group owner of installed files [[GROUP=]]]),
GROUP=$withval)
AC_HELP_STRING([--with-group=GROUP],
[set the group owner of installed files [[GROUP=]]]),
GROUP=$withval)
AC_MSG_RESULT($GROUP)
if test x$GROUP != x; then
@ -79,20 +92,24 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debugging]),
DEBUG=$enableval, DEBUG=no)
AC_MSG_RESULT($DEBUG)
dnl -- Normally turn off optimisation for debug builds
if test x$DEBUG = xyes; then
COPTIMISE_FLAG=
CXXDEBUG_FLAG=-g
fi
################################################################################
dnl -- Override optimisation
AC_MSG_CHECKING(for C++ optimisation flag)
CXXOPTIMISE_FLAG="-O8"
AC_ARG_WITH(optimisation,
AC_HELP_STRING([--with-optimisation=OPT],
[C++ optimisation flag [[OPT=-O2]]]),
[C++ optimisation flag [[OPT=-O8]]]),
CXXOPTIMISE_FLAG=$withval)
AC_MSG_RESULT($CXXOPTIMISE_FLAG)
if test x$CXXOPTIMISE_FLAG = xyes; then
CXXOPTIMISE_FLAG=-O8
fi
################################################################################
dnl -- Enable testing
AC_MSG_CHECKING(whether to enable unit testing)
@ -114,16 +131,23 @@ dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))
################################################################################
dnl VERSION="\"`cat "$srcdir"/VERSION 2>/dev/null || echo Unknown`\""
VERSION="\"`cat "$srcdir"/VERSION 2>/dev/null || echo Unknown`\""
dnl VER=`cat "$srcdir"/VERSION`
dnl RELEASE_DATE="\"`echo $VER | $SED 's/.* (//;s/).*//'`\""
dnl VER=`echo "$VER" | $AWK '{print $1}'`
dnl RELEASE="\"`echo "$VER" | $AWK -F '-' '{print $2}'`\""
dnl VER=`echo "$VER" | $AWK -F '-' '{print $1}'`
dnl VERSION_MAJOR=`echo "$VER" | $AWK -F '.' '{print $1}'`
dnl VERSION_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'`
dnl VERSION_PATCHLEVEL=`echo "$VER" | $AWK -F '[[(.]]' '{print $3}'`
VER=`cat "$srcdir"/VERSION`
RELEASE_DATE="\"`echo $VER | $SED 's/.* (//;s/).*//'`\""
VER=`echo "$VER" | $AWK '{print $1}'`
RELEASE="\"`echo "$VER" | $AWK -F '-' '{print $2}'`\""
VER=`echo "$VER" | $AWK -F '-' '{print $1}'`
VERSION_MAJOR=`echo "$VER" | $AWK -F '.' '{print $1}'`
VERSION_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'`
VERSION_PATCHLEVEL=`echo "$VER" | $AWK -F '[[(.]]' '{print $3}'`
################################################################
AC_SUBST(CXXDEBUG_FLAG)
AC_SUBST(CXXOPTIMISE_FLAG)
AC_SUBST(INSTALL)
AC_SUBST(prefix)
AC_SUBST(RELEASE_DATE)
################################################################################
dnl -- First and last lines should not contain files to generate in order to

24
mk_release Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
orig_dir=$(pwd)
# usage: mk_release <git tag>
tag=$1
echo "creating release tarball for tag '"$tag"'"
tmp=$(mktemp -d)
dir=$tmp/thin-provisioning-tools-$tag
mkdir $dir
git clone . $dir
cd $dir
git checkout $tag
rm -rf .git
cd $tmp
tar jcvf $orig_dir/thin-provisioning-tools-$tag.tar.bz2 thin-provisioning-tools-$tag
cd $orig_dir
rm -rf $tmp