aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-03-24 03:05:04 +0000
committerRoland McGrath <roland@gnu.org>1995-03-24 03:05:04 +0000
commit3ef21326e9f4644ce4058b7ceabd3bc6f10be374 (patch)
treee24bdcb7b33a3f466fc7d9081cd52da2cd96907d /stdlib
parent1b8145845fc5fc6bbc3f7fd7d1550a10a5465824 (diff)
downloadglibc-3ef21326e9f4644ce4058b7ceabd3bc6f10be374.tar
glibc-3ef21326e9f4644ce4058b7ceabd3bc6f10be374.tar.gz
glibc-3ef21326e9f4644ce4058b7ceabd3bc6f10be374.tar.bz2
glibc-3ef21326e9f4644ce4058b7ceabd3bc6f10be374.zip
All the mpn stuff moved here from stdio/Makefile.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/Makefile59
1 files changed, 59 insertions, 0 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index ea1ffd33e8..3ea206f623 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -40,4 +40,63 @@ routines := \
distribute := exit.h grouping.h
tests := tst-strtol tst-strtod testmb testrand testsort testdiv
+
+# Several mpn functions from GNU MP are used by the strtod function.
+mpn-routines := add_1 add_n addmul_1 cmp divmod divmod_1 udiv_qrnnd \
+ lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
+mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
+
+routines := $(strip $(routines) $(mpn-routines)) \
+ dbl2mpn ldbl2mpn \
+ mpn2flt mpn2dbl mpn2ldbl
+aux := mp_clz_tab fpioconst
+distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
+
+
include ../Rules
+
+
+ifdef gmp-srcdir
+
+gmp-srcdir := $(firstword $(filter-out ..//%,$(..)$(gmp-srcdir) $(gmp-srcdir)))
+
+# Copy the mpn source files we use from the GNU MP source directory.
+# `gmp-srcdir' is set by doing `configure --with-gmp=DIR'.
+# (Do not try this at home. You need an as yet unreleased version of GNU MP.)
+
+mpn-sysdep := $(addsuffix .c,$(mpn-routines)) \
+ $(addsuffix .S,$(mpn-routines)) \
+ $(addsuffix .s,$(mpn-routines)) gmp-mparam.h asm-syntax.h
+
+mpn-try := $(addprefix $(gmp-srcdir)/mpn/*/,$(mpn-sysdep))
+mpn-found := $(wildcard $(mpn-try))
+mpn-found := $(filter-out $(patsubst %.S,%.s,$(filter %.s,$(mpn-found))),\
+ $(mpn-found))
+
+include mpn-copy.mk
+%.mk: gen-%; sh $< > $@
+
+mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/%,$(sysdep_dir)/%,$(mpn-found))
+mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1)
+$(mpn-copy-1): $(sysdep_dir)/%: $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/%
+ $(gmp2glibc)
+
+mpn-stuff = $(mpn-copy-sysdep) $(mpn-copy)
+
+# chmod so I don't edit them by mistake.
+define gmp2glibc
+$(ignore sed -f $^ > $@-tmp)
+cp $< $@-tmp
+chmod a-w $@-tmp
+mv -f $@-tmp $@
+endef
+
+mpn-copy = $(filter-out $(mpn-sysdep),$(mpn-headers) mp_clz_tab.c)
+$(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
+
+.PHONY: copy-mpn clean-mpn
+copy-mpn: $(mpn-stuff)
+clean-mpn:
+ rm -f $(mpn-stuff)
+
+endif