new copyright notice
[unix-history] / usr / src / lib / libm / Makefile
index c76de59..1559eb7 100644 (file)
+#      @(#)Makefile    5.2 (Berkeley) %G%
 #
 #
-# Copyright (c) 1987 Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms are permitted
-# provided that the above copyright notice and this paragraph are
-# duplicated in all such forms and that any documentation,
-# advertising materials, and other materials related to such
-# distribution and use acknowledge that the software was developed
-# by the University of California, Berkeley.  The name of the
-# University may not be used to endorse or promote products derived
-# from this software without specific prior written permission.
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-#      @(#)Makefile    1.10 (Berkeley) %G%
-#
-# This high quality math library is intended to run on either a VAX in
-# D_floating format or a machine that conforms to the IEEE standard 754
-# for double precision floating-point arithmetic.
-#
-# WARNING: On machines other than the ones mentioned above, run the original
-# Version 7 math library, if nothing better is available.
-#
-# MACHINE indicates the type of floating point hardware you are using; legal
-# values are:
-#
-# vax          - for the VAX D_floating format, the default.
-# tahoe                - for the TAHOE double format.
-# national     - for those IEEE machines whose floating point implementation
+# ieee         - for most IEEE machines, we hope.
+# mc68881      - the, ahem, mc68881.
+# national     - for those ieee machines whose floating point implementation
 #                has similar byte ordering as the NATIONAL 32016 with 32081.
 #                has similar byte ordering as the NATIONAL 32016 with 32081.
-# ieee         - for other IEEE machines, we hope.
-#
-CFLAGS=        -O -D${MACHINE}
-LIBC=  /lib/libc.a
-SUBDIR=        vax tahoe national common ieee
-#
-# Files comprising the standard Math library;
-# actually there are more under ${MACHINE}/ subdirectory.
-#
-SRCS=  acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c \
-       exp.c exp__E.c expm1.c floor.c lgamma.c j0.c j1.c jn.c \
-       log.c log10.c log1p.c log__L.c pow.c sinh.c tanh.c
-OBJS=  acosh.o asincos.o asinh.o atan.o atanh.o cosh.o erf.o \
-       exp.o exp__E.o expm1.o floor.o lgamma.o j0.o j1.o jn.o \
-       log.o log10.o log1p.o log__L.o pow.o sinh.o tanh.o 
-MAN=   abs.0 asinh.0 erf.0 exp.0 floor.0 hypot.0 ieee.0 infnan.0 j0.0 \
+# tahoe                - for the tahoe double format.
+# vax          - for the vax D_floating format
+
+LIB=   m
+CFLAGS+=-I${.CURDIR}/common_source
+
+.if (${MACHINE} == "ieee")
+
+HARDWARE=${MACHINE}
+.PATH: ${.CURDIR}/common_source ${.CURDIR}/common ${.CURDIR}/ieee
+# common_source
+SRCS+= acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c exp.c \
+       exp__E.c expm1.c floor.c fmod.c lgamma.c j0.c j1.c jn.c log.c \
+       log10.c log1p.c log__L.c pow.c sinh.c tanh.c
+# common
+SRCS+= atan2.c sincos.c tan.c
+# ieee
+SRCS+= cabs.c cbrt.c support.c
+
+.elif (${MACHINE} == "hp300")
+
+HARDWARE=mc68881
+.PATH: ${.CURDIR}/mc68881 ${.CURDIR}/common_source ${.CURDIR}/ieee
+# common_source
+SRCS+= acosh.c asinh.c erf.c exp__E.c fmod.c lgamma.c j0.c j1.c log__L.c \
+       pow.c
+# mc68881
+SRCS+= asincos.s atan.s atan2.c atanh.s cosh.s exp.s expm1.s floor.s \
+       log.s log10.s log1p.s sincos.s sinh.s sqrt.s support.s tan.s tanh.s
+# ieee
+SRCS+= cabs.c cbrt.c
+
+.elif (${MACHINE} == "national")
+
+HARDWARE=${MACHINE}
+.PATH: ${.CURDIR}/common_source ${.CURDIR}/common ${.CURDIR}/national \
+       ${.CURDIR}/ieee
+# common_source
+SRCS+= acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c exp.c \
+       exp__E.c expm1.c floor.c fmod.c lgamma.c j0.c j1.c jn.c log.c \
+       log10.c log1p.c log__L.c pow.c sinh.c tanh.c
+# common
+SRCS+= atan2.c sincos.c tan.c
+# national
+SRCS+= sqrt.s support.s
+# ieee
+SRCS+= cabs.c cbrt.c
+
+.elif (${MACHINE} == "tahoe")
+
+HARDWARE=${MACHINE}
+.PATH: ${.CURDIR}/common_source ${.CURDIR}/common ${.CURDIR}/tahoe \
+# common_source
+SRCS+= acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c exp.c \
+       exp__E.c expm1.c floor.c fmod.c lgamma.c j0.c j1.c jn.c log.c \
+       log10.c log1p.c log__L.c pow.c sinh.c tanh.c
+# common
+SRCS+= atan2.c sincos.c tan.c
+# tahoe
+SRCS+= cabs.s cbrt.s sqrt.s support.s infnan.s
+
+.elif (${MACHINE} == "vax")
+
+HARDWARE=${MACHINE}
+.PATH: ${.CURDIR}/common_source ${.CURDIR}/vax
+# common_source
+SRCS+= acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c exp.c \
+       exp__E.c expm1.c floor.c fmod.c lgamma.c j0.c j1.c jn.c log.c
+       log10.c log1p.c log__L.c pow.c sinh.c tanh.c
+# vax
+SRCS+= atan2.s cabs.s cbrt.s sqrt.s sincos.s tan.s argred.s support.s \
+       infnan.s
+
+.endif
+
+MAN3+= asinh.0 erf.0 exp.0 floor.0 hypot.0 ieee.0 infnan.0 j0.0 \
        lgamma.0 math.0 sin.0 sinh.0 sqrt.0
        lgamma.0 math.0 sin.0 sinh.0 sqrt.0
