1### ====================================================================
2### Makefile for quadruple-precision C version of ELEFUNT package.  This
3### code can be compiled with either C or C++ compilers.
4###
5### Makefile for Unix benchmark programs in C, FORTRAN, and Pascal
6### Invoke as
7###
8###	make NAME=-xxx CC=yy [XCFLAGS=...] [XDEFINES=...] [XINCLUDES=...] target
9###
10### where xxx will be a unique suffix added to the output files to allow
11### accumulation of results from multiple runs with different compiler
12### options or from different machines.
13###
14### The defaults for XCFLAGS is an empty string, so as to obtain the
15### standard compiler options.
16###
17### Current target list:
18###	all		make tallqp output
19###	check		make individual test output
20###	clean		remove unneeded intermediate files
21###	clobber		same as distclean
22###	distclean	remove everything that make can rebuild
23###	header		internal target
24###	install		dummy target
25###	lint		run lint on source code
26###	maintainer-clean do NOT use this target (for maintainer only)
27###	mostlyclean	same as clean
28###	summary		summarize all bit loss reports
29###	TALLQP		run all quadruple-precision tests
30###	TALOG		run alog tests
31###	TASIN		run asin tests
32###	TATAN		run atan tests
33###	TEXP		run exp tests
34###	TMACHA		run machar tests
35###	TPOWER		run power tests
36###	TSIN		run sin tests
37###	TSINH		run sinh tests
38###	TSQRT		run sqrt tests
39###	TTAN		run tan tests
40###	TTANH		run tanh tests
41###	tallqp$(X)	make executable to run all quadruple-precision tests
42###	talog$(X)	make executable to test alog
43###	tasin$(X)	make executable to test asin
44###	tatan$(X)	make executable to test atan
45###	texp$(X)	make executable to test exp
46###	tmacha$(X)	make executable to test machar
47###	tpower$(X)	make executable to test power
48###	tsin$(X)	make executable to test sin
49###	tsinh$(X)	make executable to test sinh
50###	tsqrt$(X)	make executable to test sqrt
51###	ttan$(X)	make executable to test tan
52###	ttanh$(X)	make executable to test tanh
53###	uninstall	dummy target
54###
55### [27-May-2002] -- Update with GNU standard targets, and delete old
56###		     Fortran and Pascal references, since their code
57###		     exists in separate directories
58### [23-Feb-1988] -- Update with NAME option, prefix identifying text to all
59###		   output files, add time prefix to commands.
60### [10-Jan-1987] -- Original version.
61### ====================================================================
62
63CFLAGS		= $(DEFINES) $(INCLUDES) $(OPT) $(XCFLAGS)
64
65DEFINES		= $(XDEFINES)
66
67### This is how stderr is redirected to stdout in standard sh
68ERROUT		= 2>&1
69
70### Compilation on Sun systems needs <sunmath.h> for
71### quadruple-precision library function prototypes; gcc will need
72### this -I option:
73INCLUDES	= -I/opt/SUNWspro/WS6U2/include/cc $(XINCLUDES)
74INCLUDES	= $(XINCLUDES)
75
76### Here is how we find the host name.
77HOSTNAME	= `hostname`
78
79LDFLAGS		= $(XLDFLAGS)
80
81### Sun Solaris 2.8 needs -lsunmath for quadruple-precision library routines
82LIBS		= -L/opt/SUNWspro/WS6U2/lib -lsunmath -lm
83LIBS		= $(XLIBS) -lm
84
85LINTFLAGS	= -abchnpx $(DEFINES)
86
87### MFLAGS are the combined flags to be passed to inferior makes
88MFLAGS		= -i "NAME=$(NAME)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" $(XMFLAGS)
89
90### Output file name appendage
91NAME		= xxx
92
93OPT		= -g $(XOPT)
94
95RM		= /bin/rm -f
96
97SHELL		= /bin/sh
98
99### XCFLAGS is for additional options to built-in CFLAGS value
100XCFLAGS		=
101
102XDEFINES	=
103
104XINCLUDES	=
105
106XLDFLAGS	=
107
108XLIBS		=
109
110### XMFLAGS are additional options to pass to inferior makes
111XMFLAGS		=
112
113XOPT		=
114
115### File extensions:
116
117L		= lst
118
119O		= o
120
121OUT		= $(L)-$(NAME)
122
123X		=
124
125### File and test lists:
126
127CFILES          = ipowl.c macharl.c qran.c qrandl.c storel.c tallqp.c talog.c \
128		  tasin.c tatan.c texp.c tmacha.c tpower.c tsin.c tsinh.c \
129		  tsqrt.c ttan.c ttanh.c
130
131COMMONOBJS	= initseed.$(O) maxtest.$(O)
132
133OBJS            = $(COMMONOBJS) ipowl.$(O) macharl.$(O) qran.$(O) qrandl.$(O) \
134		  storel.$(O)
135
136TALLQPOBJS      = talog.$(O) tasin.$(O) tatan.$(O) texp.$(O) tmacha.$(O) \
137		  tpower.$(O) tsin.$(O) tsinh.$(O) tsqrt.$(O) ttan.$(O) \
138		  ttanh.$(O)
139
140TESTS           = TMACHA TALOG TASIN TATAN TEXP TPOWER TSIN TSINH TSQRT TTAN \
141		  TTANH
142
143### ====================================================================
144
145.SUFFIXES:
146
147.SUFFIXES:	.o .i .c
148
149.c.i:
150	$(CC) $(CFLAGS) -E $< > $*.i
151
152### ====================================================================
153
154all:	TALLQP
155
156check:
157	for f in $(TESTS) ; \
158	do \
159		$(MAKE) $$f ; \
160	done
161
162clean:
163	-$(RM) $(COMMONOBJS)
164	-$(RM) *.i
165	-$(RM) *.nm
166	-$(RM) *.$(O)
167	-$(RM) a.out core ./*~ ./#*
168	-$(RM) lint.lst
169	-$(RM) tallqp$(X)
170	-$(RM) talog$(X)
171	-$(RM) tasin$(X)
172	-$(RM) tatan$(X)
173	-$(RM) texp$(X)
174	-$(RM) tmacha$(X)
175	-$(RM) tpower$(X)
176	-$(RM) tsin$(X)
177	-$(RM) tsinh$(X)
178	-$(RM) tsqrt$(X)
179	-$(RM) ttan$(X)
180	-$(RM) ttanh$(X)
181
182clobber:	distclean
183
184distclean:	mostlyclean
185	-$(RM) t*.$(OUT)
186
187install:
188	@echo There is nothing to install for this package.
189
190lint:	$(CFILES)
191	lint $(LINTFLAGS) $(CFILES) >>lint.lst $(ERROUT)
192
193maintainer-clean:	distclean
194	@echo "This command is intended for maintainers to use;"
195	@echo "it deletes files that may require special tools to rebuild."
196
197mostlyclean:	clean
198	-$(RM) *.s
199
200TALLQP:	tallqp$(X)
201	$(MAKE) $(MFLAGS) TITLE="./tallqp$(X) >>tallqp.$(OUT) $(ERROUT)"\
202		OUTFILE=tallqp.$(OUT) header
203	./tallqp$(X) >>tallqp.$(OUT) $(ERROUT)
204
205TALOG:	talog$(X)
206	$(MAKE) $(MFLAGS) TITLE="./talog$(X) >>talog.$(OUT) $(ERROUT)"\
207		OUTFILE=talog.$(OUT) header
208	./talog$(X) >>talog.$(OUT) $(ERROUT)
209
210TASIN:	tasin$(X)
211	$(MAKE) $(MFLAGS) TITLE="./tasin$(X) >>tasin.$(OUT) $(ERROUT)"\
212		OUTFILE=tasin.$(OUT) header
213	./tasin$(X) >>tasin.$(OUT) $(ERROUT)
214
215TATAN:	tatan$(X)
216	$(MAKE) $(MFLAGS) TITLE="./tatan$(X) >>tatan.$(OUT) $(ERROUT)"\
217		OUTFILE=tatan.$(OUT) header
218	./tatan$(X) >>tatan.$(OUT) $(ERROUT)
219
220TEXP:	texp$(X)
221	$(MAKE) $(MFLAGS) TITLE="./texp$(X) >>texp.$(OUT) $(ERROUT)"\
222		OUTFILE=texp.$(OUT) header
223	./texp$(X) >>texp.$(OUT) $(ERROUT)
224
225TMACHA:	tmacha$(X)
226	$(MAKE) $(MFLAGS) TITLE="./tmacha$(X) >>tmacha.$(OUT) $(ERROUT)"\
227		OUTFILE=tmacha.$(OUT) header
228	./tmacha$(X) >>tmacha.$(OUT) $(ERROUT)
229
230TPOWER:	tpower$(X)
231	$(MAKE) $(MFLAGS) TITLE="./tpower$(X) >>tpower.$(OUT) $(ERROUT)"\
232		OUTFILE=tpower.$(OUT) header
233	./tpower$(X) >>tpower.$(OUT) $(ERROUT)
234
235TSIN:	tsin$(X)
236	$(MAKE) $(MFLAGS) TITLE="./tsin$(X) >>tsin.$(OUT) $(ERROUT)"\
237		OUTFILE=tsin.$(OUT) header
238	./tsin$(X) >>tsin.$(OUT) $(ERROUT)
239
240TSINH:	tsinh$(X)
241	$(MAKE) $(MFLAGS) TITLE="./tsinh$(X) >>tsinh.$(OUT) $(ERROUT)"\
242		OUTFILE=tsinh.$(OUT) header
243	./tsinh$(X) >>tsinh.$(OUT) $(ERROUT)
244
245TSQRT:	tsqrt$(X)
246	$(MAKE) $(MFLAGS) TITLE="./tsqrt$(X) >>tsqrt.$(OUT) $(ERROUT)"\
247		OUTFILE=tsqrt.$(OUT) header
248	./tsqrt$(X) >>tsqrt.$(OUT) $(ERROUT)
249
250TTAN:	ttan$(X)
251	$(MAKE) $(MFLAGS) TITLE="./ttan$(X) >>ttan.$(OUT) $(ERROUT)"\
252		OUTFILE=ttan.$(OUT) header
253	./ttan$(X) >>ttan.$(OUT) $(ERROUT)
254
255TTANH:	ttanh$(X)
256	$(MAKE) $(MFLAGS) TITLE="./ttanh$(X) >>ttanh.$(OUT) $(ERROUT)"\
257		OUTFILE=ttanh.$(OUT) header
258	./ttanh$(X) >>ttanh.$(OUT) $(ERROUT)
259
260tmacha$(X):	../common/mmacha.$(O) tmacha.$(O) $(OBJS)
261	$(CC) $(CFLAGS) -o $@ ../common/mmacha.$(O) tmacha.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
262
263tallqp$(X):	tallqp.$(O) $(TALLQPOBJS) $(OBJS)
264	$(CC) $(CFLAGS) -o $@ tallqp.$(O) $(TALLQPOBJS) $(OBJS) $(LDFLAGS) $(LIBS)
265
266talog$(X):	../common/malog.$(O) talog.$(O) $(OBJS)
267	$(CC) $(CFLAGS) -o $@ ../common/malog.$(O) talog.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
268
269tasin$(X):	../common/masin.$(O) tasin.$(O) $(OBJS)
270	$(CC) $(CFLAGS) -o $@ ../common/masin.$(O) tasin.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
271
272tatan$(X):	../common/matan.$(O) tatan.$(O) $(OBJS)
273	$(CC) $(CFLAGS) -o $@ ../common/matan.$(O) tatan.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
274
275texp$(X):	../common/mexp.$(O) texp.$(O) $(OBJS)
276	$(CC) $(CFLAGS) -o $@ ../common/mexp.$(O) texp.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
277
278tpower$(X):	../common/mpower.$(O) tpower.$(O) $(OBJS)
279	$(CC) $(CFLAGS) -o $@ ../common/mpower.$(O) tpower.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
280
281tsin$(X):	../common/msin.$(O) tsin.$(O) $(OBJS)
282	$(CC) $(CFLAGS) -o $@ ../common/msin.$(O) tsin.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
283
284tsinh$(X):	../common/msinh.$(O) tsinh.$(O) $(OBJS)
285	$(CC) $(CFLAGS) -o $@ ../common/msinh.$(O) tsinh.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
286
287tsqrt$(X):	../common/msqrt.$(O) tsqrt.$(O) $(OBJS)
288	$(CC) $(CFLAGS) -o $@ ../common/msqrt.$(O) tsqrt.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
289
290ttan$(X):	../common/mtan.$(O) ttan.$(O) $(OBJS)
291	$(CC) $(CFLAGS) -o $@ ../common/mtan.$(O) ttan.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
292
293ttanh$(X):	../common/mtanh.$(O) ttanh.$(O) $(OBJS)
294	$(CC) $(CFLAGS) -o $@ ../common/mtanh.$(O) ttanh.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
295
296### Internal make target for constructing uniform output file headers
297header:
298	(	echo "Host        = $(HOSTNAME)" ; \
299		echo "Command     = $(TITLE)" ; \
300		echo "uname -a    = `uname -a`" ; \
301		echo "Make flags  = $(MFLAGS)" ; \
302		echo "Date        = `date`" ; \
303		echo "----------------------------------------" ; \
304		echo " ") >$(OUTFILE)
305
306### This target just shows a quick summary of the tests with their
307### name and accuracy loss.  Detailed examination of the output is
308### required for a proper evaluation of the results.
309summary:
310	egrep "^1|ESTIMATED LOSS" *.$(OUT)
311
312uninstall:
313
314### Object file dependencies:
315ELEFUNT_H	= elefunt.h ../common/elefunt.h
316ipowl.o:	ipowl.c $(ELEFUNT_H)
317macharl.o:	macharl.c $(ELEFUNT_H)
318qran.o:		qran.c $(ELEFUNT_H)
319qrandl.o:	qrandl.c $(ELEFUNT_H)
320storel.o:	storel.c $(ELEFUNT_H)
321tallqp.o:	tallqp.c $(ELEFUNT_H)
322talog.o:	talog.c $(ELEFUNT_H)
323tasin.o:	tasin.c $(ELEFUNT_H)
324tatan.o:	tatan.c $(ELEFUNT_H)
325texp.o:		texp.c $(ELEFUNT_H)
326tmacha.o:	tmacha.c $(ELEFUNT_H)
327tpower.o:	tpower.c $(ELEFUNT_H)
328tsin.o:		tsin.c $(ELEFUNT_H)
329tsinh.o:	tsinh.c $(ELEFUNT_H)
330tsqrt.o:	tsqrt.c $(ELEFUNT_H)
331ttan.o:		ttan.c $(ELEFUNT_H)
332ttanh.o:	ttanh.c $(ELEFUNT_H)
333