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
29243933SeadlerAR ?= ar
30243933SeadlerARFLAGS ?= ruv
31112158Sdas
32112158Sdas.c.o:
33112158Sdas	$(CC) -c $(CFLAGS) $*.c
34112158Sdas
35219557Sdas# invoke "make Printf" to add printf.o to gdtoa.a (if desired)
36219557Sdas
37165743Sdasall: arith.h gd_qnan.h gdtoa.a
38112158Sdas
39112158Sdasarith.h: arithchk.c
40112158Sdas	$(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c
41112158Sdas	./a.out >arith.h
42112158Sdas	rm -f a.out arithchk.o
43112158Sdas
44165743Sdasgd_qnan.h: arith.h qnan.c
45165743Sdas	$(CC) $(CFLAGS) qnan.c
46165743Sdas	./a.out >gd_qnan.h
47165743Sdas	rm -f a.out qnan.o
48165743Sdas
49219557Sdasgdtoa.a:  dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\
50219557Sdas	 g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c\
51219557Sdas	 hexnan.c misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c\
52219557Sdas	 strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c\
53219557Sdas	 strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c\
54219557Sdas	 strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\
55219557Sdas	 strtorx.c strtorxL.c sum.c ulp.c
56112158Sdas	$(CC) -c $(CFLAGS) $?
57243933Seadler	x=`echo $? | sed 's/\.c/.o/g'` && $(AR) $(ARFLAGS) gdtoa.a $$x && rm $$x
58112158Sdas	ranlib gdtoa.a || true
59112158Sdas
60219557SdasPrintf: all printf.c
61219557Sdas	$(CC) -c $(CFLAGS) printf.c
62243933Seadler	$(AR) $(ARFLAGS) gdtoa.a printf.o
63219557Sdas	rm printf.o
64219557Sdas	touch Printf
65219557Sdas
66112158Sdas# If your system lacks ranlib, you do not need it.
67112158Sdas
68219557Sdasxs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c\
69219557Sdas	 g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h\
70219557Sdas	 gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\
71219557Sdas	 makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\
72219557Sdas	 strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\
73219557Sdas	 strtoIxL.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c\
74219557Sdas	 strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c\
75219557Sdas	 strtorQ.c strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c\
76219557Sdas	 sum.c ulp.c
77112158Sdas
78219557Sdas# "make -r xsum.out" to check for transmission errors; source for xsum is
79112158Sdas# netlib's "xsum.c from f2c", e.g.,
80112158Sdas# ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz
81112158Sdas
82112158Sdasxsum.out: xsum0.out $(xs0)
83112158Sdas	xsum $(xs0) >xsum1.out
84112158Sdas	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
85112158Sdas
86112158Sdasclean:
87219557Sdas	rm -f arith.h gd_qnan.h *.[ao] Printf xsum.out xsum1.out
88