#
# src/Makefile.in  --
#
# Makefile for Extended Tcl C sources. 
# 
#------------------------------------------------------------------------------
# Copyright 1992-1993 Karl Lehenbauer and Mark Diekhans.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies.  Karl Lehenbauer and
# Mark Diekhans make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without express or
# implied warranty.
#------------------------------------------------------------------------------
# $Id: Makefile.in,v 3.1 1993/11/25 03:21:14 markd Exp $
#------------------------------------------------------------------------------
#
SHELL = /bin/sh

#------------------------------------------------------------------------------
# Autoconfig defines that can be overridden in Config.mk

CC          = gcc
RANLIB      = ranlib
MCS         = touch
srcdir      = .
srcbasedir  = /src/tcl/tclx7.3a
bldbasedir  = /src/tcl/tclx7.3a
VPATH       = .
prefix      = /usr/local
exec_prefix = /usr/local
ARCH        = 
LIBS        =  -lm

#------------------------------------------------------------------------------
# Include user-editable defines.

include ../config.mk

#------------------------------------------------------------------------------

LIBTCL.A      = ../../tcl7.3/libtcl.a
LIBTCLX.A     = libtclx.a
TCL           = tcl.exe
APPINIT       = tclXAppInit.c

LDLIBS = ${LIBTCLX.A} ${LIBTCL.A} ${LIBS}
CPPFLAGS =

CC_FLAGS = ${CPPFLAGS} ${XCFLAGS} ${CFLAGS} -I${srcbasedir}/src \
           -I${bldbasedir}/src -I${TCL_UCB_SRC}
 
.c.o:
	${CC} ${CC_FLAGS} -c $<

#------------------------------------------------------------------------------

OBJS= \
    tclXbsearch.o    tclXchmod.o      tclXclock.o      tclXcmdInit.o \
    tclXcmdloop.o    tclXcnvclock.o   tclXdebug.o      tclXdup.o     \
    tclXfcntl.o      tclXfilecmds.o   tclXfscn.o       tclXflock.o   \
    tclXfstat.o      tclXgeneral.o    tclXgetdate.o    tclXhandles.o \
    tclXid.o         tclXinit.o       tclXkeylist.o    tclXlib.o     \
    tclXlist.o       tclXmain.o       tclXmath.o       tclXmsgcat.o  \
    tclXprocess.o    tclXprofile.o    tclXregexp.o     tclXselect.o  \
    tclXserver.o     tclXsignal.o     tclXshell.o      tclXstring.o  \
    tclXunixcmds.o   tclXutil.o

UCBOBJS=tclCmdIL.o
 
#------------------------------------------------------------------------------
# Compile the TclX library and link the shell.  If the link fails, purge
# the executable, as some systems leave invalid executables around.

all: made.tmp ${TCL} 

${TCL}: tclXAppInit.o ${LIBTCLX.A} ${LIBTCL.A} made.tmp 
	${CC} -c ${CC_FLAGS} tclXAppInit.c 
	${CC} tclXAppInit.o ${LDLIBS} ${XLDLIBS} -o tcl 
	makego32 tcl
	del tcl

made.tmp ${LIBTCLX.A}: ${OBJS} ${UCBOBJS} ${CPLUSOBJS}
	${AR} cr ${LIBTCLX.A}  *.o
	${RANLIB} ${LIBTCLX.A}
	touch made.tmp

tclCmdIL.o: tclCmdIL.c ${TCL_UCB_SRC}/patchlevel.h
	${CC} -c ${CC_FLAGS} -DTCL_LIBRARY=\"/usr/local/tclx/7.3a\" tclCmdIL.c

tclCmdIL.c: ${TCL_UCB_SRC}/tclCmdIL.c
	rm -f tclCmdIL.c
	cp ${TCL_UCB_SRC}/tclCmdIL.c tclCmdIL.c

#tclXinit.o: tclXinit.c
#	MASTER=${TCL_MASTERDIR} ;\
#	${CC} -c ${CC_FLAGS} -DTCL_MASTERDIR=\"$$MASTER\" \
#	    ${srcdir}/tclXinit.c

tclXcmdInit.o: tclXcmdInit.c tclXpatchl.h

tclXgetdate.c: tclXgetdate.y
	${YACC} tclXgetd.y
	sed 's/yy/TclXyy/g' <y_tab.c >tclXgetd.c
	rm y_tab.c

#tcl++.o: tcl++.C tcl++.h
#	${CCPLUS} -c ${CC_FLAGS} ${srcdir}/tcl++.C
#	${AR} cr ${LIBTCLX.A} tcl++.o
#	${RANLIB} ${LIBTCLX.A}
#	touch made.tmp

#------------------------------------------------------------------------------
# Copy include files, etc to the master directory.
#

#${TCLEXTEND.H}: tclExtend.h
#	rm -f ${TCLEXTEND.H}
#	cp ${srcdir}/tclExtend.h ${TCLEXTEND.H}

#${TCLPP_H}: tcl++.h
#	rm -f ${TCLPP_H}
#	cp ${srcdir}/tcl++.h ${TCLPP_H}

#${APPINIT}: tclXAppInit.c
#	rm -f ${APPINIT}
#	cp ${srcdir}/tclXAppInit.c ${APPINIT}

#${SYSLIBS}: SYSLIBS
#	rm -f ${SYSLIBS}
#	cp SYSLIBS ${SYSLIBS}

#------------------------------------------------------------------------------
# Make sure tcl++.h compiles, plus force tcl++.o into the library.

#TCL_PLUS: tcl++ tcl++.o ${TCLXMAINPP.O}

#tcl++: tclXmain++.o tcl++.o made.tmp
#	${CCPLUS} ${CC_FLAGS} ${XLDFLAGS} tclXmain++.o tclXAppInit.o \
#           ${LDLIBS} ${XLDLIBS} -o tcl++

#tclXmain++.o: tcl++.h tclXmain++.C
#	${CCPLUS} -c -I${CPLUSINCL} ${CC_FLAGS} tclXmain++.C

#tclXmain++.C: tclXmain.c
#	rm -f tclXmain++.C
#	cp ${srcdir}/tclXmain.c tclXmain++.C

#${TCLXMAINPP.O}: tclXmain++.o
#	rm -f ${TCLXMAINPP.O}
#	cp tclXmain++.o ${TCLXMAINPP.O}

#------------------------------------------------------------------------------

clean:
	-rm -f made.tmp libtclx.a
	-rm -f *.o ${TCL} tcl++

#------------------------------------------------------------------------------
# Restore to the distributed state.

#distclean: clean
#	rm -f Makefile tclXconfig.h SYSLIBS
