#ident	"@(#):makefile	1.7"
#	MC68000 C RUNTIME MAKEFILE
#
#	@(#)makefile	2.1	
#
# The variable PROF is null by default, causing both the standard C library
# and a profiled library to be maintained.  If profiled object is not 
# desired, the reassignment PROF=@# should appear in the make command line.
#
# The variable IGN may be set to -i by the assignment IGN=-i in order to
# allow a make to complete even if there are compile errors in individual
# modules.
#
#
INCROOT=
.SUFFIXES: .p 

M4=m4 ../m4.def
AS=	as
CC=	cc
LINT=	lint
AFLAGS=	r
CFLAGS=	-O  -f -20
LFLAGS=	-p
LDFLAGS=
PROF=

OFILES= chrtab.o frexp.o ldexp.o modf.o mcount.o cerror.o
PFILES=	chrtab.p frexp.p ldexp.p modf.p	mcount.p cerror.p 
CFILES=	chrtab.c frexp.c ldexp.c modf.c	mcount.s cerror.s

chrtab.o chrtab.p: chrtab.c $(INCROOT)/usr/include/sys/fp.h
frexp.o frexp.p: frexp.c $(INCROOT)/usr/include/sys/fp.h
ldexp.o ldexp.p: ldexp.c $(INCROOT)/usr/include/sys/fp.h
mcount.o mcount.p: mcount.s $(INCROOT)/usr/include/sys/fp.h
modf.o modf.p: modf.c $(INCROOT)/usr/include/sys/fp.h
cerror.o cerror.p: cerror.s 


nonprof:	$(OFILES)

prof:		$(PFILES)

#$(FPPO):	$(INCROOT)/usr/include/sys/fp.h

#-------------------------

.c.o .c.p:
# This procedure is overkill, but harmless, for the non-FPP routines
	@echo $*.c:
	$(PROF)if test -f $*.o ; then mv $*.o tmp.o ; fi ; \
		$(CC) -p $(CFLAGS) -S $<
	$(NONPROF)$(CC) $(CFLAGS) -S $<
	sed -f massage.sed <$*.s >temp
	mv temp $*.s
	$(PROF)$(CC) -p $(CFLAGS) -c $*.s && mv $*.o $*.p ; \
		if test -f tmp.o ; then mv tmp.o $*.o ; fi
	$(NONPROF)$(CC) $(CFLAGS) -c $*.s
	rm $*.s

#-------------------------

.s.o .s.p :
	@echo $*.s:
	$(PROF)if test -f $*.o ; then mv $*.o tmp.o ; fi ; \
		$(M4) ../mcount.def  $*.s   > temp.s   && \
		$(CC) $(CFLAGS) -c temp.s  && mv temp.o $*.p ; \
		if test -f tmp.o ; then mv tmp.o $*.o ; fi
	$(NONPROF)$(M4) -DMCOUNT=#  $*.s   > temp.s   && \
	$(NONPROF)$(CC) $(CFLAGS) -c temp.s && mv temp.o $*.o

.s~.o .s~.p :
	$(GET) s.$*.s
	@echo $*.s:
	$(PROF)if test -f $*.o ; then mv $*.o tmp.o ; fi ; \
		$(M4) ../mcount.def  $*.s   > temp.s   && \
		$(CC) $(CFLAGS) -c temp.s  && mv temp.o $*.p ; \
		if test -f tmp.o ; then mv tmp.o $*.o ; fi
	$(NONPROF)$(M4) -DMCOUNT=#  $*.s   > temp.s   && \
	$(NONPROF)$(CC) $(CFLAGS) -c temp.s && mv temp.o $*.o
	rm $*.s

#--------------------------

clean:
	-rm -f $(OFILES) $(PFILES) temp temp.o temp.s

#--------------------------

clobber:	clean

#--------------------------

lint:	$(CFILES) $(INCROOT)/usr/include/sys/fp.h
	$(LINT) $(LFLAGS) $(CFILES) >lint.out
