#
# rcsid $Header: /usr/cvsroot/magic/tcltk/Makefile,v 1.1 2005/02/11 17:31:52 tim Exp $
#

MODULE   = tcltk
MAGICDIR = ..
SRCS = tclmagic.c

include ${MAGICDIR}/defs.mak

DFLAGS += -DMAGIC_VERSION="\"`${SCRIPTS}/version`\"" \
	-DMAGIC_REVISION="\"`${SCRIPTS}/revision`\"" \
	-DMAGIC_DATE="\"`date`\""
CLEANS += magic.sh magic.tcl magicexec

TCL_FILES = \
	${TCLDIR}/tkcon.tcl \
	${TCLDIR}/tkshell.tcl \
	${TCLDIR}/wrapper.tcl \
	${TCLDIR}/console.tcl \
	${TCLDIR}/techbuilder.tcl \
	${TCLDIR}/padlist.tcl \
	${TCLDIR}/tools.tcl \
	${TCLDIR}/magic.tcl

tcl-main: magicexec magic.tcl magic.sh

install-tcl: magicexec ${BINDIR}/magic.sh ${TCL_FILES}
	${RM} ${TCLDIR}/magicexec
	${CP} magicexec ${TCLDIR}/magicexec

magicexec: magicexec.c
	${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} magicexec.c -o magicexec \
		${LIBS} ${LIB_SPECS}

magic.tcl: magic.tcl.in
	sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g  \
            -e /SHDLIB_EXT/s%SHDLIB_EXT%${SHDLIB_EXT}%g magic.tcl.in > magic.tcl

magic.sh: magic.sh.in
	sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g magic.sh.in > magic.sh

${TCLDIR}/%: %
	${RM} ${TCLDIR}/$*
	${CP} $* ${TCLDIR}/$*

${BINDIR}/magic.sh: magic.sh
	${RM} ${BINDIR}/magic.sh ${BINDIR}/magic
	${CP} magic.sh ${BINDIR}/magic
	(cd ${BINDIR}; chmod 0755 magic)

include ${MAGICDIR}/rules.mak
