X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fautodist%2Fautodist.in;h=8b30e67f0f5716fc2de52affe9e9f35bfee17f96;hb=afe9f62c8b03f18b1b7c29081dc63a3d306c3a8f;hp=c18051dd3a6c7eb39aa038cea7e55dc368a3dd57;hpb=34d966fec0602d007888a11aeaf8e795a3725aa5;p=autodist.git diff --git a/apps/autodist/autodist.in b/apps/autodist/autodist.in index c18051d..8b30e67 100755 --- a/apps/autodist/autodist.in +++ b/apps/autodist/autodist.in @@ -228,7 +228,7 @@ ad_initialize() # Create default distdir if test '!' -f $distdir; then - mkdir -p $distdir + mkdir -p -- $distdir fi # Create Autodist configuration file @@ -418,8 +418,8 @@ EOF # Process AD_INIT sed -e "/AD_INIT/s//AC_INIT([$distribution], [$dist_version], [$bug_report], [$package])/" $fname > $fname.tmp - # Remove AD_ENABLE_DEPENDENCIES - sed -e "/^AD_ENABLE_DEPENDENCIES/d" $fname.tmp > $fname + # Remove AD_DISABLE_DEPENDENCIES + sed -e "/^AD_DISABLE_DEPENDENCIES/d" $fname.tmp > $fname # Process for distribution rm -f $fname.tmp @@ -493,15 +493,15 @@ ad_make_makefile_ams() # ad_make_makefile_am() { - local am_deps=false + local am_deps=true local f=$1 local fname=$2 - # Enable dependencies if requested + # Disable dependencies if requested dc=`sed 's/^[ ]*//' < configure.ad | grep -v "^#" \ - | grep "AD_ENABLE_DEPENDENCIES"` - if test "$dc" = "AD_ENABLE_DEPENDENCIES"; then - am_deps=true + | grep "AD_DISABLE_DEPENDENCIES"` + if test "$dc" = "AD_DISABLE_DEPENDENCIES"; then + am_deps=false fi # Header for the Makefile.am @@ -529,11 +529,17 @@ EOF # Enable dependencies if requested if test x$am_deps = xtrue; then + # Get list of configure.ad's to get them into deps also + cfs=`find . -type f -name configure\*\.ad` + cfs=`echo $cfs | sed 's/\.\///g'` + cat >> $fname <> $f + echo "/^#ifdef $d$/,/^#else !$d$|^#endif $d$/ { next; }" >> $f else - echo "/^#else !$d/,/^#endif $d/ { next; }" >> $f + echo "/^#else !$d$/,/^#endif $d$/ { next; }" >> $f fi done @@ -1571,9 +1577,9 @@ ad_process_file() # This also handles the #ifndef's #else (ie. #ifdef) branch. if test x$found = xtrue; then ad_debug "ifndef $d will be excluded (it IS defined)" - echo "/^#ifndef $d/,/^#else $d|^#endif $d/ { next; }" >> $f + echo "/^#ifndef $d$/,/^#else $d$|^#endif $d$/ { next; }" >> $f else - echo "/^#else $d/,/^#endif $d/ { next; }" >> $f + echo "/^#else $d$/,/^#endif $d$/ { next; }" >> $f fi done @@ -1659,9 +1665,9 @@ ad_process_source_file() # This also handles the #ifdef's #else (ie. #ifndef) branch. if test x$found = xfalse; then ad_debug "ifdef $d will be excluded (it is NOT defined)" - echo "/^#ifdef $d/,/^#else \/\* \!$d|^#endif \/\* $d/ { next; }" >> $f + echo "/^#ifdef $d$/,/^#else \/\* \!$d |^#endif \/\* $d / { next; }" >> $f else - echo "/^#else \/\* \!$d/,/^#endif \/\* $d/ { next; }" >> $f + echo "/^#else \/\* \!$d /,/^#endif \/\* $d / { next; }" >> $f fi done @@ -1682,9 +1688,9 @@ ad_process_source_file() # This also handles the #ifndef's #else (ie. #ifdef) branch. if test x$found = xtrue; then ad_debug "ifndef $d will be excluded (it IS defined)" - echo "/^#ifndef $d/,/^#else \/\* $d|^#endif \/\* $d/ { next; }" >> $f + echo "/^#ifndef $d$/,/^#else \/\* $d |^#endif \/\* $d / { next; }" >> $f else - echo "/^#else \/\* $d/,/^#endif \/\* $d/ { next; }" >> $f + echo "/^#else \/\* $d /,/^#endif \/\* $d / { next; }" >> $f fi done @@ -1713,13 +1719,13 @@ ad_process_source_file() } # -# Processes a non-source file. This is the -p, --process option. +# Processes a file. This is the -p, --process option. # -# Arguments: ad_process +# Arguments: ad_process # ad_process() { - ad_debug "Starting process: $1 $2" + ad_debug "Starting process: $1 $2 $3" nolog=true @@ -1729,13 +1735,41 @@ ad_process() # Parse distribution distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1 + dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1 ad_parse_distribution $distribution false ad_process_distdefs # Process file - ad_make_makefile_am $1 $2 + case "$1" in + makefile) + if test -z $3; then + ad_fatal "File type $1 requires argument" + fi + ad_make_makefile_am $2 $3 + exit 0;; + + configure) + ad_make_configure_ac $2 + exit 0;; - ad_debug "Ending process: $1 $2" + non-source) + if test -z $3; then + ad_fatal "File type $1 requires argument" + fi + ad_process_file $2 $3 false + exit 0;; + + source) + if test -z $3; then + ad_fatal "File type $1 requires argument" + fi + ad_process_source_file $2 $3 false + exit 0;; + + *) + ad_fatal "Unknown file type: $1"; + ;; + esac } # @@ -1797,11 +1831,10 @@ ad_run_dist_hooks() usage="Usage: autodist [options] [distribution] [version]" help="\ Autodist prepares source tree for configuration, compilation and -distribution. Prepares the source tree from the \`autodist.ad' -configuration file. Generates Automake.am files from Automake.ad -files, configure.ac file from configure.ad file(s), generates the -configure script by running Autoconf tool, and generates Makefile.in -files by running Automake tool. +distribution. Generates Automake.am files from Automake.ad files, +configure.ac file from configure.ad file(s), generates the configure +script by running Autoconf tool, and generates Makefile.in files by +running Automake tool. Operation modes: -h, --help print this help, then exit @@ -1811,8 +1844,10 @@ Operation modes: -s, --distdefs [] print distribution defines of , then exit -i, --init initialize Autodist environment, create default distribution directory and distribution, then exit - -p, --process process file into for distribution, - only non-source files can be processed with -p + -p, --process [] + process file into for distribution, + is 'makefile', 'configure', 'non-source' + or 'source' and defines the type of -m, --makedist create and package distribution --gzip create package compressed with gzip (default) --bzip2 create also package compressed with bzip2 @@ -1857,8 +1892,8 @@ while test $# -gt 0; do -p | --process) shift; - if test $# -eq 2; then - ad_process $1 $2 + if test $# -ge 2; then + ad_process $1 $2 $3 else echo "${usage}" 1>&2; fi