X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fautodist%2Fautodist.in;h=b4c1d864296bf6c3e564fb5df326995783ff2cb4;hb=HEAD;hp=e4388ab0a4fb9fbc74b1af3485e12dec28556597;hpb=72e15be581fe84afacf876dbe775a1a6cc2bbca3;p=autodist.git diff --git a/apps/autodist/autodist.in b/apps/autodist/autodist.in index e4388ab..b4c1d86 100755 --- a/apps/autodist/autodist.in +++ b/apps/autodist/autodist.in @@ -565,16 +565,19 @@ ad_process_ads() for i in $files do fname=`echo $i | sed s/\.ad//` + orig=$i ad_debug "Processing $i to be $fname" ad_log " $i into $fname" + rm -f $fname + # Run the distribution processing for this file - ad_process_file $i $fname false - if test -f $fname; then - cp -p $i $fname || exit 1 - fi + ad_process_file $orig $fname false + if test '!' -f "$fname"; then + cp -p $orig $fname || exit 1 + fi done ad_log "" @@ -833,6 +836,9 @@ ad_process_tree() \! -name \*\.[cC][pP][pP] -a \ \! -name \*\.[cC]++ -a \ \! -name \*\.m -a \ + \! -name \*\.mm -a \ + \! -name \*\.M -a \ + \! -name \*\.S -a \ \! -name \*\.[hH] -a \ \! -name \*\.hh -a \ \! -name \*\.[cC]\.in -a \ @@ -872,8 +878,9 @@ ad_process_source_tree() { ad_debug "Starting processing source files: $1" - # We take only C/C++ files since they use the C compiler friendly - # version of distdefs. Other files are not assumed to use them. + # We take only C/C++ (and other files that are run through traditional + # preprocessor) files since they use the C compiler friendly version + # of distdefs. Other files are not assumed to use them. files=`find $am_distdir -type f \! -name \*\.ad \( \ -name \*\.[cC] -o \ -name \*\.[cC][cCpP] -o \ @@ -881,6 +888,9 @@ ad_process_source_tree() -name \*\.[cC][pP][pP] -o \ -name \*\.[cC]++ -o \ -name \*\.m -o \ + -name \*\.mm -o \ + -name \*\.M -o \ + -name \*\.S -o \ -name \*\.[hH] -o \ -name \*\.hh -o \ -name \*\.[cC]\.in -o \ @@ -1186,7 +1196,7 @@ ad_parse_distribution() prereq=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \ | grep "prereq " | cut -d' ' -f2- | sort | uniq` if test '!' -z $prereq; then - if [[ $ver < $prereq ]]; then + if test "$ver" \< "$prereq"; then ad_fatal "Autodist $prereq or newer is required for distribution $1" fi fi @@ -1200,7 +1210,9 @@ ad_parse_distribution() | grep "define " | cut -d' ' -f2 | sort | uniq` if test "$inhs" = "" && test "$defs" = ""; then - ad_fatal "Distribution '$1' does not define anything" + if test "$1" != "default"; then + ad_fatal "Distribution '$1' does not define anything" + fi fi # Get undefined distdefs @@ -1371,7 +1383,9 @@ ad_process_distdefs() do echo $i >>autodist.tmp.defs done - distdefs=`sort < autodist.tmp.defs | uniq` + if test -f autodist.tmp.defs; then + distdefs=`sort < autodist.tmp.defs | uniq` + fi distdefs=`echo $distdefs` rm -f autodist.tmp.defs @@ -1534,11 +1548,11 @@ ad_process_file() fi # Get defined distribution defines - defs=`awk "/^#ifdef "$DP"_DIST_|^#else "$DP"_DIST_/ { print; }" \ + defs=`awk "/^#ifdef ${DP}_DIST_|^#else ${DP}_DIST_/ { print; }" \ $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq` # Get explicitly not-defined distribution defines - ndefs=`awk "/^#ifndef "$DP"_DIST_|^#else !"$DP"_DIST_/ { print; }" \ + ndefs=`awk "/^#ifndef ${DP}_DIST_|^#else !${DP}_DIST_/ { print; }" \ $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq` ad_debug "defs in $1: $defs" @@ -1645,11 +1659,11 @@ ad_process_source_file() fi # Get defined distribution defines - defs=`awk '/^#ifdef SILC_DIST_|^#else \/\* SILC_DIST_/ { print; }' \ + defs=`awk "/^#ifdef ${DP}_DIST_|^#else \/\* ${DP}_DIST_/ { print; }" \ $1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq` # Get explicitly not-defined distribution defines - ndefs=`awk '/^#ifndef SILC_DIST_|^#else \/\* \!SILC_DIST_/ { print; }' \ + ndefs=`awk "/^#ifndef ${DP}_DIST_|^#else \/\* \!${DP}_DIST_/ { print; }" \ $1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq` ad_debug "defs in $1: $defs" @@ -1709,7 +1723,7 @@ ad_process_source_file() # Those distdef lines that remain in the file are removed to make # the appearance prettier - echo "/^#ifdef SILC_DIST_|^#endif \/\* SILC_DIST_|^#else \/\* SILC_DIST_|^#else \/\* \!SILC_DIST_|^#ifndef SILC_DIST_/ { next; }" >> $f + echo "/^#ifdef "$DP"_DIST_|^#endif \/\* "$DP"_DIST_|^#else \/\* "$DP"_DIST_|^#else \/\* \!"$DP"_DIST_|^#ifndef "$DP"_DIST_/ { next; }" >> $f echo "{ print; }" >> $f # Execute the script @@ -1838,12 +1852,12 @@ ad_run_dist_hooks() ############################################################################### # Autodist code -usage="Usage: autodist [options] [distribution] [version] [params]" +usage="Usage: autodist [OPTIONS] [DISTRIBUTION] [VERSION] [PARAMS]" help="\ Autodist prepares source tree for configuration, compilation and -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 +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: @@ -1999,12 +2013,12 @@ ad_debug "Preparing $distribution distribution version $dist_version" # if test "$DISTDEFS"; then ad_create_distdefs_h -else - ad_fatal "DISTDEFS not defined in $distdir/autodist.conf" fi # Get extra parameters from command line -shift +if test $# != 0; then + shift +fi # # Run pre-hooks