. ../../../config/system
. ../../../config/site

echo Building Makefile.local...
cat <<EOT >Makefile.local
# This Makefile was produced by running ./build in this directory.

SHELL=		/bin/sh

CC=		${cc-cc}
CFLAGS=		$cflags
LINTFLAGS=	$lintflags

INC=		$elktop/include
H=		zelk.h

O=		forfunc.o fortest.o farray.o peekpoke.o forpkg.o zelk.o \
		$fvector $asm $alibs

ZELK:		../Zelk.o

../Zelk.o:	\$(O)
		ld -r \$(O) -o ../Zelk.o

#### special case compiles ####

MIPSASM.o:	MIPSASM.s
		as -O -g -G0 $(CFLAGS) MIPSASM.s -o MIPSASM.o

# forfunc on sparc MUST NOT be compiled -O, since this interferes
# with the asm() statements.  Use -g to override the -O
forfunc.o:	forfunc.c
		\$(CC) -g \$(CFLAGS) -I\$(INC) -c forfunc.c

## fvector.c needs ANSI C macros

# this target - do not try to compile fvector
fvectornone.o:
		\$(CC) -c fvector_empty.c -o fvectornone.o

# compile fvector.c using SGI compiler
fvectorsgi.o:	fvector.c
		\$(CC) -DSgiAnsi -prototypes -float -G0 \$(CFLAGS)\
		-I\$(INC) -c fvector.c -o fvectorsgi.o

# compile fvector.c using gcc
# gcc by default uses its own include files from .../lib/gcc/sun
# The assert.h there calls _eprintf, which is in /usr/... /gcclib.a.
# To avoid linking with this, specify -nostdinc.
fvectorgcc.o:	fvector.c
		gcc -g -O2 -DEgcc \$(CFLAGS) $fvectorflags \
		-fpcc-struct-return -I\$(INC) -c fvector.c -o fvectorgcc.o


## forgl exports some of the SGI Gl graphics library
# needs ANSI compiler
# cannot use $CFLAGS because cflags specifies -cckr
forgl.o:	forgl.c
		\$(CC) -DSgiAnsi -prototypes -float -g -G0 \$(CFLAGS) \
		-I\$(INC) -c forgl.c


.c.o:
		\$(CC) \$(CFLAGS) $floatflag -I\$(INC) -c \$<

\$(O):		\$(H)

clean:
		-rm -f *.o core Makefile.local

distclean:
		-rm -f *.o core Makefile.local
EOT
