xref: /original-bsd/lib/libm/Makefile (revision 82ad9df5)
1#
2# Copyright (c) 1987 Regents of the University of California.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms are permitted
6# provided that the above copyright notice and this paragraph are
7# duplicated in all such forms and that any documentation,
8# advertising materials, and other materials related to such
9# distribution and use acknowledge that the software was developed
10# by the University of California, Berkeley.  The name of the
11# University may not be used to endorse or promote products derived
12# from this software without specific prior written permission.
13# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16#
17#	@(#)Makefile	1.11 (Berkeley) 05/30/89
18#
19# This high quality math library is intended to run on either a VAX in
20# D_floating format or a machine that conforms to the IEEE standard 754
21# for double precision floating-point arithmetic.
22#
23# WARNING: On machines other than the ones mentioned above, run the original
24# Version 7 math library, if nothing better is available.
25#
26# MACHINE indicates the type of floating point hardware you are using; legal
27# values are:
28#
29# vax		- for the VAX D_floating format, the default.
30# tahoe		- for the TAHOE double format.
31# national	- for those IEEE machines whose floating point implementation
32#		  has similar byte ordering as the NATIONAL 32016 with 32081.
33# ieee		- for other IEEE machines, we hope.
34#
35CFLAGS=	-O -D${MACHINE}
36LIBC=	/lib/libc.a
37SUBDIR=	vax tahoe national common ieee
38#
39# Files comprising the standard Math library;
40# actually there are more under ${MACHINE}/ subdirectory.
41#
42SRCS=	acosh.c asincos.c asinh.c atan.c atanh.c cosh.c erf.c \
43	exp.c exp__E.c expm1.c floor.c fmod.c lgamma.c j0.c j1.c jn.c \
44	log.c log10.c log1p.c log__L.c pow.c sinh.c tanh.c
45OBJS=	acosh.o asincos.o asinh.o atan.o atanh.o cosh.o erf.o \
46	exp.o exp__E.o expm1.o floor.o fmod.o lgamma.o j0.o j1.o jn.o \
47	log.o log10.o log1p.o log__L.o pow.o sinh.o tanh.o
48MAN=	abs.0 asinh.0 erf.0 exp.0 floor.0 hypot.0 ieee.0 infnan.0 j0.0 \
49	lgamma.0 math.0 sin.0 sinh.0 sqrt.0
50MDIR=	${DESTDIR}/usr/man/cat3
51
52.c.o:
53####	generate additional code for profiling (-p)
54	${CC} -p ${CFLAGS} -c $*.c
55####	generate relocation bits (-r) & preserve symbols that begin with L (-X)
56	-ld -X -r $*.o
57	mv a.out profiled/$*.o
58	${CC} ${CFLAGS} -c $*.c
59####	generate relocation bits (-r) but don't preserve local symbols (-x)
60	-ld -x -r $*.o
61	mv a.out $*.o
62
63all: libm.a libm_p.a
64
65libm.a libm_p.a: ${OBJS} more.${MACHINE}
66	@echo building normal libm
67	@ar cru libm.a ${OBJS}
68	ranlib libm.a
69	@echo building profiled libm
70	@cd profiled; ar cru ../libm_p.a ${OBJS}
71	ranlib libm_p.a
72
73more.ieee: FRC
74	for i in common ieee; do (cd $$i; make ${MFLAGS}); done
75
76more.national: FRC
77	for i in common national; do (cd $$i; make ${MFLAGS}); done
78
79more.tahoe: FRC
80	for i in common tahoe; do (cd $$i; make ${MFLAGS}); done
81
82more.vax: FRC
83	cd vax; make "CFLAGS=${CFLAGS}"
84
85clean:
86	rm -f ${OBJS} profiled/*.o core libm.a libm_p.a
87	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
88
89cleandir: clean
90	rm -f ${MAN} tags .depend
91
92depend:
93	mkdep ${CFLAGS} ${SRCS}
94	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
95
96install: ${MAN}
97	install -o bin -g bin -m 444 libm.a ${DESTDIR}/usr/lib/libm.a
98	ranlib -t ${DESTDIR}/usr/lib/libm.a
99	install -o bin -g bin -m 444 libm_p.a ${DESTDIR}/usr/lib/libm_p.a
100	ranlib -t ${DESTDIR}/usr/lib/libm_p.a
101	install -c -o bin -g bin -m 444 ${MAN} ${MDIR}
102	rm -f ${MDIR}/acosh.0; ln ${MDIR}/asinh.0 ${MDIR}/acosh.0
103	rm -f ${MDIR}/atanh.0; ln ${MDIR}/asinh.0 ${MDIR}/atanh.0
104	rm -f ${MDIR}/erfc.0; ln ${MDIR}/erf.0 ${MDIR}/erfc.0
105	rm -f ${MDIR}/expm1.0; ln ${MDIR}/exp.0 ${MDIR}/expm1.0
106	rm -f ${MDIR}/log.0; ln ${MDIR}/exp.0 ${MDIR}/log.0
107	rm -f ${MDIR}/log10.0; ln ${MDIR}/exp.0 ${MDIR}/log10.0
108	rm -f ${MDIR}/log1p.0; ln ${MDIR}/exp.0 ${MDIR}/log1p.0
109	rm -f ${MDIR}/pow.0; ln ${MDIR}/exp.0 ${MDIR}/pow.0
110	rm -f ${MDIR}/fabs.0; ln ${MDIR}/floor.0 ${MDIR}/fabs.0
111	rm -f ${MDIR}/ceil.0; ln ${MDIR}/floor.0 ${MDIR}/ceil.0
112	rm -f ${MDIR}/rint.0; ln ${MDIR}/floor.0 ${MDIR}/rint.0
113	rm -f ${MDIR}/cabs.0; ln ${MDIR}/hypot.0 ${MDIR}/cabs.0
114	rm -f ${MDIR}/copysign.0; ln ${MDIR}/ieee.0 ${MDIR}/copysign.0
115	rm -f ${MDIR}/drem.0; ln ${MDIR}/ieee.0 ${MDIR}/drem.0
116	rm -f ${MDIR}/finite.0; ln ${MDIR}/ieee.0 ${MDIR}/finite.0
117	rm -f ${MDIR}/logb.0; ln ${MDIR}/ieee.0 ${MDIR}/logb.0
118	rm -f ${MDIR}/scalb.0; ln ${MDIR}/ieee.0 ${MDIR}/scalb.0
119	rm -f ${MDIR}/j1.0; ln ${MDIR}/j0.0 ${MDIR}/j1.0
120	rm -f ${MDIR}/jn.0; ln ${MDIR}/j0.0 ${MDIR}/jn.0
121	rm -f ${MDIR}/y0.0; ln ${MDIR}/j0.0 ${MDIR}/y0.0
122	rm -f ${MDIR}/y1.0; ln ${MDIR}/j0.0 ${MDIR}/y1.0
123	rm -f ${MDIR}/yn.0; ln ${MDIR}/j0.0 ${MDIR}/yn.0
124	rm -f ${MDIR}/gamma.0; ln ${MDIR}/lgamma.0 ${MDIR}/gamma.0
125	rm -f ${MDIR}/tan.0; ln ${MDIR}/sin.0 ${MDIR}/tan.0
126	rm -f ${MDIR}/acos.0; ln ${MDIR}/sin.0 ${MDIR}/acos.0
127	rm -f ${MDIR}/asin.0; ln ${MDIR}/sin.0 ${MDIR}/asin.0
128	rm -f ${MDIR}/atan.0; ln ${MDIR}/sin.0 ${MDIR}/atan.0
129	rm -f ${MDIR}/atan2.0; ln ${MDIR}/sin.0 ${MDIR}/atan2.0
130	rm -f ${MDIR}/cos.0; ln ${MDIR}/sin.0 ${MDIR}/cos.0
131	rm -f ${MDIR}/cosh.0; ln ${MDIR}/sinh.0 ${MDIR}/cosh.0
132
133lint: ${SRCS}
134	lint ${CFLAGS} ${SRCS}
135
136tags: ${SRCS}
137	ctags ${SRCS}
138	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} tags); done
139
140FRC:
141