Update contrib.texi
[glibc.git] / stdlib / Makefile
blob1be16eb8d0b5098a988023213ff0bc57ea9b465e
1 # Copyright (C) 1991-2014 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
19 # Makefile for stdlib routines
21 subdir := stdlib
23 headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
24 monetary.h bits/monetary-ldbl.h \
25 inttypes.h stdint.h bits/wordsize.h \
26 errno.h sys/errno.h bits/errno.h \
27 ucontext.h sys/ucontext.h \
28 alloca.h fmtmsg.h \
29 bits/stdlib-bsearch.h
31 routines := \
32 atof atoi atol atoll \
33 abort \
34 bsearch qsort msort \
35 getenv putenv setenv secure-getenv \
36 exit on_exit atexit cxa_atexit cxa_finalize old_atexit \
37 quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
38 abs labs llabs \
39 div ldiv lldiv \
40 mblen mbstowcs mbtowc wcstombs wctomb \
41 random random_r rand rand_r \
42 drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
43 srand48 seed48 lcong48 \
44 drand48_r erand48_r lrand48_r nrand48_r mrand48_r jrand48_r \
45 srand48_r seed48_r lcong48_r \
46 drand48-iter \
47 strtol strtoul strtoll strtoull \
48 strtol_l strtoul_l strtoll_l strtoull_l \
49 strtof strtod strtold \
50 strtof_l strtod_l strtold_l \
51 system canonicalize \
52 a64l l64a \
53 rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
54 strtoimax strtoumax wcstoimax wcstoumax \
55 getcontext setcontext makecontext swapcontext
56 aux = grouping groupingwc tens_in_limb
58 # These routines will be omitted from the libc shared object.
59 # Instead the static object files will be included in a special archive
60 # linked against when the shared library will be used.
61 static-only-routines = atexit at_quick_exit
63 test-srcs := tst-fmtmsg
64 tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
65 test-canon test-canon2 tst-strtoll tst-environ \
66 tst-xpg-basename tst-random tst-random2 tst-bsearch \
67 tst-limits tst-rand48 bug-strtod tst-setcontext \
68 test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
69 tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
70 tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
71 tst-makecontext2 tst-strtod6 tst-unsetenv1 \
72 tst-makecontext3 bug-getcontext bug-fmtmsg1 \
73 tst-secure-getenv tst-strtod-overflow tst-strtod-round \
74 tst-tininess tst-strtod-underflow tst-tls-atexit
75 tests-static := tst-secure-getenv
77 modules-names = tst-tls-atexit-lib
79 include ../Makeconfig
81 ifeq ($(build-shared),yes)
82 tests += tst-putenv
83 endif
85 # Several mpn functions from GNU MP are used by the strtod function.
86 mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
87 lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
88 mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
90 routines := $(strip $(routines) $(mpn-routines)) \
91 dbl2mpn ldbl2mpn \
92 mpn2flt mpn2dbl mpn2ldbl
93 aux += fpioconst mp_clz_tab
95 tests-extras += tst-putenvmod
96 extra-test-objs += tst-putenvmod.os
98 generated += isomac isomac.out tst-putenvmod.so
100 CFLAGS-bsearch.c = $(uses-callbacks)
101 CFLAGS-msort.c = $(uses-callbacks)
102 CFLAGS-qsort.c = $(uses-callbacks)
103 CFLAGS-system.c = -fexceptions
104 CFLAGS-system.os = -fomit-frame-pointer
105 CFLAGS-fmtmsg.c = -fexceptions
107 CFLAGS-strfmon.c = $(libio-mtsafe)
108 CFLAGS-strfmon_l.c = $(libio-mtsafe)
110 CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
111 CFLAGS-tst-qsort.c = $(stack-align-test-flags)
112 CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
114 include ../Rules
116 # Testdir has to be named stdlib and needs to be writable
117 test-canon-ARGS = --test-dir=${common-objpfx}stdlib
119 tst-strtod-ENV = LOCPATH=$(common-objpfx)localedata
120 tst-strtod3-ENV = LOCPATH=$(common-objpfx)localedata
121 tst-strtod4-ENV = LOCPATH=$(common-objpfx)localedata
122 tst-strtod5-ENV = LOCPATH=$(common-objpfx)localedata
123 testmb2-ENV = LOCPATH=$(common-objpfx)localedata
124 bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
126 # Run a test on the header files we use.
127 tests: $(objpfx)isomac.out
129 ifeq ($(run-built-tests),yes)
130 tests: $(objpfx)tst-fmtmsg.out
131 endif
133 $(objpfx)isomac.out: $(objpfx)isomac
134 $(dir $<)$(notdir $<) '$(CC)' \
135 '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out
137 isomac-CFLAGS = -O
138 $(objpfx)isomac: isomac.c
139 $(native-compile)
141 $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
142 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/
144 $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
145 LDFLAGS-tst-putenv = $(no-as-needed)
147 $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
148 $(build-module)
149 CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
151 ifeq ($(build-shared),yes)
152 link-libm = $(common-objpfx)math/libm.so
153 else
154 link-libm = $(common-objpfx)math/libm.a
155 endif
156 $(objpfx)bug-getcontext: $(link-libm)
157 $(objpfx)tst-strtod-round: $(link-libm)
158 $(objpfx)tst-tininess: $(link-libm)
159 $(objpfx)tst-strtod-underflow: $(link-libm)
160 $(objpfx)tst-strtod6: $(link-libm)
162 tst-tls-atexit-lib.so-no-z-defs = yes
164 $(objpfx)tst-tls-atexit: $(common-objpfx)nptl/libpthread.so \
165 $(common-objpfx)dlfcn/libdl.so
166 $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so