# Create default distdir
if test '!' -f $distdir; then
- mkdir -p $distdir
+ mkdir -p -- $distdir
fi
# Create Autodist configuration file
# 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 <<EOF
# S_AD_ENABLE_DEPENDENCIES
\$(srcdir)/Makefile.am: Makefile.ad
- cd \$(top_srcdir) && autodist -p \$(subdir)/Makefile.ad \$(subdir)/Makefile.am && cd \$(subdir)
+ cd \$(top_srcdir) && autodist -p makefile \$(subdir)/Makefile.ad \$(subdir)/Makefile.am && cd \$(subdir)
+\$(srcdir)/configure.ac: $cfs
+ cd \$(top_srcdir) && autodist -p configure \$(top_srcdir)/configure.ad && cd \$(subdir)
# E_AD_ENABLE_DEPENDENCIES
EOF
fi
d=`echo $src | sed 's,/[^/]*$,,'`
if test "$d" != "$src" && test "$d" != "." && \
test '!' -d $am_distdir/$d; then
- mkdir -p $am_distdir/$d || exit 1
+ mkdir -p -- $am_distdir/$d || exit 1
fi
else
# Add to different location
d=`echo $dst | sed 's,/[^/]*$,,'`
if test "$d" != "$dst" && test "$d" != "." && \
test '!' -d $am_distdir/$d; then
- mkdir -p $am_distdir/$d || exit 1
+ mkdir -p -- $am_distdir/$d || exit 1
fi
fi
d=""
fi
if test '!' -d $am_distdir/$d && test "$ds" != "$d"; then
- mkdir -p $am_distdir/$d || exit 1
+ mkdir -p -- $am_distdir/$d || exit 1
fi
if test x$3 = xtrue; then
d=`echo $d | sed 's,/[^/]*$,,'`
fi
if test '!' -d $am_distdir/$d && test "$dst" != "$d"; then
- mkdir -p $am_distdir/$d || exit 1
+ mkdir -p -- $am_distdir/$d || exit 1
fi
if test x$3 = xtrue; then
do
ad_debug "Excluding $i"
if test x$2 = xtrue; then
- ad_log " $1"
+ ad_log " $i"
fi
rm -rf $i
done
f="$cur/autodist__noprocess"
rm -rf $f
- mkdir -p $f || exit 1
+ mkdir -p -- $f || exit 1
# First, include them to new location with correct directory structure.
old_am_distdir="$am_distdir"
}
#
-# Processes a non-source file. This is the -p, --process option.
+# Processes a file. This is the -p, --process option.
#
-# Arguments: ad_process <src> <dst>
+# Arguments: ad_process <type> <src> <dst>
#
ad_process()
{
- ad_debug "Starting process: $1 $2"
+ ad_debug "Starting process: $1 $2 $3"
nolog=true
# 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 <dst> 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 <dst> argument"
+ fi
+ ad_process_file $2 $3 false
+ exit 0;;
+
+ source)
+ if test -z $3; then
+ ad_fatal "File type $1 requires <dst> argument"
+ fi
+ ad_process_source_file $2 $3 false
+ exit 0;;
+
+ *)
+ ad_fatal "Unknown file type: $1";
+ ;;
+ esac
}
#
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
-s, --distdefs [<dist>] print distribution defines of <dist>, then exit
-i, --init initialize Autodist environment, create default
distribution directory and distribution, then exit
- -p, --process <src> <dst> process file <src> into <dst> for distribution,
- only non-source files can be processed with -p
+ -p, --process <type> <src> [<dst>]
+ process file <src> into <dst> for distribution,
+ <type> is 'makefile', 'configure', 'non-source'
+ or 'source' and defines the type of <src>
-m, --makedist create and package distribution
--gzip create package compressed with gzip (default)
--bzip2 create also package compressed with bzip2
-s | --distdefs)
shift;
+ nolog=true
if test $# -eq 0; then
ad_parse_distribution $distribution false
echo "Distribution: ${distribution}" 1>&2;
-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