From 7554158b42c89fcadedd019c360df30e152ef85e Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Fri, 5 Feb 2010 23:21:55 +0000 Subject: [PATCH] final fixes to addsourcedir source-directory-Makefile-generation script --- contrib/addsourcedir | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/contrib/addsourcedir b/contrib/addsourcedir index 9a50b0025..ee507f0c6 100644 --- a/contrib/addsourcedir +++ b/contrib/addsourcedir @@ -28,7 +28,7 @@ while [ $# -gt 0 ]; do # remove redundant slashes, if any srcdir=`echo "$srcdir" | sed 's,//*,/,g'` - if expr "$srcdir" : src/ &>/dev/null; then :; else + if expr "$srcdir" : src/ >/dev/null; then :; else echo "$progname: error: Directories must be under src/" >&2 echo "$progname: error: and \`$srcdir' isn't!" >&2 echo "$progname: error: Make sure you provide source paths" >&2 @@ -41,11 +41,16 @@ while [ $# -gt 0 ]; do mkdir -p "$srcdir" fi + # enough dotdots to get us back to the top-level directory + # (e.g. "src/foo" yields "../.." here), used for $(topdir) in Makefile + topdir=`echo "$srcdir" | sed 's,[^/]\+,..,g'` + # one less, used for the include path in Makefile.am + topsrcdir=`echo "$topdir" | sed 's,\.\./,,'` + if [ -e "$srcdir/Makefile" ]; then echo "$progname: warning: not replacing extant \`$srcdir/Makefile'." >&2 else echo "generating \`$srcdir/Makefile'..." - topdir=`echo "$srcdir" | sed 's,[^/]\+,..,g'` cat >"$srcdir/Makefile" </dev/null; then - definitions=" -D__BUILDING_CVC4PARSERLIB \\" - elif expr "$srcdir" : src/main &>/dev/null; then + if expr "$srcdir" : src/parser >/dev/null; then + definitions=" -D__BUILDING_CVC4PARSERLIB \\ +" + visibility=" -fvisibility=hidden" + elif expr "$srcdir" : src/main >/dev/null; then definitions= + visibility= else - definitions=" -D__BUILDING_CVC4LIB \\" + definitions=" -D__BUILDING_CVC4LIB \\ +" + visibility=" -fvisibility=hidden" fi clibname="lib${clibbase}.la" clibtarget="lib${clibbase}_la" cat >"$srcdir/Makefile.am" <