- if [ -n "${removing}" ] ; then
-# if [ -n "${objdir}" ] ; then
-# echo '***' --rm not supported for --objdir. Just \"rm -rf ${objdir}\" by hand.
-# exit 1
-# fi
-
-# if [ -n "${subdirs}" ] ; then
-# if [ -d "${subdirname}" ] ; then
-# rm -rf ${hostsubdir}
-# else
-# echo Warning: no ${PWD}/${hostsubdir} to remove.
-# fi
-# else
- rm -f ${Makefile} config.status ${links}
-# fi
- else
-# if [ -n "${objdir}" ]; then
-# srcdir=${PWD}
-# cd ${objdir}
-# fi
-
-# if [ -n "${subdirs}" ] ; then
-# # check for existing status before allowing forced subdirs.
-# if [ -f ${Makefile} ] ; then
-# echo '***' "${Makefile} already exists in source directory. ${PWD} not configured." 1>&2
-# exit 1
-# fi
-#
-# # use a subdir common to all targets for this host iff: this is a cross AND
-# # this tool does not claim to be target dependent AND we have not been asked to name the subdir.
-# if [ ${host_alias} != ${target_alias} -a -z "${target_dependent}" -a -z "${namesubdiroption}" ]
-# then
-# if [ ! -d H-${host_alias} ] ; then mkdir H-${host_alias} ; fi
-#
-# if (${symbolic_link} ${subdirname} H-${host_alias} 2> /dev/null) ; then
-# true
-# else # just give up. they lose.
-# rmdir H-${host_alias}
-# if [ ! -d ${subdirname} ] ; then mkdir ${subdirname} ; fi
-# fi
-# elif [ ! -d ${subdirname} ] ; then
-# mkdir ${subdirname}
-# fi
-#
-# cd ${subdirname}
-#
-# if [ -z "${srcdir}" ] ; then
-# srcdir=..
-# fi
-# elif [ "`echo H-*`" != "H-*" -a "`echo X-*`" != "X-*" ] ; then
-# # if not subdir builds, then make sure none exist.
-# # We might miss if there are explicitly named subdirs.
-# echo '***' "Configured subdirs exist. ${PWD} not configured." 1>&2
-# exit 1
-# else
-# true
-# fi
-
- # Find the source files, if location was not specified.
- if [ -z "${srcdir}" ] ; then
- srcdirdefaulted=1
- srcdir=.
- if [ ! -r ${srctrigger} ] ; then
- srcdir=..
- fi
- fi
-
- if [ ! -r ${srcdir}/${srctrigger} ] ; then
- if [ -z "${srcdirdefaulted}" ] ; then
- echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2
- else
- echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2
- fi
-
- echo '***' \(At least ${srctrigger} is missing.\) 1>&2
- exit 1
- fi
-
- # Set up the list of links to be made.
- # ${links} is the list of link names, and ${files} is the list of names to link to.
-
- # Make the links.
- while [ -n "${files}" ] ; do
- # set file to car of files, files to cdr of files
- set ${files}; file=$1; shift; files=$*
- set ${links}; link=$1; shift; links=$*
-
- if [ ! -r ${srcdir}/${file} ] ; then
- echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
- echo '***' "since the file \"${file}\" does not exist." 1>&2
- exit 1
- fi
-
- ${remove} -f ${link}
- rm -f config.status
- # Make a symlink if possible, otherwise try a hard link
- ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
-
- if [ ! -r ${link} ] ; then
- echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
- exit 1
- fi
-
- if [ -n "${verbose}" ] ; then
- echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
- fi
- done
-
- # Create a .gdbinit file which runs the one in srcdir
- # and tells GDB to look there for source files.
-
- if [ -r ${srcdir}/.gdbinit ] ; then
- case ${srcdir} in
- .)
- ;;
- *)
- echo "# "${NO_EDIT} > .gdbinit
- echo "dir ." >> .gdbinit
- echo "dir ${srcdir}" >> .gdbinit
- echo "source ${srcdir}/.gdbinit" >> .gdbinit
- ;;
- esac
- fi
-
- # Install a makefile, and make it set VPATH
- # if necessary so that the sources are found.
- # Also change its value of srcdir.
-
- # FIXME-someday: This business of always writing to .tem and mv back
- # is so that I don't screw things up while developing. Once this
- # template is stable, these should be optimized. xoxorich.
-
- # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
- if [ "${host}" != "${target}" ] ; then
- echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
- echo "ALL=all.cross" >> ${Makefile}
- else
- echo "ALL=all.internal" > ${Makefile}
- fi
-
- # set target, host, VPATH
- echo "host_alias = ${host_alias}" >> ${Makefile}
- echo "host_cpu = ${host_cpu}" >> ${Makefile}
- echo "host_vendor = ${host_vendor}" >> ${Makefile}
- echo "host_os = ${host_os}" >> ${Makefile}
- echo "version_path = ${version_path}" >> ${Makefile}
- echo "target_alias = ${target_alias}" >> ${Makefile}
- echo "target_cpu = ${target_cpu}" >> ${Makefile}
- echo "target_vendor = ${target_vendor}" >> ${Makefile}
- echo "target_os = ${target_os}" >> ${Makefile}
-
-# if [ -n "${subdirs}" ] ; then
-# (echo "subdir = /${subdirname}" ;
-# echo "unsubdir = ..") >> ${Makefile}
-# else
- (echo "subdir =" ;
- echo "unsubdir = .") >> ${Makefile}
-# fi
-
- # echo "workdir = ${PWD}" >> ${Makefile}
- echo "VPATH = ${srcdir}" >> ${Makefile}
-
- # add "Makefile.in" (or whatever it's called)
- cat ${srcdir}/${Makefile_in} >> ${Makefile}
-
- # Conditionalize the makefile for this site.
- if [ -n "${site}" ] ; then
- site_makefile_frag=config/ms-${site}
-
- if [ -f ${srcdir}/${site_makefile_frag} ] ; then
- (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ;
- sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem
- else
- (echo "site_makefile_frag =" ;
- cat ${Makefile}) > Makefile.tem
- fi
- mv Makefile.tem ${Makefile}
- fi
-
- # Conditionalize the makefile for this host.
- if [ -f ${srcdir}/${host_makefile_frag} ] ; then
- (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
- sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
- else
- (echo "host_makefile_frag =" ;
- cat ${Makefile}) > Makefile.tem
- fi
- mv Makefile.tem ${Makefile}
-
- # Conditionalize the makefile for this target.
- if [ -f ${srcdir}/${target_makefile_frag} ] ; then
- (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
- sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
- else
- (echo "target_makefile_frag =" ;
- cat ${Makefile}) > Makefile.tem
- fi
- mv Makefile.tem ${Makefile}
-
- # set srcdir
- sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
-
- # set prefix
- if [ -n "${prefix}" ] ; then
- sed "s:^prefix =.*$:prefix = ${prefix}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
- fi
-
- # set datadir
- if [ -n "${datadir}" ] ; then
- sed "s:^datadir =.*$:datadir = ${datadir}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
- fi
-
- # reset SUBDIRS
- sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
-
- # reset NONSUBDIRS
- sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
-
- # remove any form feeds.
- sed -e "s/\f//" ${Makefile} > Makefile.tem
- mv Makefile.tem ${Makefile}
-
- # prepend warning about editting.
- echo "# "${NO_EDIT} > ${Makefile}.tem
- cat ${Makefile} >> ${Makefile}.tem
- mv Makefile.tem ${Makefile}