
.SUFFIXES:
.SUFFIXES: .o  .lsp .lisp .c

CC=cc
LD_ORDINARY_CC=${CC}
# Need libX11.a and libtcl.a, machine.defs may say where..

CC = gcc 
HDIR	= ../h
ODIR	= ../o

GCLIB  = ../o/gcllib.a

# begin makedefs
GCLDIR=/home/wfs/gcl-2.2
SHELL=/bin/sh
MACHINE=386-linux
TK_LIBRARY=/usr/lib/tk
TCL_LIBRARY=/usr/lib/tcl
X11_INCLUDE_DIR=/usr/include
TK_INCLUDE_DIR=/usr/include/tcl
TK_LIBS_DIR=/usr/lib
TCL_LIBS_DIR=/usr/lib
X11_LIBS_DIR=/usr/X11/lib
EMACS_SITE_LISP=/usr/lib/emacs/site-lisp
INFO_DIR=/usr/info
TK_INCLUDE=-I${TK_INCLUDE_DIR}
X11_INCLUDE=-I${X11_INCLUDE_DIR}
TCL_LIBS=-L${TCL_LIBS_DIR} -ltcl
TK_LIBS=-L${TK_LIBS_DIR} -ltk
X11_LIBS=-L${X11_LIBS_DIR} -lX11

# Machine dependent makefile definitions for intel 386,486 running linux

LBINDIR=/usr/local/bin

OFLAG	=  -O 
LIBS	= -lm 

ODIR_DEBUG= -O4 

# This CC string will be used for compilation of the system,
# and also in the compiler::*cc* variable for later compilation of
# lisp files.
# (the -pipe is just since our file system is slow..)
CC = gcc -pipe -fwritable-strings  -DVOL=volatile -I$(GCLDIR)/o -fsigned-char
LDCC=${CC} -static 

# Enable the fastloading mechanism which does not use ld -A
# requires c/rel_.. machine dependent code.

RSYM	= rsym
SFASL	= $(ODIR)/sfasl.o


MPFILES= $(MPDIR)/mpi-386d.o   $(MPDIR)/libmport.a


# When using SFASL it is good to have (si::build-symbol-table)
INITFORM=(si::build-symbol-table)

# Use symbolic links
SYMB=-s

LIBFILES=bsearch.o

# the  make to use for saved_kcp the profiler.
KCP=kcp-bsd
# end makedefs

CFLAGS1=$(CFLAGS) -I../o -I../h -I$(X11_INCLUDE_DIR) -I$(TK_INCLUDE_DIR)

all: gcltkaux1  tkl.o tinfo.o gcltksrv demos/gc-monitor.o

.lisp.o:
	echo "(compile-file \"$*.lisp\" :c-file nil :c-debug nil)" | ../unixport/saved_gcl

.lsp.o:
	echo "(compile-file \"$*.lsp\" :c-file t :c-debug t)" | ../unixport/saved_gcl



GUIOS = guis.o tkAppInit.o tkMain.o

clean::
	rm -f ${GUIOS} $(OFILES) gcltkaux gcltksrv *.o */*.o

.c.o:
	$(CC) -c $(CFLAGS1) ${ODIR_DEBUG}  $*.c


gcltkaux1: $(GUIOS)
	make gcltkaux "CC=`echo ${CC} | sed -e 's: -static : :g' -e 's:-Bstatic : :g'`"

gcltkaux:  $(GUIOS)
	$(LD_ORDINARY_CC) $(GUIOS) -o gcltkaux  ${TK_LIBS} ${TCL_LIBS}  ${X11_LIBS} ${LIBS} ${GCLIB}

gcltksrv: makefile
	cat gcltksrv.in | sed -e "s:TK_LIBRARY=.*:TK_LIBRARY=${TK_LIBRARY}:g" \
	-e "s:DIR=.*:DIR=${GCLDIR}/gcl-tk:g" > gcltksrv
	chmod a+x gcltksrv

INTERESTING=*.lsp *.lisp tk*.c guis.c sockets.c  comm.c Makefile  demos/*.lisp  *.h

tar:
	tar cvf - ${INTERESTING} | gzip -c > /u/wfs/sock-`date +%y%m%d`.tgz
tags:
	etags *.lsp *.lisp tk*.c guis.c sockets.c   guis.h our_io.c

tkAppInit.o : tkAppInit.c
tkMain.o : tkMain.c
tkXAppInit.o : tkXAppInit.c
tkXshell.o : tkXshell.c
guis.o : guis.c guis.h comm.c sheader.h
sockets.c: our_io.c sheader.h
socketsl.o: socketsl.lisp sockets.c

