diff --git a/tools/tools/tcl_bmake/mkMakefile.sh b/tools/tools/tcl_bmake/mkMakefile.sh new file mode 100644 index 000000000000..6072df71dfea --- /dev/null +++ b/tools/tools/tcl_bmake/mkMakefile.sh @@ -0,0 +1,145 @@ +: +# $Id$ +# +# This script generates a bmake Makefile for src/lib/libtcl +# + +set -ex + +# SETME: what versions the shared library should have. +SHLIB_MAJOR=75 +SHLIB_MINOR=0 + +# SETME: where is the tcl stuff relative to this script +SRCDIR=../../../contrib/tcl + +# SETME: where is the tcl stuff relative to src/lib/libtcl +LIBTCL=../../../lib/libtcl/ + +mkdir -p ${LIBTCL} + +(cd ${SRCDIR}/unix ; sh configure --enable-shared) || true + +echo "include ${SRCDIR}/unix/Makefile" > m.x +echo ' +foo: + @echo ${OBJS} +bar: + @echo ${AC_FLAGS} +' >> m.x + +# Put a RCS Id in the file, but not the one from this file :-) +echo -n '# $' > ${LIBTCL}Makefile +echo -n 'Id' >> ${LIBTCL}Makefile +echo '$' >> ${LIBTCL}Makefile + +# Tell 'em ! +echo '# This file is generated automatically, think twice!' >> ${LIBTCL}Makefile +echo '# Please change src/tools/tools/tcl_bmake/mkMakefile.sh instead' >> ${LIBTCL}Makefile +echo '# Generated by version $Id$ of src/tools/tools/tcl_bmake/mkMakefile.sh' >> ${LIBTCL}Makefile +echo >> ${LIBTCL}Makefile + +# Tell make(1) to pick up stuff from here +echo 'TCLDIST=${.CURDIR}/../../contrib/tcl' >> ${LIBTCL}Makefile +echo >> ${LIBTCL}Makefile +echo '.PATH: ${TCLDIST}/generic' >> ${LIBTCL}Makefile +echo '.PATH: ${TCLDIST}/unix' >> ${LIBTCL}Makefile + +# Tell cpp(1) to pick up stuff from here +echo 'CFLAGS+= -I${TCLDIST}/generic' >> ${LIBTCL}Makefile +echo 'CFLAGS+= -I${TCLDIST}/unix' >> ${LIBTCL}Makefile + +# Pick up some more global info +echo "TCL_LIBRARY= /usr/libdata/tcl" >> ${LIBTCL}Makefile +echo "SHLIB_MAJOR= ${SHLIB_MAJOR}" >> ${LIBTCL}Makefile +echo "SHLIB_MINOR= ${SHLIB_MINOR}" >> ${LIBTCL}Makefile + +# Set the name of the library +echo 'LIB= tcl' >> ${LIBTCL}Makefile + +echo >> ${LIBTCL}Makefile + +# some needed CFLAGS +echo "CFLAGS+=" `make -f m.x bar` >> ${LIBTCL}Makefile + +# some more needed CFLAGS +echo "CFLAGS+= -DTCL_LIBRARY=\\\"\${TCL_LIBRARY}\\\"" >> ${LIBTCL}Makefile + +echo >> ${LIBTCL}Makefile + +# The sources +make -f m.x foo | fmt 60 65 | sed ' +s/^/ / +s/$/ \\/ +s/\.o/.c/g +1s/ /SRCS= / +$s/ \\$// +' >> ${LIBTCL}Makefile + +echo >> ${LIBTCL}Makefile + +echo ' +beforeinstall: ${TCLDIST}/generic/tcl.h tcl.macros + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $> \ + ${DESTDIR}/usr/include + -mkdir -p ${DESTDIR}/${TCL_LIBRARY} + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${TCLDIST}/library/[a-z]* ${DESTDIR}/${TCL_LIBRARY} + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + ${TCLDIST}/unix/tclAppInit.c ${DESTDIR}/${TCL_LIBRARY} + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ + tcl.macros ${DESTDIR}/usr/share/tmac/tcl.macros + +tcl.macros: ${TCLDIST}/doc/man.macros + cp $> $@ + +' >> ${LIBTCL}Makefile + +# The (n) manpages +for i in ${SRCDIR}/doc/*.n +do + basename $i .n | awk ' + { + print "" + print $1 ".n: ${TCLDIST}/doc/" B ".n" + print "\tsed \"/\.so *man.macros/s;.*;.so /usr/share/tmac/tcl.macros;\" < \$> > \$@" + print "" + print "MANn+= " $1 ".n " + } + ' F=$i B=`basename $i .n` >> ${LIBTCL}Makefile +done + +echo >> ${LIBTCL}Makefile + +# The (3) manpages +for i in ${SRCDIR}/doc/*.3 +do + sed ' + 1,/^.SH NAME/d + /^.SH SYNOPSIS/,$d + s/,//g + ' $i | sed -n ' + 1s/\\-.*//p + ' | awk ' + { + print "" + print $1 ".3: ${TCLDIST}/doc/" B ".3" + print "\tsed \"/\.so *man.macros/s;.*;.so /usr/share/tmac/tcl.macros;\" < \$> > \$@" + print "" + print "MAN3+= " $1 ".3 " + for (i = 2 ; i <= NF ; i++) + print "MLINKS+= " $1 ".3 " $i ".3 " + } + ' F=$i B=`basename $i .3` >> ${LIBTCL}Makefile +done + +echo ' + +CLEANFILES= ${MAN3} ${MANn} tcl.macros + +.include +' >> ${LIBTCL}Makefile + +rm -f m.x ${SRCDIR}/unix/config.log ${SRCDIR}/unix/Makefile ${SRCDIR}/unix/config.cache ${SRCDIR}/unix/config.status ${SRCDIR}/unix/tclConfig.sh + +