# file: makefile - for making mips programs in the current directory

SUFX	= 
INCLUDE = -I. -I/usr/include 
AS      = as
CC   	= cc
LD      = cc
PRFLAG  = 
ASFLAG  = 
CCFLAG  = -O1 -c
LDFLAG  = 
POSTP	= 
LDLIB	= -lm -lc
SYSPATH = 
SYSOBJ  = 
EFILE	= perf 
ONEFILE	= Schorn
.SUFFIXES:
.SUFFIXES: .o${SUFX} .asm .c

# **************************************** specific files follow

LOCALOBJS	= perf.o${SUFX} \
		  tests.o${SUFX} \
		  Boucher.o${SUFX} \
		  Heckbert.o${SUFX} \
		  Schorn.o${SUFX} \
		  Sloan.o${SUFX}

REMOTEOBJS	=

OBJS	= ${LOCALOBJS} ${REMOTEOBJS}

# **************************************** the rest is the generic format
.asm.on10:
	${CC} ${INCLUDE} ${PRFLAG} $*.asm | sed '/^#/d' > $*.macro
	${AS} ${ASFLAG}        -o $*.o${SUFX} $*.macro
#	${AS} ${ASFLAG} -l$*.l -o $*.o${SUFX} $*.macro
#	\rm -f $*.macro

.c.on10:
	${CC} ${INCLUDE} ${CCFLAG} -c $*.c
	${AS} ${ASFLAG} -o $*.o${SUFX} $*.s
#	\rm -f $*.s

.mips.omips:
	${AS} -o $*.o${SUFX} $*.mips

.c.omips:
	${CC} ${INCLUDE} ${CCFLAG} -o $*.o${SUFX} $*.c

.mips.o:
	${AS} -o $*.o${SUFX} $*.mips

.c.o:
	${CC} ${INCLUDE} ${CCFLAG} -o $*.o${SUFX} $*.c

all:	printenvmess ${EFILE}

pc2n10:	printenvmess ${PCOBJS} do_remote 
	@echo
	@echo linking pc2n10
	${LD} -o pc2n10 ${LDFLAG} ${PCOBJS} ${LDLIB}
	@echo
	${POSTP}
	@echo pc2n10 is ready
	@echo $$N_ENVMESS

${EFILE}: ${LOCALOBJS} do_remote
	@echo $$N_ENVMESS
	@echo
	@echo linking ${EFILE}...
	${LD} -o ${EFILE} ${LDFLAG} ${SYSOBJ} ${OBJS} ${LDLIB}
	@echo
	${POSTP}
	@echo ${EFILE} is ready
	@echo $$N_ENVMESS

printenvmess:
	@echo $$N_ENVMESS

do_remote:

one:    ${ONEFILE}.o${SUFX}
# useful for iterating on one file to solve compile errors
	@echo   ${ONEFILE}.o${SUFX} is made

debug:
	make "DEBUG=-DDEBUG" "SUFX=${SUFX}"

depend:
	makedepend ${INCLUDE} ${SRCS} *.c -o'.o$${SUFX}'

clean:
	\rm -f ${EFILE} ${LOCALOBJS}

cleanobj:
	\rm -f ${EFILE} ${OBJS}

cleanall:
	\rm -f ${EFILE} ${OBJS}
	\rm -f *.macro
	\rm -f *.s
	cd $$dir_clib	; make cleanall

lint:
	lint ${CCFLAG} ${IFLAG} ${SRCS} > linterr

ctags:
	ctags *.c

# DO NOT DELETE THIS LINE -- make depend depends on it.

Boucher.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h perf.h
Heckbert.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h perf.h
Schorn.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h perf.h
Sloan.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h
Sloan.o${SUFX}: /usr/include/math.h /usr/include/values.h perf.h
perf.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h
perf.o${SUFX}: /usr/include/math.h /usr/include/values.h
perf.o${SUFX}: /usr/include/sys/types.h /usr/include/sys/param.h
perf.o${SUFX}: /usr/include/sys/fs/s5param.h /usr/include/sys/times.h perf.h
tests.o${SUFX}: /usr/include/stdio.h /usr/include/varargs.h
tests.o${SUFX}: /usr/include/math.h /usr/include/values.h perf.h
