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 ""
\! -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 \
-name \*\.mm -o \
-name \*\.M -o \
-name \*\.S -o \
- -name \*\.F -o \
- -name \*\.F90 -o \
- -name \*\.F95 -o \
- -name \*\.[fF][pP][pP] -o \
-name \*\.[hH] -o \
-name \*\.hh -o \
-name \*\.[cC]\.in -o \
| 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
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
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"
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"
# 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
###############################################################################
# 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,
#
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