#
# Makefile for Extended Tcl C sources.  This will compile all of Extended Tcl
# and add it to the libtcl.a in the parent directory.  It will also build a
# tclshell under the name 'tcl' in the parent directory.  This file is
# designed to be run under the top-level Makefile and expects the following
# macros to be passed in via the environment for a 'all' make:
#    o CFLAGS - Flags for the C-compile, including -I to find the UCB Tcl .h
#      files.
#    o HISTORY_FLAG - Can contain a define to turn off history.
#    o TCL_DEFAULT - The name of the Tcl default file.
#
SHELL=/bin/sh
LIBTCL=../libtcl.a

OBJS= \
    chmod.o        clock.o        cmdloop.o      debug.o        extendUtil.o \
    filescan.o     fmath.o        general.o      handles.o      id.o         \
    iocmds.o       list.o         main.o         math.o         matherr.o    \
    regexputil.o   signal.o       string.o       tclstartup.o   unixcmds.o   \
    createExtd.o   getdate.o	 ndebug.o	

all: made.tmp

made.tmp: $(OBJS)
	$(AR) cruv $(LIBTCL) $(OBJS)
	touch made.tmp

main.o: patchlevel.h main.c
	cc -c $(CFLAGS) $(HISTORY_FLAG) -DTCL_DEFAULT=\"$(TCL_DEFAULT)\" main.c

getdate.c:	getdate.y
	yacc getdate.y
	mv y.tab.c getdate.c

#
# This is just to test if it compiles.
#
tcl++:
	CC -c $(CFLAGS) $(HISTORY_FLAG) -DTCL_DEFAULT=\"$(TCL_DEFAULT)\" \
            tcl++.C
	-rm -f tcl++.o
clean:
	-rm -f made.tmp
	-rm -f *.o
	-rm -f tcl++.o

