1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#!/bin/sh
#This script is used to re-create the Makefile.am using ccbuild
# and then run allt the necessary autotools. Configure.in should
# be edited separately.
#
# This file is part of ccbuild.
# ccbuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ccbuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with ccbuild. If not, see <http://www.gnu.org/licenses/>.
if [ "x$1" = "xclean" ]; then
echo Cleaning
make distclean
rm -f configure Makefile.in depcomp missing Makefile.am aclocal.m4 install-sh
rm -rf autom4te.cache
exit
fi
## Generate Makefile.am from ccbuild
PSOURCE=src/ccbuild.cc
PNAME=`basename "${PSOURCE}" .cc`
echo "Generating Makefile.am from ccbuild"
which ccbuild && (ccbuild md5 --recursive-include . "${PSOURCE}" > MD5SUMS)
SOURCES=`sed -r 's/^[a-z0-9]+ //; s/ /\\ /' < MD5SUMS | tr '\n' ' '`
export VERSION=`egrep -o 'VERSION=.+"[0-9.]+' src/ccResolutions |cut -d '"' -f 2`
#Write CMakeLists.txt
cat > CMakeLists.txt <<EOF
cmake_minimum_required (VERSION 2.6)
project (ccbuild)
add_definitions(-DVERSION="${VERSION}")
link_libraries(libgcrypt gomp bobcat openssl)
add_definitions(-std=c++11 -fopenmp)
add_executable(ccbuild ${SOURCES})
EOF
#Overwrite Makefile.am
cat > Makefile.am <<EOF
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = ${PNAME}
#Sources, generated list from ccbuild md5 output
${PNAME}_SOURCES = ${SOURCES}
${PNAME}_CXXFLAGS = \${DEPS_CFLAGS} \${BOOST_CPPFLAGS} -DNODEBUG -fopenmp -std=c++11
${PNAME}_LDADD = \${DEPS_LIBS} \${BOOST_LDFLAGS} -lbobcat -lgomp -lgnutls-openssl
man_MANS = doc/${PNAME}/${PNAME}.1
#Flex it!
src/sourceScanner/yylex.cc: src/sourceScanner/lexer
\${LEX} \$<
mv yylex.cc \$@
EOF
echo "Running autotools:"
##BOOTSTRAP
echo " aclocal"
aclocal --force -I m4 #Sometimes nice to have: -I /usr/share/autoconf-archive
echo " autoconf"
autoconf --force
echo " automake"
automake --add-missing --copy
|