xref: /freebsd/contrib/gdtoa/makefile (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
1# /****************************************************************
2# Copyright (C) 1998 by Lucent Technologies
3# All Rights Reserved
4#
5# Permission to use, copy, modify, and distribute this software and
6# its documentation for any purpose and without fee is hereby
7# granted, provided that the above copyright notice appear in all
8# copies and that both that the copyright notice and this
9# permission notice and warranty disclaimer appear in supporting
10# documentation, and that the name of Lucent or any of its entities
11# not be used in advertising or publicity pertaining to
12# distribution of the software without specific, written prior
13# permission.
14#
15# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22# THIS SOFTWARE.
23#
24# ****************************************************************/
25
26.SUFFIXES: .c .o
27CC = cc
28CFLAGS = -g
29AR ?= ar
30ARFLAGS ?= ruv
31
32.c.o:
33	$(CC) -c $(CFLAGS) $*.c
34
35# invoke "make Printf" to add printf.o to gdtoa.a (if desired)
36
37all: arith.h gd_qnan.h gdtoa.a
38
39arith.h: arithchk.c
40	$(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c
41	./a.out >arith.h
42	rm -f a.out arithchk.o
43
44gd_qnan.h: arith.h qnan.c
45	$(CC) $(CFLAGS) qnan.c
46	./a.out >gd_qnan.h
47	rm -f a.out qnan.o
48
49gdtoa.a:  dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c\
50	 g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c\
51	 hexnan.c misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c\
52	 strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c\
53	 strtodg.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c\
54	 strtopx.c strtopxL.c strtorQ.c strtord.c strtordd.c strtorf.c\
55	 strtorx.c strtorxL.c sum.c ulp.c
56	$(CC) -c $(CFLAGS) $?
57	x=`echo $? | sed 's/\.c/.o/g'` && $(AR) $(ARFLAGS) gdtoa.a $$x && rm $$x
58	ranlib gdtoa.a || true
59
60Printf: all printf.c
61	$(CC) -c $(CFLAGS) printf.c
62	$(AR) $(ARFLAGS) gdtoa.a printf.o
63	rm printf.o
64	touch Printf
65
66# If your system lacks ranlib, you do not need it.
67
68xs0 = README arithchk.c dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c\
69	 g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h\
70	 gdtoa_fltrnds.h gdtoaimp.h gethex.c gmisc.c hd_init.c hexnan.c\
71	 makefile misc.c printf.c printf.c0 qnan.c smisc.c stdio1.h\
72	 strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c\
73	 strtoIxL.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c\
74	 strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c\
75	 strtorQ.c strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c\
76	 sum.c ulp.c
77
78# "make -r xsum.out" to check for transmission errors; source for xsum is
79# netlib's "xsum.c from f2c", e.g.,
80# ftp://netlib.bell-labs.com/netlib/f2c/xsum.c.gz
81
82xsum.out: xsum0.out $(xs0)
83	xsum $(xs0) >xsum1.out
84	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
85
86clean:
87	rm -f arith.h gd_qnan.h *.[ao] Printf xsum.out xsum1.out
88