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


PORTDIR	= ../unixport
CAT=cat

OBJS	= cmpbind.o cmpblock.o cmpcall.o cmpcatch.o cmpenv.o cmpeval.o \
	cmpflet.o cmpfun.o cmpif.o cmpinline.o cmplabel.o cmplam.o cmplet.o \
	cmploc.o cmpmap.o cmpmulti.o cmpspecial.o cmptag.o cmptop.o \
	cmptype.o cmputil.o cmpvar.o cmpvs.o cmpwt.o

COMPILE_FILE=$(PORTDIR)/saved_gcl $(PORTDIR) -system-p -c-file -data-file \
	-o-file nil -h-file -compile
CFLAGS	= -c -O -I../h 

.lsp.c:
	@ ../xbin/if-exists $(PORTDIR)/saved_gcl \
	"rm -f $*.c $*.h $*.data $*.o" \
	"$(COMPILE_FILE) $* "

.lsp.o:
	@ ../xbin/if-exists $(PORTDIR)/saved_gcl \
	"rm -f $*.c $*.h $*.data $*.o" \
	"$(COMPILE_FILE) $* " \
	"$(CC) $(OFLAG) $(CFLAGS) $*.c" \
	"../xbin/append ${NULLFILE} $*.data $*.o"


# 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

all:	$(OBJS)

.lsp.fn: ../cmpnew/collectfn.o
	../xbin/make-fn $*.lsp


.c.o:  
	$(CC) $(OFLAG) $(CFLAGS) $*.c
	$(CAT) ${NULLFILE} $*.data >> $*.o

collectfn.o:
	$(PORTDIR)/saved_gcl $(PORTDIR)/ -compile $*.lsp

.lisp.o:
	@ ../xbin/if-exists $(PORTDIR)/saved_gcl \
	"$(PORTDIR)/saved_gcl $(PORTDIR)/ -compile $*.lisp " 
sys-proclaim.lisp:
	echo '(in-package "COMPILER")' \
	'(load "../cmpnew/collectfn")(load "../lsp/sys-proclaim.lisp")'\
	'(compiler::make-all-proclaims "*.fn")' | ../xbin/gcl


newfn:	
	make `echo $(OBJS) | sed -e 's:\.o:.fn:g'`



remake:
	for v in `"ls" *.lsp.V | sed -e "s:\.lsp\.V::g"` ; \
	do rm -f $$v.c $$v.h $$v.data $$v.lsp $$v.o ; \
	ln -s  $(MAINDIR)/cmpnew/$$v.c . ; ln -s $(MAINDIR)/cmpnew/$$v.h . ; \
	ln -s $(MAINDIR)/cmpnew/$$v.data . ; \
	done
	rm -f ../unixport/saved_gcl 
	(cd .. ; make sources)
	(cd .. ; make)
	(cd .. ; make)

clean:
	rm -f *.o core a.out
allclean:
	rm -f *.h *.data *.c
