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

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

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

GCLIB  = ../o/gcllib.a

# begin makedefs

# use=386-linux

# for main link of raw_gcl
LIBS= -lm

#The multi precision library stuff
MPFILES=$(MPDIR)/mpi-386_no_under.o $(MPDIR)/libmport.a


# root for the installation, eg /usr/local
# This would cause make install to create /usr/local/bin/gcl and
# /usr/local/lib/gcl-2-??/* with some basic files.
prefix=/usr/local

# where to place the info files
INFO_DIR=/usr/local/info/

# where to put emacs lisp files.
EMACS_SITE_LISP=/usr/share/emacs/20.3/site-lisp

# the default.el file
EMACS_DEFAULT_EL=/usr/share/emacs/20.3/site-lisp/default.el

# numerous TCL/TK variables culled from the tkConfig.sh and tclConfig.sh
# if these are found.
TK_CONFIG_PREFIX=/usr/lib
TK_LIBRARY=/usr/lib/tk8.0
TCL_LIBRARY=/usr/lib/tcl8.0
TK_XINCLUDES=-I/usr/X11R6/include
TK_INCLUDE=-I/usr/lib/../include
TK_LIB_SPEC=-L/usr/lib -ltk8.0
TK_BUILD_LIB_SPEC=-L/work-in-progress/tk8.0/unix -ltk8.0
TK_XLIBSW=-L/usr/X11R6/lib -lX11
TK_XINCLUDES=-I/usr/X11R6/include
TCL_LIB_SPEC=-L/usr/lib -ltcl8.0
TCL_DL_LIBS=-ldl
TCL_LIBS=-ldl  -lieee -lm

NOTIFY=yes
GCC=gcc





GCLDIR=/home/wfs/gcl-2.3
SHELL=/bin/sh
MACHINE=386-linux

# notes for redhat 6.0
#  the configure should select the compiler GCC=/usr/bin/i386-glibc20-linux-gcc
#  However for the gcl-tk directory, you must use plain 'gcc' since
#  that must link with the tcl tk libs which have been compiled with it.
#  so after configure change to GCC=gcc in the gcl-tk/makefile


# 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

# under redhat 6.1 and slackware 7.0 we need to have this
# link be static for now ...
LDCC=${CC} -static

# note for linuxaout on an elf machine add -b i486-linuxaout 
# CC = gcc -pipe -fwritable-strings  -DVOL=volatile -I$(GCLDIR)/o -fsigned-char -b i486-linuxaout 

# 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 ${TK_INCLUDE} ${TK_XINCLUDES} 

all: gcltksrv   tkl.o tinfo.o  demos/gc-monitor.o gcltkaux
	(cd demos ; \
	echo '(load "../tkl.o")(TK::GET-AUTOLOADS (directory "*.lisp"))' | ../../unixport/saved_gcl) 
	

.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:
	$(GCLTKCC) -c $(CFLAGS1) ${ODIR_DEBUG}  $*.c


# for some reason -lieee is on various linux systems in the list of requireds..

gcltkaux:  $(GUIOS)
	$(LD_ORDINARY_CC) $(GUIOS) -o gcltkaux  ${TK_LIB_SPEC} ${TK_BUILD_LIB_SPEC} ${TK_XLIBSW} ${TK_XINCLUDES} ${TCL_LIB_SPEC}  `echo ${TCL_LIBS} | sed -e s:-lieee::g`  ${LIBS} ${GCLIB}

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

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

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