-MDIR=  ${DESTDIR}/usr/man/cat3
-
-.c.o:
-####   generate additional code for profiling (-p)
-       ${CC} -p ${CFLAGS} -c $*.c
-####   generate relocation bits (-r) & preserve symbols that begin with L (-X)
-       -ld -X -r $*.o
-       mv a.out profiled/$*.o
-       ${CC} ${CFLAGS} -c $*.c
-####   generate relocation bits (-r) but don't preserve local symbols (-x)
-       -ld -x -r $*.o
-       mv a.out $*.o
-
-all: libm.a libm_p.a
-
-libm.a libm_p.a: ${OBJS} more.${MACHINE}
-       @echo building normal libm
-       @ar cru libm.a ${OBJS}
-       ranlib libm.a
-       @echo building profiled libm
-       @cd profiled; ar cru ../libm_p.a ${OBJS}
-       ranlib libm_p.a
-
-more.ieee: FRC
-       for i in common ieee; do (cd $$i; make ${MFLAGS}); done
-
-more.national: FRC
-       for i in common national; do (cd $$i; make ${MFLAGS}); done
-
-more.tahoe: FRC
-       for i in common tahoe; do (cd $$i; make ${MFLAGS}); done
-
-more.vax: FRC
-       cd vax; make "CFLAGS=${CFLAGS}"
-
-clean: 
-       rm -f ${OBJS} profiled/*.o core libm.a libm_p.a
-       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
-
-cleandir: clean
-       rm -f ${MAN} tags .depend
-
-depend: 
-       mkdep ${CFLAGS} ${SRCS}
-       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
-
-install: ${MAN}
-       install -o bin -g bin -m 444 libm.a ${DESTDIR}/usr/lib/libm.a
-       ranlib -t ${DESTDIR}/usr/lib/libm.a
-       install -o bin -g bin -m 444 libm_p.a ${DESTDIR}/usr/lib/libm_p.a
-       ranlib -t ${DESTDIR}/usr/lib/libm_p.a
-       install -c -o bin -g bin -m 444 ${MAN} ${MDIR}
-       rm -f ${MDIR}/acosh.0; ln ${MDIR}/asinh.0 ${MDIR}/acosh.0
-       rm -f ${MDIR}/atanh.0; ln ${MDIR}/asinh.0 ${MDIR}/atanh.0
-       rm -f ${MDIR}/erfc.0; ln ${MDIR}/erf.0 ${MDIR}/erfc.0
-       rm -f ${MDIR}/expm1.0; ln ${MDIR}/exp.0 ${MDIR}/expm1.0
-       rm -f ${MDIR}/log.0; ln ${MDIR}/exp.0 ${MDIR}/log.0
-       rm -f ${MDIR}/log10.0; ln ${MDIR}/exp.0 ${MDIR}/log10.0
-       rm -f ${MDIR}/log1p.0; ln ${MDIR}/exp.0 ${MDIR}/log1p.0
-       rm -f ${MDIR}/pow.0; ln ${MDIR}/exp.0 ${MDIR}/pow.0
-       rm -f ${MDIR}/fabs.0; ln ${MDIR}/floor.0 ${MDIR}/fabs.0
-       rm -f ${MDIR}/ceil.0; ln ${MDIR}/floor.0 ${MDIR}/ceil.0
-       rm -f ${MDIR}/rint.0; ln ${MDIR}/floor.0 ${MDIR}/rint.0
-       rm -f ${MDIR}/cabs.0; ln ${MDIR}/hypot.0 ${MDIR}/cabs.0
-       rm -f ${MDIR}/copysign.0; ln ${MDIR}/ieee.0 ${MDIR}/copysign.0
-       rm -f ${MDIR}/drem.0; ln ${MDIR}/ieee.0 ${MDIR}/drem.0
-       rm -f ${MDIR}/finite.0; ln ${MDIR}/ieee.0 ${MDIR}/finite.0
-       rm -f ${MDIR}/logb.0; ln ${MDIR}/ieee.0 ${MDIR}/logb.0
-       rm -f ${MDIR}/scalb.0; ln ${MDIR}/ieee.0 ${MDIR}/scalb.0
-       rm -f ${MDIR}/j1.0; ln ${MDIR}/j0.0 ${MDIR}/j1.0
-       rm -f ${MDIR}/jn.0; ln ${MDIR}/j0.0 ${MDIR}/jn.0
-       rm -f ${MDIR}/y0.0; ln ${MDIR}/j0.0 ${MDIR}/y0.0
-       rm -f ${MDIR}/y1.0; ln ${MDIR}/j0.0 ${MDIR}/y1.0
-       rm -f ${MDIR}/yn.0; ln ${MDIR}/j0.0 ${MDIR}/yn.0
-       rm -f ${MDIR}/gamma.0; ln ${MDIR}/lgamma.0 ${MDIR}/gamma.0
-       rm -f ${MDIR}/tan.0; ln ${MDIR}/sin.0 ${MDIR}/tan.0
-       rm -f ${MDIR}/acos.0; ln ${MDIR}/sin.0 ${MDIR}/acos.0
-       rm -f ${MDIR}/asin.0; ln ${MDIR}/sin.0 ${MDIR}/asin.0
-       rm -f ${MDIR}/atan.0; ln ${MDIR}/sin.0 ${MDIR}/atan.0
-       rm -f ${MDIR}/atan2.0; ln ${MDIR}/sin.0 ${MDIR}/atan2.0
-       rm -f ${MDIR}/cos.0; ln ${MDIR}/sin.0 ${MDIR}/cos.0
-       rm -f ${MDIR}/cosh.0; ln ${MDIR}/sinh.0 ${MDIR}/cosh.0
-
-lint: ${SRCS}
-       lint ${CFLAGS} ${SRCS}
-
-tags: ${SRCS}
-       ctags ${SRCS}
-       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} tags); done
-
-FRC:
+
+MLINKS+=asinh.3 acosh.3 asinh.3 atanh.3
+MLINKS+=erf.3 erfc.3
+MLINKS+=exp.3 expm1.3 exp.3 log.3 exp.3 log10.3 exp.3 log1p.3 exp.3 pow.3
+MLINKS+=floor.3 fabs.3 floor.3 ceil.3 floor.3 rint.3
+MLINKS+=hypot.3 cabs.3
+MLINKS+=ieee.3 copysign.3 ieee.3 drem.3 ieee.3 finite.3 ieee.3 logb.3 \
+       ieee.3 scalb.3
+MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0.3 y1.3 j0.3 yn.3
+MLINKS+=lgamma.3 gamma.3
+MLINKS+=sin.3 tan.3 sin.3 acos.3 sin.3 asin.3 sin.3 atan.3 sin.3 atan2.3 \
+       sin.3 cos.3
+MLINKS+=sinh.3 cosh.3
+
+# can't use the standard mkdep, because there are some .s files that
+# are using '#' as a comment indicator and cpp thinks it's an undefined
+# control.
+
+depend: ${SRCS}
+       mkdep ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c}
+
+.include <bsd.lib.mk>
+
+.s.o:
+       ${AS} -o ${.TARGET} ${.IMPSRC}
+       @${LD} -x -r ${.TARGET}
+       @mv a.out ${.TARGET}
+
+.s.po:
+       sed -f ${.CURDIR}/${HARDWARE}/mcount.sed ${.IMPSRC} | \
+           ${AS} -o ${.TARGET}
+       @${LD} -X -r ${.TARGET}
+       @mv a.out ${.TARGET}