
#	Makefile	1.0	83/07/02
# $Header:Makefile 12.0$
# $ACIS:Makefile 12.0$
# $Source: /ibm/acis/usr/src/usr.lib/libfp/emulfp/RCS/Makefile,v $
#

# ********* These file contain only text and no data, They can
#      be compiled with out the -R switch.                       
#
OBJS =  xxFPkill.o xxFPgetpid.o

FPOBJU = xFP0.o

# ********* N.B. -R switch below is so that floating point emulator
#      and .s files it depends on are in text segment only, to be
#      linked into the kernel
#	The profiled version, however, should NOT use -R!
#

FPOBJS = xFP1.o xFP2.o xFP3.o xFP4.o xFP5.o xFP6.o xFP7.o xFP8.o xFP9.o \
	xFPscalb.o xFPvect.o xFPemul.o fpfpx1.o fpfpx3.o xFPexception.o \
	xFPE_bscalb.o

ALLOBJS= ${FPOBJU} ${FPOBJS} ${OBJS} xFPB.o
CFLAGS=	-O
LD=	/bin/ld
SCR=	fpa.ed
HC=	hc

emulfplib  emulfplib_p:  ${ALLOBJS}
	@echo "building profiled emulfplib "
	@cd profiled; ar cru ../emulfplib_p  ${ALLOBJS}
	@echo "building normal emulfplib "
	@ar cru emulfplib ${ALLOBJS}

.s.o:
	/lib/cpp -E -DPROF $*.s >$*.cpp.s
	${AS} -o $*.o $*.cpp.s
	${LD} -X -r $*.o
	mv a.out profiled/$*.o
	/lib/cpp -E $*.s >$*.cpp.s
	${AS} -R -o $*.o $*.cpp.s
	${LD} -x -r $*.o
	mv a.out $*.o
	rm $*.cpp.s

.c.o:
	${CC} -p -c ${CFLAGS} $*.c
	${LD} -X -r $*.o
	mv a.out profiled/$*.o
	${CC} -c ${CFLAGS} $*.c
	${LD} -x -r $*.o
	mv a.out $*.o

#
# These files MUST be compiled by either pcc or hc2.  hc1 wouldn't
# do because it generates floating point operations for some of
# the statements.
#
${FPOBJU}:
	${HC} -p -c ${CFLAGS} $*.c
	${LD} -X -r $*.o
	mv a.out profiled/$*.o
	${HC} -c ${CFLAGS} $*.c
	${LD} -x -r $*.o
	mv a.out $*.o

#
# These files MUST be compiled by either pcc or hc2.  hc1 wouldn't
# do because it generates floating point operations for some of
# the statements.
#
${FPOBJS}:
	${HC} -p -c ${CFLAGS} $*.c
	${LD} -X -r $*.o
	mv a.out profiled/$*.o
	${HC} -R -c ${CFLAGS} $*.c
	${LD} -x -r $*.o
	mv a.out $*.o


# do not, I repeat DO NOT remove the ${FPOBJS} or ${FPOBJU} 
#    --no sources are shipped!
clean:
	rm -f ${OBJS} a.out core emulfplib emulfplib_p
	cd profiled; rm -f ${OBJS}
