#
# Makefile to build toocl
# beust@sa.inria.fr
#

CC = gcc

############################################################################
#  You may want to change the following variables
############################################################################

# Directories
HOME=/u/indri/0/koala/beust

# Where to find Tk's includes
	TK_INC=-I$(HOME)/applications/tk4.0
# Where to find Tk's sources
	TK_SRC=$(HOME)/applications/tk4.0
# Where to find Tcl's includes
	TCL_INC=-I$(HOME)/applications/tcl7.4
# Where to find Tcl's sources
	TCL_SRC=$(HOME)/applications/tcl7.4
# Where to find Tooltalk's tt_c.h
	TOOLTALK_INC=-I/usr/openwin/share/include/desktop
# Where to find the libtcl.a, libtk.a, libtt.a
	LIB_DIR=-L$(HOME)/lib/sun5 -L/usr/openwin3.0/lib

# C Flags
LOCAL_CFLAGS=-DHAVE_UNISTD_H=1

############################################################################
# You shouldn't have to change anything below
############################################################################

RANLIB=echo
LIBRARY=libtcltt.a

#
# Libraries
#
LIBS= -L/usr/X11R6/lib -ltt -lnsl -ltk -ltcl -lm  -lX11 

#
# Flags
#
CFLAGS=-DTCL_EXTENSION -I. $(TCL_INC) $(TK_INC) $(TOOLTALK_INC) $(LOCAL_CFLAGS) -g

#
# Files
#
INCLUDES=main.h
OBJECTS= tclttAppInit.o tclttMisc.o tclttSession.o tclttDefault.o\
         tclttMessage.o tclttPattern.o tclttFile.o tclttOtype.o\
	 tclttSpec.o tclttMain.o\
	database.o

all:	tclttMain.o $(OBJECTS) $(LIBRARY)
	$(CC) -g -o ttwish  $(OBJECTS) $(LIB_DIR) $(LIBS)

$(LIBRARY) : $(OBJECTS)
	rm -f $@
	ar cq $@ $(OBJECTS)
	$(RANLIB) $@

#tclttMain.o:	main.c
#	$(CC) $(CFLAGS) -c main.c

tclttMain.c:	tclttInit.sed
	sed -f tclttInit.sed $(TK_SRC)/tkAppInit.c >tclttMain.c
#	sed -f tclttInit.sed $(TCL_SRC)/tclAppInit.c >tclttMain.c

.c.o: $(INCLUDES)
	$(CC) $(CFLAGS) -c $<

clean: 
	rm *.o
	rm tclttMain.c

