forked from libdfp/libdfp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
571 lines (464 loc) · 22 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
ifneq (,)
This Makefile requires GNU Make.
endif
top_srcdir := @top_srcdir@
top_builddir = .
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
docdir = @docdir@
# Where to install the library and object files.
ifndef libdir
libdir = $(exec_prefix)/lib
endif
inst_libdir = $(install_root)$(libdir)
# Where to install the header files.
ifndef includedir
includedir = $(prefix)/include
endif
inst_includedir = $(install_root)$(includedir)
# Where to install the README document
ifndef docdir
docdir = $(prefix)/share/doc/
endif
inst_docdir = $(install_root)$(docdir)
dfp_name = @PACKAGE_NAME@
dfp_version = @PACKAGE_VERSION@
STATIC_LIB = @[email protected]
# The real library code: e.g. libdfp-1.0.0.so.
SHARED_REALNAME_LIB = @PACKAGE_NAME@-@[email protected]
# The soname that symlinks to the real library code: e.g. libdfp.so.1.
# Traditionally the version number on the soname defined the 'interface'
# version. Since this library intends to use symbol versioning there
# probably isn't ever a reason to move to .so.2 or later but we'll follow the
# precedent.
SHARED_SONAME_LIB = @[email protected]
# The linkername that symlinks to the soname: e.g. libdfp.so. The linker looks for this name.
SHARED_LINKERNAME_LIB = @[email protected]
CC = @CC@
CXX = @CXX@
LDD = @LDD@
OBJDUMP = @OBJDUMP@
READELF = @READELF@
GDB = @GDB@
CXXFLAGS = @CXXFLAGS@ # This may be naive
CPPFLAGS = @CPPFLAGS@
RANLIB = @RANLIB@
AWK = @AWK@
LDFLAGS = @LDFLAGS@
INSTALL := install
# libdecnumber or libbid
dfp_backend = @dfp_backend@
dfp_backend_lib = @[email protected]
# dpd or bid
dfp_encoding = @enable_decimal_float@
# e.g. powerpc
base_machine = @base_machine@
# e.g. powerpc32
machine = @machine@
# e.g. power6
submachine = @submachine@
# e.g. -mcpu=power6
libdfp_cv_submachine_opt = @libdfp_cv_submachine_opt@
# Necessary for z9-ec and z10 s390 platforms.
mzarch = @mzarch@
ifdef libdfp_cv_submachine_opt
cflags-cpu = $(libdfp_cv_submachine_opt)
asflags-cpu = $(libdfp_cv_submachine_opt)
endif
# Only try building TImode files if it is support.
dfp_ti_abi = @dfp_ti_abi@
# Need to check a different PLT file for int128
ifeq ($(dfp_ti_abi),yes)
dfp_abi_extn =
else
dfp_abi_extn = -no-ti
endif
picflag = @picflag@
# Yes this is a bit of a hack, but gcc/libdecnumber/Makefile won't allow
# CFLAGS to be overridden on a submake invocation.
BACKEND_CFLAGS=
ifeq (libdecnumber, $(dfp_backend))
BACKEND_CFLAGS=$(cflags-cpu) $(picflag)
endif
cxxdecimal = @cxxdecimal@
default_cflags := @CFLAGS@
default_asflags := @ASFLAGS@
ifndef +cflags
# Remove -I stuff from CFLAGS.
+cflags := $(filter-out -I%,$(default_cflags))
endif
# Add -mcpu=<CPU> targets and -f[pic|PIC].
+cflags += $(cflags-cpu) $(picflag)
# Don't duplicate options.
+cflags := $(sort $(+cflags))
override CFLAGS = $(gnu-inline-CFLAGS) $(+cflags)
# These are the flags given to the compiler to tell it what sort of
# optimization and/or debugging output to do for .S files.
ifndef +asflags
# Remove -I stuff from ASFLAGS.
+asflags := $(filter-out -I%,$(default_asflags))
endif
# This makes sure -mcpu=CPU gets used when gcc is invoked against .S files.
# Also pull in CFLAGS so we get -m<size> options set by the configuration.
+asflags += $(asflags-cpu) $(filter -g%,$(CFLAGS)) $(filter -m%,$(CFLAGS))
# Don't duplicate options.
+asflags := $(sort $(+asflags))
override ASFLAGS = $(+asflags)
sysdep_dirs = @sysdep_dirs@
# This is the precedence ordered list of subdirectories that configure
# selected for searching based upon submachine, machine, base_machine,
# dfp_encoding, and dfp_backend. Add the ieee754r and decNumberMath
# convenience directories to the list.
# Find each sysdep directory or convenience directory with a Makefile in it.
makefile_dirs := $(foreach odir,$(sysdep_dirs), $(dir $(wildcard $(top_srcdir)/$(odir)/Makefile))) $(top_srcdir)/decNumberMath/ $(top_srcdir)/ieee754r/ $(top_srcdir)/base-math
# Like $makefile_dirs but add the $(top_srcdir) reference and strip out the redundant spaces.
# This has to be = assigned.
all_srcdirs = $(strip $(foreach dir,$(sysdep_dirs), $(top_srcdir)/$(dir))) $(top_srcdir)/decNumberMath/ $(top_srcdir)/ieee754r/ $(top_srcdir)/base-math $(top_srcdir)/ $(top_srcdir)/tests
# We need to add the $(dfp_backend) directories to the search path in order to
# pick up header files in those directories.
ifeq ($(dfp_backend),libdecnumber)
# libdecnumber/bid or libdecnumber/dpd holds header files.
backend_headers := $(dfp_backend)/$(dfp_encoding) $(dfp_backend)
else # libbid
# TODO implement
backend_headers :=
endif
# For header files we want to search every directory that is relevant. We
# have to include $(top_builddir) in order to pick up the configure generated
# config.h.
system_header_dirs := dfp dfp/decimal
header_dirs := $(strip include $(system_header_dirs) $(backend_headers) $(sysdep_dirs) decNumberMath/ ieee754/ base-math/)
header_search_dirs := $(header_dirs:%=$(top_srcdir)/%) $(top_srcdir) $(top_builddir)
# GNU Make hack to reference a ' ' (space) character as the `from' function parameter in $(subst from,to,...).
sp :=
sp +=
# VPATH only needs to know the directory that source files are in. Headers
# are searched based on -I precedence during the compilation invocation.
VPATH := $(subst $(sp),:,$(all_srcdirs))
# Files common to the $(top_srcdir). These may be overriden in the sysdep
# directories and this list may have additional files added by sysdeps
# directory Makefiles which are included (not recursively invoked).
libdfp_files := dfptypeconv mapround decode fmt_d32 fmt_d64 fmt_d128 fe_decround \
strtod32 strtod64 strtod128 wcstod32 wcstod64 wcstod128 \
printf_dfp init_dfp libdfp-version
# The sysdeps subdirs aren't recursively invoked, they're included so that
# they can add files to the libdfp_files list.
include $(foreach dir,$(makefile_dirs), $(dir)/Makefile )
# Build the TImode files if we support them.
# Note that this does change the ABI.
ifeq ($(dfp_ti_abi),yes)
libdfp_files += $(libdfp_ti_files)
endif
# Libdfp has a dependency on the backend so build that first.
all: first $(dfp_backend)/$(dfp_backend_lib) libdfp
# Fake rule to output the VPATH before we build anything. Don't use .PHONY
# because we want this printed each time.
first:
@echo VPATH=$(VPATH)
@echo Processing Makefiles: $(makefile_dirs)
# Configure will have generated the Makefile for the selected backend. Let's
# add it to the subdir list so it gets recursively invoked by Make. Don't pass
# -e to make or it could pull unwanted variables from the environment.
# Yes, passing $(BACKEND_CFLAGS) in -DEFS is a hack, but since the
# libdecnumber maintainers won't allow CFLAGS to be overridden and the libdfp
# maintainer doesn't want to use libtool this hack will have to stand.
$(dfp_backend)/$(dfp_backend_lib):
@echo "+Building DFP backend $@"
DEFS="-D__STDC_DEC_FP__=200704L $(mzarch) $(BACKEND_CFLAGS)" $(MAKE) -C $(dfp_backend)
libdfp: @enable_static@ @enable_shared@
static: $(top_builddir)/$(STATIC_LIB)
# Create the actual file with the version, the .so linker symlink and its
# SONAME symlink.
shared: $(top_builddir)/$(SHARED_REALNAME_LIB) \
$(top_builddir)/$(SHARED_LINKERNAME_LIB) \
$(top_builddir)/$(SHARED_SONAME_LIB)
@echo +Building shared lib and symlinks: $(notdir $^)
WARNS := -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-long-long
C_DEFINES := -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1 -std=gnu99 -D_ISOC99_SOURCE
ASM_DEFINES := -D__ELF__ -D__ASSEMBLER__ -DASSEMBLER -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1
CXX_DEFINES := -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1 -D_ISOC99_SOURCE
CXX_WARNS := -W -Wall -Wwrite-strings -Wmissing-format-attribute -Wno-long-long
-include *.d
# Build the static object files.
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(mzarch) -MT $@ -MD -MP -MF $*.d -c $< $(C_DEFINES) $(WARNS) -include $(top_builddir)/config.h -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) -o $@
.S.o:
$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -MT $@ -MD -MP -MF $*.d -c $< $(ASM_DEFINES) $(WARNS) -include $(top_builddir)/config.h -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) -o $@
# Build the shared object files.
.c.os:
$(CC) $(CFLAGS) $(CPPFLAGS) $(mzarch) -MT $@ -MD -MP -MF $*.d -c $< $(C_DEFINES) $(WARNS) -include $(top_builddir)/config.h -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) -o $@
.S.os:
$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -MT $@ -MD -MP -MF $*.d -c $< $(ASM_DEFINES) $(WARNS) -include $(top_builddir)/config.h -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) -o $@
# C++ compatibility test cases.
.cpp.os:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(mzarch) -MT $@ -MD -MP -MF $*.d -c $< $(CXX_DEFINES) $(CXX_WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) -o $@
# Archive the static library and include all of the .o files from the backend
# archive. IF the backend has more than the base directory the .o detection
# mechanism will need to be more robust than this.
$(top_builddir)/$(STATIC_LIB): $(dfp_backend)/$(dfp_backend_lib) $(addsuffix .o,$(libdfp_files))
@echo +Creating static library $@
$(AR) rc $@ $(wordlist 2,$(words $^),$^) $(top_builddir)/$(dfp_backend)/*.o
@ranlibpath=`which $(RANLIB)`; \
if test -x "$$ranlibpath"; \
then $(RANLIB) $@; fi;
# Create libdfp.so -> libdfp.so.1 symlink.
$(top_builddir)/$(SHARED_LINKERNAME_LIB): $(top_builddir)/$(SHARED_REALNAME_LIB)
@echo "+Creating linker .so symlink $(notdir $@) -> $(notdir $<)"
ln -f -s $< $@
# Create libdfp.so.1 -> libdfp-1.0.1.so symlink.
$(top_builddir)/$(SHARED_SONAME_LIB): $(top_builddir)/$(SHARED_REALNAME_LIB)
@echo "+Create the library compat symlink $(notdir $@) -> $(notdir $<)"
ln -f -s $(notdir $<) $@
# Build the version tagged 'realname' shared object. This requires that the
# $(dfp_name).map file be composed out of individual Versions files. The
# -bsymbolic switch makes the library avoid using the PLT for intra-library
# calls.
$(top_builddir)/$(SHARED_REALNAME_LIB): $(top_builddir)/$(dfp_name).map $(dfp_backend)/$(dfp_backend_lib) $(addsuffix .os,$(libdfp_files))
@echo +Linking shared object files into $@.
$(CC) $(CFLAGS) $(LDFLAGS) $(mzarch) -shared -Wl,-soname,$(SHARED_SONAME_LIB) -Bsymbolic -Wl,--whole-archive $(dfp_backend)/$(dfp_backend_lib) -Wl,--no-whole-archive -Wl,--version-script,$(dfp_name).map -Wl,-entry=__libdfp_version $(addsuffix .os,$(libdfp_files)) -o $@ -lm -shared-libgcc
# The LIBDFP version script support is strongly based upon the GLIBC version
# script Makefile foo. Thank you Roland McGrath and Ulrich Drepper!
# Versions.def defines the package versions.
$(top_builddir)/Versions.all: $(..)scripts/firstversions.awk \
$(top_srcdir)/Versions.def
@echo +Creating $@ by running $(word 1,$^) against $(word 2,$^).
{ cat $(word 2,$^); } | LC_ALL=C $(AWK) -f $< > $@T
mv -f $@T $@
# Versions.sysdeps is a concatenation of all of the sysdep directory Versions
# files (that accompany a Makefile) and run through sed to strip comments. We
# use the wildcard function to verify that there actually is a Versions file
# accompanying a Makefile before we set it as a dependency. Some sysdeps dirs
# only add internal interfaces.
$(top_builddir)/Versions.sysdeps: $(top_srcdir)/Versions $(wildcard $(makefile_dirs:%=%Versions))
@echo +Scrubbing the following Versions files for comments and concatenating into a single $@ file.
sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' $^ > $@T
mv -f $@T $@
move-if-change = $(SHELL) $(top_srcdir)/scripts/move-if-change
# This runs versions.awk and generates libdfp.map from the Versions.all and
# Versions.sysdeps files.
$(top_builddir)/sysd-versions: $(top_builddir)/Versions.all \
$(top_builddir)/Versions.sysdeps \
$(..)scripts/versions.awk
@echo +The following invocation of $(word 3,$^) outputs $(dfp_name).map automagically.
( echo 'sysd-versions-subdirs = $(strip $(top_srcdir)/ $(makefile_dirs))'; \
cat $(top_builddir)/$(word 2,$^) \
| LC_ALL=C $(AWK) -v buildroot="$(top_builddir)/" -v defsfile=$< \
-v move_if_change='$(move-if-change)' \
-f $(word 3,$^) \
) > $@T
mv $@T $@
# This rule causes sysd-versions to be generated, which in turn invokes
# versions.awk which generates libdfp.map implicitly.
$(top_builddir)/libdfp.map: $(top_builddir)/sysd-versions
GLIBC_LIBS := -lc -lm
libdfp_c_tests = test-printf test-amort test-decode test-inexact-exception \
test-strtod test-cast-to-overflow test-numdigits test-get_digits \
test-fenv test-bfp-conversions test-type-conversions test-wchar \
test-getexp test-setexp test-left_justify test-cast-to-underflow \
test-fpclassify-d32 test-fpclassify-d64 test-fpclassify-d128 \
test-fabs-d32 test-fabs-d64 test-fabs-d128 \
test-copysign-d32 test-copysign-d64 test-copysign-d128 \
test-quantum-d32 test-quantum-d64 test-quantum-d128 \
test-quantize-d32 test-quantize-d64 test-quantize-d128 \
test-samequantum-d32 test-samequantum-d64 test-samequantum-d128 \
test-exp-d32 test-exp-d64 test-exp-d128 \
test-log-d32 test-log-d64 test-log-d128 \
test-log1p-d32 test-log1p-d64 test-log1p-d128 \
test-logb-d32 test-logb-d64 test-logb-d128 \
test-log10-d32 test-log10-d64 test-log10-d128 \
test-llquantexp-d32 test-llquantexp-d64 test-llquantexp-d128 \
test-isnan-d32 test-isnan-d64 test-isnan-d128 \
test-isnan_internal-d32 test-isnan_internal-d64 test-isnan_internal-d128 \
test-isinf-d32 test-isinf-d64 test-isinf-d128 \
test-isfinite-d32 test-isfinite-d64 test-isfinite-d128 \
test-issignaling-d32 test-issignaling-d64 test-issignaling-d128 \
test-ilogb-d32 test-ilogb-d64 test-ilogb-d128 \
test-llogb-d32 test-llogb-d64 test-llogb-d128 \
test-ceil-d32 test-ceil-d64 test-ceil-d128 \
test-floor-d32 test-floor-d64 test-floor-d128 \
test-nearbyint-d32 test-nearbyint-d64 test-nearbyint-d128 \
test-round-d32 test-round-d64 test-round-d128 \
test-roundeven-d32 test-roundeven-d64 test-roundeven-d128 \
test-trunc-d32 test-trunc-d64 test-trunc-d128 \
test-isgreater-d32 test-isgreater-d64 test-isgreater-d128 \
test-isgreaterequal-d32 test-isgreaterequal-d64 test-isgreaterequal-d128 \
test-isless-d32 test-isless-d64 test-isless-d128 \
test-islessequal-d32 test-islessequal-d64 test-islessequal-d128 \
test-rint-d32 test-rint-d64 test-rint-d128 \
test-lround-d32 test-lround-d64 test-lround-d128 \
test-llround-d32 test-llround-d64 test-llround-d128 \
test-lrint-d32 test-lrint-d64 test-lrint-d128 \
test-llrint-d32 test-llrint-d64 test-llrint-d128 \
test-isnormal-d32 test-isnormal-d64 test-isnormal-d128 \
test-signbit-d32 test-signbit-d64 test-signbit-d128 \
test-fmin-d32 test-fmin-d64 test-fmin-d128 \
test-fmax-d32 test-fmax-d64 test-fmax-d128 \
test-fdim-d32 test-fdim-d64 test-fdim-d128 \
test-isunordered-d32 test-isunordered-d64 test-isunordered-d128 \
test-islessgreater-d32 test-islessgreater-d64 test-islessgreater-d128
ifeq ($(dfp_ti_abi),yes)
libdfp_c_tests += test-fix test-float
endif
# Only enable C++ tests if compiler supports std::decimal (GCC 4.5+),
# otherwise just skip them.
ifeq ($(cxxdecimal), yes)
libdfp_cxx_tests = test-ostream test-ostream-g-spec test-istream
endif
libdfp_tests = $(libdfp_c_tests) $(libdfp_cxx_tests) check-abi-libdfp check-localplt
test-printf.os: $(top_builddir)/printf_dfp.os
test-strtod.os: $(top_builddir)/strtod32.os $(top_builddir)/strtod64.os $(top_builddir)/strtod128.os
# Empty rule which simply makes the libdfp_tests .so's dependent on
# tests/libdfp-test.c so that when the libdfp-test file changes all of the test .so
# files are rebuilt since almost all of them depend on the scaffold anyway.
$(addsuffix .os, $(libdfp_tests)): $(top_srcdir)/tests/libdfp-test.c
# The CPP test rely on the <dfp/decimal> header. If that changes then they
# need to be rebuilt.
$(addsuffix .os, $(libdfp_cxx_tests)): $(top_srcdir)/dfp/decimal/decimal $(top_srcdir)/dfp/float.h
# Add the ULP file generation explicity rule
$(addprefix $(objpfx), $(libdfp_tests)): $(top_builddir)/libdfp-test-ulps.h
ulps-file = $(shell find $(sysdep_dirs:%=$(top_srcdir)/%/) \
-name libdfp-test-ulps | head -1)
$(top_builddir)/libdfp-test-ulps.h: $(ulps-file)
$(top_srcdir)/tests/gen-libdfp-ulps.py $< -o $@
# Explicitly link against the uninstalled GLIBC and the libdfp.so.1 we just
# built.
$(libdfp_c_tests): CFLAGS += -DNOT_IN_libdfp -I$(top_srcdir)/tests -Wl,--no-as-needed
$(libdfp_c_tests): %:%.os $(top_builddir)/$(SHARED_SONAME_LIB)
$(CC) $(CFLAGS) $(mzarch) $(top_builddir)/$(addsuffix .os,$@) -o $@ $(GLIBC_LIBS) -L$(top_builddir)/ -ldfp
# Explicitly link against the uninstalled GLIBC and the Libdfp.so.1 we just
# built.
$(libdfp_cxx_tests): CXXFLAGS += -DNOT_IN_libdfp -I$(top_srcdir)/tests -Wl,--no-as-needed
$(libdfp_cxx_tests): %:%.os $(top_builddir)/$(SHARED_SONAME_LIB)
$(CXX) $(CXXFLAGS) $(mzarch) $(top_builddir)/$(addsuffix .os,$@) -o $@ $(GLIBC_LIBS) -L$(top_builddir)/ -ldfp
test-%-d%: $(addsuffix .os,$@)
$(CC) $(CFLAGS) $(mzarch) $(GLIBC_LIBS) -L$(top_builddir)/ -ldfp $(top_builddir)/$^ -o $@
test-%-d32.c: %.input
$(top_srcdir)/tests/gen-libdfp-tests.py -t decimal32 $^ > $(top_builddir)/$@
test-%-d64.c: %.input
$(top_srcdir)/tests/gen-libdfp-tests.py -t decimal64 $^ > $(top_builddir)/$@
test-%-d128.c: %.input
$(top_srcdir)/tests/gen-libdfp-tests.py -t decimal128 $^ > $(top_builddir)/$@
# The name to give to a test in test results summaries.
test-name = $(strip $(patsubst %.out, %, $@))
# Likewise, in XFAIL variable names.
test-xfail-name = $(strip $(patsubst %.out, %, $@))
evaluate-test = $(top_srcdir)/scripts/evaluate-test.sh $(test-name) $$? \
$(if $(test-xfail-$(test-xfail-name)),true,false) \
false \
> $(top_builddir)/$(test-name).test-result
# Make check main rule
%.out: %
LD_LIBRARY_PATH=$(top_builddir)/:$$LD_LIBRARY_PATH $(top_builddir)/$(test-name) 2> $(top_builddir)/$@ 1> /dev/null; \
$(evaluate-test)
# Check ABI rules
.PRECIOUS: %.symlist
generated += $(extra-libs:=.symlist)
vpath %.abilist $(+sysdeps_dirs)
check-abi-libdfp.out: libdfp$(dfp_abi_extn).abilist libdfp.symlist
diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^) > $@; \
$(evaluate-test)
%.symlist: $(top_srcdir)/scripts/abilist.awk %.dynsym
LC_ALL=C $(AWK) -f $^ > $@T
mv -f $@T $@
%.dynsym: %.so
LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
mv -f $@T $@
# Check local PLT calls
vpath localplt.data $(+sysdep_dirs)
check-localplt.out: $(top_srcdir)/scripts/check-localplt.awk \
$(top_srcdir)/scripts/localplt.awk \
libdfp.so.jmprel \
localplt.data
LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
> $@; \
$(evaluate-test)
libdfp.so.jmprel: libdfp.so
@rm -f $@T
LC_ALL=C $(READELF) -W -S -d -r $< > $@T
test -s $@T
mv -f $@T $@
define summarize-tests
@egrep -v '^(PASS|XFAIL):' $(top_builddir)/$1 || true
@echo "Summary of test results$2:"
@sed 's/:.*//' < $(top_builddir)/$1 | sort | uniq -c
@! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(top_builddir)/$1
endef
tests: $(libdfp_tests:%=%.out)
$(top_srcdir)/scripts/merge-test-results.sh -s $(top_builddir)/ "" \
$(sort $(libdfp_tests)) \
> tests.sum
@echo Details of failed tests:
@awk -v builddir=$(top_builddir) \
'{ if ($$1 != "PASS:") printf "%s/%s.out ", builddir, $$2; }' \
tests.sum | xargs -n 1 cat
$(call summarize-tests,tests.sum)
# The .out files are predicated in another rule on the actual test executables, so
# those are built from those rules.
check: tests
.PHONY: check
clean:
rm -f *.o
rm -f *.os
rm -f $(STATIC_LIB)
rm -f $(SHARED_LINKERNAME_LIB)
rm -f $(SHARED_SONAME_LIB)
rm -f $(SHARED_REALNAME_LIB)
rm -f Versions.all
rm -f Versions.sysdeps
rm -f libdfp.map $(SHARED_LINKERNAME_LIB).jmprel libdfp.symlist
rm -f Versions.tmp
rm -f sysd-versions
rm -f $(addsuffix .out,$(libdfp_tests))
rm -f $(addsuffix .test-result,$(libdfp_tests))
rm -f $(addsuffix .conf,$(libdfp_tests))
rm -f $(libdfp_tests)
rm -f libdfp-test-ulps.h
rm -f $(top_builddir)/$(dfp_backend)/*.o
rm -f $(top_builddir)/$(dfp_backend)/*.a
.PHONY: clean
# distclean cleans up the files added by configure.
distclean:
rm -f $(top_builddir)/config.h
rm -f $(top_builddir)/config.log
rm -f $(top_builddir)/config.status
rm -f $(top_builddir)/Makefile
rm -f $(top_builddir)/$(dfp_backend)/config.h
rm -f $(top_builddir)/$(dfp_backend)/config.log
rm -f $(top_builddir)/$(dfp_backend)/config.status
rm -f $(top_builddir)/$(dfp_backend)/gstdint.h
rm -f $(top_builddir)/$(dfp_backend)/Makefile
rm -f $(top_builddir)/$(dfp_backend)/stamp-h1
.PHONY: distclean
install: all install-doc install-headers
$(INSTALL) -d $(inst_libdir)
ifeq ("@enable_static@","static")
$(INSTALL) -t $(inst_libdir) $(top_builddir)/$(STATIC_LIB)
endif
$(INSTALL) -t $(inst_libdir) $(top_builddir)/$(SHARED_REALNAME_LIB)
ln -f -s $(SHARED_REALNAME_LIB) $(inst_libdir)/$(SHARED_LINKERNAME_LIB)
ln -f -s $(SHARED_REALNAME_LIB) $(inst_libdir)/$(SHARED_SONAME_LIB)
.PHONY: install
install-headers:
$(INSTALL) -d $(inst_includedir)
$(INSTALL) -d $(inst_includedir)/dfp
$(INSTALL) -d $(inst_includedir)/dfp/decimal
$(INSTALL) -t $(inst_includedir)/dfp $(top_srcdir)/dfp/*.h
$(INSTALL) -t $(inst_includedir)/dfp/decimal/ $(top_srcdir)/dfp/decimal/*
.PHONY: install-headers
install-doc: $(top_srcdir)/ChangeLog.md
$(INSTALL) -d $(inst_docdir)dfp/
$(INSTALL) -t $(inst_docdir)dfp/ $(top_srcdir)/README.user
mv $(inst_docdir)dfp/README.user $(inst_docdir)dfp/README
$(INSTALL) -t $(inst_docdir)dfp/ $(top_srcdir)/ChangeLog.md
$(INSTALL) -t $(inst_docdir)dfp/ $(top_srcdir)/COPYING.txt
.PHONY: install-doc
$(top_srcdir)/ChangeLog.md:
cd $(top_srcdir) && ./generate-changelog.sh > $(top_srcdir)/ChangeLog.md
# Clean out the existing .SUFFIXES setting.
.SUFFIXES:
# Prioritize .S over .c when searching for target files. The .os suffix
# is used for shared object file and the .o suffix is for static object files.
.SUFFIXES: .S .c .cpp .o .os