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

LD_ORDINARY_CC=${CC}
# Need libX11.a and libtcl.a, machine.defs may say where..
LIBS_X11_TK= -L/usr/lib -ltcl -ltk -lX11
TK_INCLUDE_DIR=-I/usr/local/include/tcl
X11_INCLUDE_DIR=-I/usr/openwin/include

CC = gcc 

GCLIB  = ../o/gcllib.a

# begin makedefs
GCLDIR=/d/wfs/gcl-2.0
SHELL=/bin/sh
MACHINE=sun4
TK_LIBRARY=/usr/local/lib/tk
X11_INCLUDE_DIR=-I/usr/openwin/include
TK_INCLUDE_DIR=-I/public/include/tcl
TK_LIBS=-L/usr/local/lib -ltk
TCL_LIBS=-L/usr/local/lib -ltcl
X11_LIBS=-L/usr/openwin/lib -lX11
EMACS_SITE_LISP=/usr/local/lib/emacs/site-lisp
INFO_DIR=/usr/local/info

LBINDIR=/usr/local/bin
OFLAG	=  -O
LIBS	= -lm 

X11_LIBS=-L/usr/openwin/lib -lX11
X11_INCLUDE_DIR=-I/usr/openwin/include


# the commercial (for money) C compiler has never been able
# to compile akcl/gcl correctly.  Perhaps it does not like the idea
# that this is free software.   However the standard C compiler is ok.

#CC = cc  -DVOL=  -I$(GCLDIR)/o -Bstatic -temp=. -pipe
#CC = cc  -DVOL=  -I$(GCLDIR)/o -Bstatic  -pipe
ODIR_DEBUG=-O4 

#gcc 2.1 and 2.2 compile gcl correctly as far as I have been able to determine.
#gcc 2.3.3 does not compile gcl correctly
# gcc 2.5.7 is correct as far as I can tell
# and gcl compiled with gcc runs our tests 15% faster than with cc..
CC = gcc -I${GCLDIR}/o -static -DVOL=volatile -pipe -fsigned-char

AS=as -P

CFLAGS	= -c $(DEFS)  -I../h

MAIN    = ../o/main.o

MPFILES=$(MPDIR)/mpi-sparc.o $(MPDIR)/sparcdivul3.o $(MPDIR)/libmport.a
#MPFILES=${MPDIR}/mpi.o ${MPDIR}/libmport.a

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

# This function will be run before dumping.
# When using SFASL it is good to have (si::build-symbol-table)
INITFORM=(si::build-symbol-table)



# Use symbolic links
SYMB=-s
# the  make to use for saved_kcp the profiler.
GCP=gcp-sun

NULLFILE = ../h/secondary_sun_magic

# end makedefs

CFLAGS1=$(CFLAGS) -I../o -I../h $(X11_INCLUDE_DIR) $(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 ${X11_LIBS} ${TCL_LIBS}  ${TK_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

