1### ====================================================================
2### Makefile for double-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 talldp 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###	TALLDP		run all double-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###	talldp$(X)	make executable to run all double-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
70INCLUDES	= $(XINCLUDES)
71
72### Here is how we find the host name.
73HOSTNAME	= `hostname`
74
75LDFLAGS		= $(XLDFLAGS)
76
77LIBS		= $(XLIBS) -lm
78
79LINTFLAGS	= -abchnpx $(DEFINES)
80
81### MFLAGS are the combined flags to be passed to inferior makes
82MFLAGS		= -i "NAME=$(NAME)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" $(XMFLAGS)
83
84OPT		= -g $(XOPT)
85
86RM		= /bin/rm -f
87
88SHELL		= /bin/sh
89
90### XCFLAGS is for additional options to built-in CFLAGS value
91XCFLAGS		=
92
93XDEFINES	=
94
95XINCLUDES	=
96
97XLDFLAGS	=
98
99XLIBS		=
100
101### XMFLAGS are additional options to pass to inferior makes
102XMFLAGS		=
103
104XOPT		=
105
106### File extensions:
107
108LST		= lst
109
110### Output file name appendage
111NAME		= xxx
112
113O		= o
114
115OUT		= $(LST)-$(NAME)
116
117X		=
118
119### File and test lists:
120
121CFILES          = ipow.c machar.c ran.c randl.c store.c talldp.c talog.c \
122		  tasin.c tatan.c texp.c tmacha.c tpower.c tsin.c tsinh.c \
123		  tsqrt.c ttan.c ttanh.c
124
125COMMONOBJS	= initseed.$(O) maxtest.$(O)
126
127OBJS            = $(COMMONOBJS) ipow.$(O) machar.$(O) ran.$(O) randl.$(O) \
128		  store.$(O)
129
130TALLDPOBJS      = talog.$(O) tasin.$(O) tatan.$(O) texp.$(O) tmacha.$(O) \
131		  tpower.$(O) tsin.$(O) tsinh.$(O) tsqrt.$(O) ttan.$(O) \
132		  ttanh.$(O)
133
134TESTS           = TMACHA TALOG TASIN TATAN TEXP TPOWER TSIN TSINH TSQRT TTAN \
135		  TTANH
136
137### ====================================================================
138
139.SUFFIXES:
140
141.SUFFIXES:	.o .i .c
142
143.c.i:
144	$(CC) $(CFLAGS) -E $< > $*.i
145
146### ====================================================================
147
148all:	TALLDP
149
150check:
151	for f in $(TESTS) ; \
152	do \
153		$(MAKE) $$f ; \
154	done
155
156clean:
157	-$(RM) $(COMMONOBJS)
158	-$(RM) *.i
159	-$(RM) *.nm
160	-$(RM) *.$(O)
161	-$(RM) a.out core ./*~ ./#*
162	-$(RM) lint.lst
163	-$(RM) talldp$(X)
164	-$(RM) talog$(X)
165	-$(RM) tasin$(X)
166	-$(RM) tatan$(X)
167	-$(RM) texp$(X)
168	-$(RM) tmacha$(X)
169	-$(RM) tpower$(X)
170	-$(RM) tsin$(X)
171	-$(RM) tsinh$(X)
172	-$(RM) tsqrt$(X)
173	-$(RM) ttan$(X)
174	-$(RM) ttanh$(X)
175
176clobber:	distclean
177
178distclean:	mostlyclean
179	-$(RM) t*.$(LST) t*.$(LST)-xxx t*.$(OUT)
180
181install:
182	@echo There is nothing to install for this package.
183
184lint:	$(CFILES)
185	lint $(LINTFLAGS) $(CFILES) >>lint.lst $(ERROUT)
186
187maintainer-clean:	distclean
188	@echo "This command is intended for maintainers to use;"
189	@echo "it deletes files that may require special tools to rebuild."
190
191mostlyclean:	clean
192	-$(RM) *.s
193
194TALLDP:	talldp$(X)
195	$(MAKE) $(MFLAGS) TITLE="./talldp$(X) >>talldp.$(OUT) $(ERROUT)"\
196		OUTFILE=talldp.$(OUT) header
197	./talldp$(X) >>talldp.$(OUT) $(ERROUT)
198
199TALOG:	talog$(X)
200	$(MAKE) $(MFLAGS) TITLE="./talog$(X) >>talog.$(OUT) $(ERROUT)"\
201		OUTFILE=talog.$(OUT) header
202	./talog$(X) >>talog.$(OUT) $(ERROUT)
203
204TASIN:	tasin$(X)
205	$(MAKE) $(MFLAGS) TITLE="./tasin$(X) >>tasin.$(OUT) $(ERROUT)"\
206		OUTFILE=tasin.$(OUT) header
207	./tasin$(X) >>tasin.$(OUT) $(ERROUT)
208
209TATAN:	tatan$(X)
210	$(MAKE) $(MFLAGS) TITLE="./tatan$(X) >>tatan.$(OUT) $(ERROUT)"\
211		OUTFILE=tatan.$(OUT) header
212	./tatan$(X) >>tatan.$(OUT) $(ERROUT)
213
214TEXP:	texp$(X)
215	$(MAKE) $(MFLAGS) TITLE="./texp$(X) >>texp.$(OUT) $(ERROUT)"\
216		OUTFILE=texp.$(OUT) header
217	./texp$(X) >>texp.$(OUT) $(ERROUT)
218
219TMACHA:	tmacha$(X)
220	$(MAKE) $(MFLAGS) TITLE="./tmacha$(X) >>tmacha.$(OUT) $(ERROUT)"\
221		OUTFILE=tmacha.$(OUT) header
222	./tmacha$(X) >>tmacha.$(OUT) $(ERROUT)
223
224TPOWER:	tpower$(X)
225	$(MAKE) $(MFLAGS) TITLE="./tpower$(X) >>tpower.$(OUT) $(ERROUT)"\
226		OUTFILE=tpower.$(OUT) header
227	./tpower$(X) >>tpower.$(OUT) $(ERROUT)
228
229TSIN:	tsin$(X)
230	$(MAKE) $(MFLAGS) TITLE="./tsin$(X) >>tsin.$(OUT) $(ERROUT)"\
231		OUTFILE=tsin.$(OUT) header
232	./tsin$(X) >>tsin.$(OUT) $(ERROUT)
233
234TSINH:	tsinh$(X)
235	$(MAKE) $(MFLAGS) TITLE="./tsinh$(X) >>tsinh.$(OUT) $(ERROUT)"\
236		OUTFILE=tsinh.$(OUT) header
237	./tsinh$(X) >>tsinh.$(OUT) $(ERROUT)
238
239TSQRT:	tsqrt$(X)
240	$(MAKE) $(MFLAGS) TITLE="./tsqrt$(X) >>tsqrt.$(OUT) $(ERROUT)"\
241		OUTFILE=tsqrt.$(OUT) header
242	./tsqrt$(X) >>tsqrt.$(OUT) $(ERROUT)
243
244TTAN:	ttan$(X)
245	$(MAKE) $(MFLAGS) TITLE="./ttan$(X) >>ttan.$(OUT) $(ERROUT)"\
246		OUTFILE=ttan.$(OUT) header
247	./ttan$(X) >>ttan.$(OUT) $(ERROUT)
248
249TTANH:	ttanh$(X)
250	$(MAKE) $(MFLAGS) TITLE="./ttanh$(X) >>ttanh.$(OUT) $(ERROUT)"\
251		OUTFILE=ttanh.$(OUT) header
252	./ttanh$(X) >>ttanh.$(OUT) $(ERROUT)
253
254tmacha$(X):	../common/mmacha.$(O) tmacha.$(O) $(OBJS)
255	$(CC) $(CFLAGS) -o $@ ../common/mmacha.$(O) tmacha.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
256
257talldp$(X):	talldp.$(O) $(TALLDPOBJS) $(OBJS)
258	$(CC) $(CFLAGS) -o $@ talldp.$(O) $(TALLDPOBJS) $(OBJS) $(LDFLAGS) $(LIBS)
259
260talog$(X):	../common/malog.$(O) talog.$(O) $(OBJS)
261	$(CC) $(CFLAGS) -o $@ ../common/malog.$(O) talog.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
262
263tasin$(X):	../common/masin.$(O) tasin.$(O) $(OBJS)
264	$(CC) $(CFLAGS) -o $@ ../common/masin.$(O) tasin.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
265
266tatan$(X):	../common/matan.$(O) tatan.$(O) $(OBJS)
267	$(CC) $(CFLAGS) -o $@ ../common/matan.$(O) tatan.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
268
269texp$(X):	../common/mexp.$(O) texp.$(O) $(OBJS)
270	$(CC) $(CFLAGS) -o $@ ../common/mexp.$(O) texp.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
271
272tpower$(X):	../common/mpower.$(O) tpower.$(O) $(OBJS)
273	$(CC) $(CFLAGS) -o $@ ../common/mpower.$(O) tpower.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
274
275tsin$(X):	../common/msin.$(O) tsin.$(O) $(OBJS)
276	$(CC) $(CFLAGS) -o $@ ../common/msin.$(O) tsin.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
277
278tsinh$(X):	../common/msinh.$(O) tsinh.$(O) $(OBJS)
279	$(CC) $(CFLAGS) -o $@ ../common/msinh.$(O) tsinh.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
280
281tsqrt$(X):	../common/msqrt.$(O) tsqrt.$(O) $(OBJS)
282	$(CC) $(CFLAGS) -o $@ ../common/msqrt.$(O) tsqrt.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
283
284ttan$(X):	../common/mtan.$(O) ttan.$(O) $(OBJS)
285	$(CC) $(CFLAGS) -o $@ ../common/mtan.$(O) ttan.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
286
287ttanh$(X):	../common/mtanh.$(O) ttanh.$(O) $(OBJS)
288	$(CC) $(CFLAGS) -o $@ ../common/mtanh.$(O) ttanh.$(O) $(OBJS) $(LDFLAGS) $(LIBS)
289
290### Internal make target for constructing uniform output file headers
291header:
292	(	echo "Host        = $(HOSTNAME)" ; \
293		echo "Command     = $(TITLE)" ; \
294		echo "uname -a    = `uname -a`" ; \
295		echo "Make flags  = $(MFLAGS)" ; \
296		echo "Date        = `date`" ; \
297		echo "----------------------------------------" ; \
298		echo " ") >$(OUTFILE)
299
300### This target just shows a quick summary of the tests with their
301### name and accuracy loss.  Detailed examination of the output is
302### required for a proper evaluation of the results.
303summary:
304	egrep "^1|ESTIMATED LOSS" *.$(OUT)
305
306uninstall:
307
308### Object file dependencies:
309ELEFUNT_H	= elefunt.h ../common/elefunt.h
310ipow.o:		ipow.c $(ELEFUNT_H)
311machar.o:	machar.c $(ELEFUNT_H)
312ran.o:		ran.c $(ELEFUNT_H)
313randl.o:	randl.c $(ELEFUNT_H)
314store.o:	store.c $(ELEFUNT_H)
315talldp.o:	talldp.c $(ELEFUNT_H)
316talog.o:	talog.c $(ELEFUNT_H)
317tasin.o:	tasin.c $(ELEFUNT_H)
318tatan.o:	tatan.c $(ELEFUNT_H)
319texp.o:		texp.c $(ELEFUNT_H)
320tmacha.o:	tmacha.c $(ELEFUNT_H)
321tpower.o:	tpower.c $(ELEFUNT_H)
322tsin.o:		tsin.c $(ELEFUNT_H)
323tsinh.o:	tsinh.c $(ELEFUNT_H)
324tsqrt.o:	tsqrt.c $(ELEFUNT_H)
325ttan.o:		ttan.c $(ELEFUNT_H)
326ttanh.o:	ttanh.c $(ELEFUNT_H)
327