- # 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 "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}" >> ${Makefile}
-# echo "unsubdir = .." >> ${Makefile}
-# else
- echo "subdir =" >> ${Makefile}
- 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}" > Makefile.tem
- sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile} >> Makefile.tem
- else
- echo "site_makefile_frag =" > Makefile.tem
- 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}" > Makefile.tem
- sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile} >> Makefile.tem
- else
- echo "host_makefile_frag =" > Makefile.tem
- 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}" > Makefile.tem
- sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile} >> Makefile.tem
- else
- echo "target_makefile_frag =" > Makefile.tem
- 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}