]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - stdlib/Makefile
Consistently include Makeconfig after defining subdir.
[thirdparty/glibc.git] / stdlib / Makefile
index 193c42b2843fb6ab665385d56a78c756c916ec2a..5f2c10cec26d6d49e7a853fc438ed46295c53e15 100644 (file)
@@ -1,28 +1,34 @@
-# Copyright (C) 1991-1999, 2000, 2001 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 bits/wchar.h
+include ../Makeconfig
+
+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                                                  \
@@ -30,6 +36,7 @@ routines      :=                                                            \
        bsearch qsort msort                                                   \
        getenv putenv setenv secure-getenv                                    \
        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                                 \
@@ -48,19 +55,32 @@ routines    :=                                                            \
        rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg               \
        strtoimax strtoumax wcstoimax wcstoumax                               \
        getcontext setcontext makecontext swapcontext
+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
+static-only-routines = atexit at_quick_exit
 
-distribute     := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh
 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-bsearch tst-limits     \
-                  tst-rand48 bug-strtod
-
+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
+
+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 \
@@ -70,98 +90,79 @@ 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
+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 ../Makeconfig
+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
 
-ifneq (,$(filter %REENTRANT, $(defines)))
-CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
-CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
-endif
+CFLAGS-strfmon.c = $(libio-mtsafe)
+CFLAGS-strfmon_l.c = $(libio-mtsafe)
 
-ifeq (yes,$(have-protected))
-CFLAGS-atexit.c = -DHAVE_DOT_HIDDEN
-endif
+CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
+CFLAGS-tst-qsort.c = $(stack-align-test-flags)
+CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
 
 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)) \
-          $(addprefix $(gmp-srcdir)/mpn/*/*/,$(mpn-sysdep))
-mpn-found = $(wildcard $(mpn-try))
-
-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-sysdep := $(filter $(addsuffix %,\
-                    $(wildcard $(sort $(dir $(mpn-copy-sysdep))))), \
-                   $(mpn-copy-sysdep))
-$(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 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)
-
-endif
-
 # Testdir has to be named stdlib and needs to be writable
 test-canon-ARGS = --test-dir=${common-objpfx}stdlib
 
 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
 
 # Run a test on the header files we use.
 tests: $(objpfx)isomac.out
 
-ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
 tests: $(objpfx)tst-fmtmsg.out
 endif
 
 $(objpfx)isomac.out: $(objpfx)isomac
        $(dir $<)$(notdir $<) '$(CC)'  \
-       '-I../include -I.. $(+sysdep-includes) $(sysincludes)' > $<.out
+       '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out; \
+       $(evaluate-test)
 
+isomac-CFLAGS = -O
 $(objpfx)isomac: isomac.c
        $(native-compile)
 
 $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
-       $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
+       $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/; \
+       $(evaluate-test)
+
+$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+LDFLAGS-tst-putenv = $(no-as-needed)
+
+$(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)
+
+tst-tls-atexit-lib.so-no-z-defs = yes
+
+$(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