11573Srgrimes# /****************************************************************
210818Sphk# Copyright (C) 1998 by Lucent Technologies
310818Sphk# All Rights Reserved
410818Sphk#
510818Sphk# Permission to use, copy, modify, and distribute this software and
610818Sphk# its documentation for any purpose and without fee is hereby
710818Sphk# granted, provided that the above copyright notice appear in all
81573Srgrimes# copies and that both that the copyright notice and this
912776Speter# permission notice and warranty disclaimer appear in supporting
101573Srgrimes# documentation, and that the name of Lucent or any of its entities
111573Srgrimes# not be used in advertising or publicity pertaining to
121573Srgrimes# distribution of the software without specific, written prior
1310818Sphk# permission.
1411338Sphk#
1511338Sphk# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1610818Sphk# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
1711665Sphk# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
181573Srgrimes# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
191573Srgrimes# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
2012776Speter# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
2112776Speter# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
2212776Speter# THIS SOFTWARE.
2312776Speter#
2412776Speter# ****************************************************************/
2512776Speter
2612776Speter.SUFFIXES: .c .o
2712776SpeterCC = cc
2812776SpeterCFLAGS = -g
2912776SpeterAR ?= ar
3012776SpeterARFLAGS ?= ruv
3111338Sphk
321573Srgrimes.c.o:
3311338Sphk	$(CC) -c $(CFLAGS) $*.c
341573Srgrimes
3510818Sphk# invoke "make Printf" to add printf.o to gdtoa.a (if desired)
3611338Sphk
3711338Sphkall: arith.h gd_qnan.h gdtoa.a
3810818Sphk
3910818Sphkarith.h: arithchk.c
4010818Sphk	$(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c
4110818Sphk	./a.out >arith.h
4211338Sphk	rm -f a.out arithchk.o
4311338Sphk
4410818Sphkgd_qnan.h: arith.h qnan.c
4510818Sphk	$(CC) $(CFLAGS) qnan.c
4610818Sphk	./a.out >gd_qnan.h
471573Srgrimes	rm -f a.out qnan.o
481573Srgrimes
4910818Sphkgdtoa.a:  dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\
5010818Sphk	 g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c\
5110818Sphk	 hexnan.c misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c\
5210818Sphk	 strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c\
5310818Sphk	 strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c\
541573Srgrimes	 strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\
5510818Sphk	 strtorx.c strtorxL.c sum.c ulp.c
5611338Sphk	$(CC) -c $(CFLAGS) $?
5710818Sphk	x=`echo $? | sed 's/\.c/.o/g'` && $(AR) $(ARFLAGS) gdtoa.a $$x && rm $$x
581573Srgrimes	ranlib gdtoa.a || true
5910818Sphk
6010818SphkPrintf: all printf.c
6110818Sphk	$(CC) -c $(CFLAGS) printf.c
6210818Sphk	$(AR) $(ARFLAGS) gdtoa.a printf.o
6310818Sphk	rm printf.o
6410818Sphk	touch Printf
6510818Sphk
6610818Sphk# If your system lacks ranlib, you do not need it.
6710818Sphk
681573Srgrimesxs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c\
6911338Sphk	 g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h\
7011338Sphk	 gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\
7111338Sphk	 makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\
7211338Sphk	 strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\
7310818Sphk	 strtoIxL.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c\
7410818Sphk	 strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c\
7510818Sphk	 strtorQ.c strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c\
7610818Sphk	 sum.c ulp.c
7710818Sphk
7810818Sphk# "make -r xsum.out" to check for transmission errors; source for xsum is
7910818Sphk# netlib's "xsum.c from f2c", e.g.,
8010818Sphk# ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz
811573Srgrimes
8210818Sphkxsum.out: xsum0.out $(xs0)
8310818Sphk	xsum $(xs0) >xsum1.out
841573Srgrimes	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
8510818Sphk
861573Srgrimesclean:
8710818Sphk	rm -f arith.h gd_qnan.h *.[ao] Printf xsum.out xsum1.out
8810818Sphk