1112158Sdas# /****************************************************************
2112158Sdas# Copyright (C) 1998 by Lucent Technologies
3112158Sdas# All Rights Reserved
4112158Sdas#
5112158Sdas# Permission to use, copy, modify, and distribute this software and
6112158Sdas# its documentation for any purpose and without fee is hereby
7112158Sdas# granted, provided that the above copyright notice appear in all
8112158Sdas# copies and that both that the copyright notice and this
9112158Sdas# permission notice and warranty disclaimer appear in supporting
10112158Sdas# documentation, and that the name of Lucent or any of its entities
11112158Sdas# not be used in advertising or publicity pertaining to
12112158Sdas# distribution of the software without specific, written prior
13112158Sdas# permission.
14112158Sdas#
15112158Sdas# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16112158Sdas# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17112158Sdas# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18112158Sdas# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19112158Sdas# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20112158Sdas# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21112158Sdas# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22112158Sdas# THIS SOFTWARE.
23112158Sdas#
24112158Sdas# ****************************************************************/
25112158Sdas
26112158Sdas.SUFFIXES: .c .o
27112158SdasCC = cc
28187808SdasCFLAGS = -g
29112158Sdas
30112158Sdas.c.o:
31112158Sdas	$(CC) -c $(CFLAGS) $*.c
32112158Sdas
33219557Sdas# invoke "make Printf" to add printf.o to gdtoa.a (if desired)
34219557Sdas
35165743Sdasall: arith.h gd_qnan.h gdtoa.a
36112158Sdas
37112158Sdasarith.h: arithchk.c
38112158Sdas	$(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c
39112158Sdas	./a.out >arith.h
40112158Sdas	rm -f a.out arithchk.o
41112158Sdas
42165743Sdasgd_qnan.h: arith.h qnan.c
43165743Sdas	$(CC) $(CFLAGS) qnan.c
44165743Sdas	./a.out >gd_qnan.h
45165743Sdas	rm -f a.out qnan.o
46165743Sdas
47219557Sdasgdtoa.a:  dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\
48219557Sdas	 g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c\
49219557Sdas	 hexnan.c misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c\
50219557Sdas	 strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c\
51219557Sdas	 strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c\
52219557Sdas	 strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\
53219557Sdas	 strtorx.c strtorxL.c sum.c ulp.c
54112158Sdas	$(CC) -c $(CFLAGS) $?
55112158Sdas	x=`echo $? | sed 's/\.c/.o/g'` && ar ruv gdtoa.a $$x && rm $$x
56112158Sdas	ranlib gdtoa.a || true
57112158Sdas
58219557SdasPrintf: all printf.c
59219557Sdas	$(CC) -c $(CFLAGS) printf.c
60219557Sdas	ar ruv gdtoa.a printf.o
61219557Sdas	rm printf.o
62219557Sdas	touch Printf
63219557Sdas
64112158Sdas# If your system lacks ranlib, you do not need it.
65112158Sdas
66219557Sdasxs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c\
67219557Sdas	 g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h\
68219557Sdas	 gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\
69219557Sdas	 makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\
70219557Sdas	 strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\
71219557Sdas	 strtoIxL.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c\
72219557Sdas	 strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c\
73219557Sdas	 strtorQ.c strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c\
74219557Sdas	 sum.c ulp.c
75112158Sdas
76219557Sdas# "make -r xsum.out" to check for transmission errors; source for xsum is
77112158Sdas# netlib's "xsum.c from f2c", e.g.,
78112158Sdas# ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz
79112158Sdas
80112158Sdasxsum.out: xsum0.out $(xs0)
81112158Sdas	xsum $(xs0) >xsum1.out
82112158Sdas	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
83112158Sdas
84112158Sdasclean:
85219557Sdas	rm -f arith.h gd_qnan.h *.[ao] Printf xsum.out xsum1.out
86