-# Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+# Copyright (C) 1991-2014 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
+# Lesser General Public License for more details.
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
#
# Makefile for stdlib routines
#
subdir := stdlib
-headers := stdlib.h alloca.h monetary.h fmtmsg.h ucontext.h sys/ucontext.h \
- inttypes.h stdint.h bits/wordsize.h
+headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
+ monetary.h bits/monetary-ldbl.h \
+ inttypes.h stdint.h bits/wordsize.h \
+ errno.h sys/errno.h bits/errno.h \
+ ucontext.h sys/ucontext.h \
+ alloca.h fmtmsg.h \
+ bits/stdlib-bsearch.h
routines := \
atof atoi atol atoll \
abort \
bsearch qsort msort \
getenv putenv setenv secure-getenv \
- exit on_exit atexit cxa_atexit cxa_finalize \
+ exit on_exit atexit cxa_atexit cxa_finalize old_atexit \
+ quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
abs labs llabs \
div ldiv lldiv \
mblen mbstowcs mbtowc wcstombs wctomb \
rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
strtoimax strtoumax wcstoimax wcstoumax \
getcontext setcontext makecontext swapcontext
-
-distribute := exit.h grouping.h abort-instr.h isomac.c
-tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
- test-canon test-canon2 tst-strtoll tst-environ \
- tst-xpg-basename
-
+aux = grouping groupingwc tens_in_limb
+
+# These routines will be omitted from the libc shared object.
+# Instead the static object files will be included in a special archive
+# linked against when the shared library will be used.
+static-only-routines = atexit at_quick_exit
+
+test-srcs := tst-fmtmsg
+tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
+ test-canon test-canon2 tst-strtoll tst-environ \
+ tst-xpg-basename tst-random tst-random2 tst-bsearch \
+ tst-limits tst-rand48 bug-strtod tst-setcontext \
+ test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
+ tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
+ tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
+ tst-makecontext2 tst-strtod6 tst-unsetenv1 \
+ tst-makecontext3 bug-getcontext bug-fmtmsg1 \
+ tst-secure-getenv tst-strtod-overflow tst-strtod-round \
+ tst-tininess tst-strtod-underflow tst-tls-atexit
+tests-static := tst-secure-getenv
+
+modules-names = tst-tls-atexit-lib
+
+include ../Makeconfig
+
+ifeq ($(build-shared),yes)
+tests += tst-putenv
+endif
# Several mpn functions from GNU MP are used by the strtod function.
mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
routines := $(strip $(routines) $(mpn-routines)) \
dbl2mpn ldbl2mpn \
mpn2flt mpn2dbl mpn2ldbl
-aux := mp_clz_tab fpioconst
-distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
+aux += fpioconst mp_clz_tab
-generated += isomac isomac.out
+tests-extras += tst-putenvmod
+extra-test-objs += tst-putenvmod.os
-CFLAGS-bsearch.c = $(exceptions)
-CFLAGS-msort.c = $(exceptions)
-CFLAGS-qsort.c = $(exceptions)
+generated += isomac isomac.out tst-putenvmod.so
-include ../Rules
+CFLAGS-bsearch.c = $(uses-callbacks)
+CFLAGS-msort.c = $(uses-callbacks)
+CFLAGS-qsort.c = $(uses-callbacks)
+CFLAGS-system.c = -fexceptions
+CFLAGS-system.os = -fomit-frame-pointer
+CFLAGS-fmtmsg.c = -fexceptions
+CFLAGS-strfmon.c = $(libio-mtsafe)
+CFLAGS-strfmon_l.c = $(libio-mtsafe)
-ifdef gmp-srcdir
+CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
+CFLAGS-tst-qsort.c = $(stack-align-test-flags)
+CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
-gmp-srcdir := $(firstword $(filter-out ..//%,$(..)$(gmp-srcdir) $(gmp-srcdir)))
+include ../Rules
-# 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.)
+# Testdir has to be named stdlib and needs to be writable
+test-canon-ARGS = --test-dir=${common-objpfx}stdlib
-mpn-sysdep := $(addsuffix .c,$(mpn-routines)) \
- $(addsuffix .S,$(mpn-routines)) \
- $(addsuffix .s,$(mpn-routines)) gmp-mparam.h asm-syntax.h
+tst-strtod-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod3-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod4-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod5-ENV = LOCPATH=$(common-objpfx)localedata
+testmb2-ENV = LOCPATH=$(common-objpfx)localedata
+bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
-mpn-try := $(addprefix $(gmp-srcdir)/mpn/*/,$(mpn-sysdep)) \
- $(addprefix $(gmp-srcdir)/mpn/*/*/,$(mpn-sysdep))
-mpn-found = $(wildcard $(mpn-try))
+# Run a test on the header files we use.
+tests: $(objpfx)isomac.out
-include mpn-copy.mk
-%.mk: gen-%; sh $< > $@
+ifeq ($(run-built-tests),yes)
+tests: $(objpfx)tst-fmtmsg.out
+endif
-mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/%,$(sysdep_dir)/%,$(mpn-found))
-mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1)
-mpn-copy-sysdep := $(filter $(addsuffix %,\
- $(wildcard $(sort $(dir $(mpn-copy-sysdep))))), \
- $(mpn-copy-sysdep))
-$(mpn-copy-1): $(sysdep_dir)/%: $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/%
- $(gmp2glibc)
+$(objpfx)isomac.out: $(objpfx)isomac
+ $(dir $<)$(notdir $<) '$(CC)' \
+ '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out
-mpn-stuff = $(mpn-copy-sysdep) $(mpn-copy)
+isomac-CFLAGS = -O
+$(objpfx)isomac: isomac.c
+ $(native-compile)
-# 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
+$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/
-mpn-copy = $(filter-out $(mpn-sysdep),$(mpn-headers))# mp_clz_tab.c)
-$(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
+$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+LDFLAGS-tst-putenv = $(no-as-needed)
-.PHONY: copy-mpn clean-mpn mpn-stuff
-mpn-stuff: $(mpn-stuff)
-copy-mpn: $(mpn-stuff)
-ifeq ($(with-cvs),yes)
- test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $(gmp-srcdir)' $+
-endif
-clean-mpn:
- rm -f $(mpn-stuff)
+$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
+ $(build-module)
+CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
+ifeq ($(build-shared),yes)
+link-libm = $(common-objpfx)math/libm.so
+else
+link-libm = $(common-objpfx)math/libm.a
endif
+$(objpfx)bug-getcontext: $(link-libm)
+$(objpfx)tst-strtod-round: $(link-libm)
+$(objpfx)tst-tininess: $(link-libm)
+$(objpfx)tst-strtod-underflow: $(link-libm)
+$(objpfx)tst-strtod6: $(link-libm)
-# Testdir has to be named stdlib and needs to be writable
-test-canon-ARGS = --test-dir=${objdir}/stdlib
-
-# Run a test on the header files we use.
-tests: $(objpfx)isomac
- $(dir $<)$(notdir $<) '$(CC)' '-I../include -I.. $(+sysdep-includes)' > $<.out
+tst-tls-atexit-lib.so-no-z-defs = yes
-$(objpfx)isomac: isomac.c
- $(native-compile)
+$(objpfx)tst-tls-atexit: $(common-objpfx)nptl/libpthread.so \
+ $(common-objpfx)dlfcn/libdl.so
+$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so