Blame stdlib/Makefile

Packit 6c4009
# Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
#
Packit 6c4009
#	Makefile for stdlib routines
Packit 6c4009
#
Packit 6c4009
subdir	:= stdlib
Packit 6c4009
Packit 6c4009
include ../Makeconfig
Packit 6c4009
Packit 6c4009
headers	:= stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h      \
Packit 6c4009
	   monetary.h bits/monetary-ldbl.h				      \
Packit 6c4009
	   inttypes.h stdint.h bits/wordsize.h				      \
Packit 6c4009
	   errno.h sys/errno.h bits/errno.h bits/types/error_t.h	      \
Packit 6c4009
	   ucontext.h sys/ucontext.h bits/indirect-return.h		      \
Packit 6c4009
	   alloca.h fmtmsg.h						      \
Packit 6c4009
	   bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h	      \
Packit 6c4009
	   bits/stdint-uintn.h
Packit 6c4009
Packit 6c4009
routines	:=							      \
Packit 6c4009
	atof atoi atol atoll						      \
Packit 6c4009
	abort								      \
Packit 6c4009
	bsearch qsort msort						      \
Packit 6c4009
	getenv putenv setenv secure-getenv				      \
Packit 6c4009
	exit on_exit atexit cxa_atexit cxa_finalize old_atexit		      \
Packit 6c4009
	quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl     \
Packit 6c4009
	abs labs llabs							      \
Packit 6c4009
	div ldiv lldiv							      \
Packit 6c4009
	mblen mbstowcs mbtowc wcstombs wctomb				      \
Packit 6c4009
	random random_r rand rand_r					      \
Packit 6c4009
	drand48 erand48 lrand48 nrand48 mrand48 jrand48			      \
Packit 6c4009
	srand48 seed48 lcong48						      \
Packit 6c4009
	drand48_r erand48_r lrand48_r nrand48_r mrand48_r jrand48_r	      \
Packit 6c4009
	srand48_r seed48_r lcong48_r					      \
Packit 6c4009
	drand48-iter getrandom getentropy				      \
Packit 6c4009
	strfromf strfromd strfroml					      \
Packit 6c4009
	strtol strtoul strtoll strtoull					      \
Packit 6c4009
	strtol_l strtoul_l strtoll_l strtoull_l				      \
Packit 6c4009
	strtof strtod strtold						      \
Packit 6c4009
	strtof_l strtod_l strtold_l					      \
Packit 6c4009
	strtof_nan strtod_nan strtold_nan				      \
Packit 6c4009
	system canonicalize						      \
Packit 6c4009
	a64l l64a							      \
Packit 6c4009
	rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg		      \
Packit 6c4009
	strtoimax strtoumax wcstoimax wcstoumax				      \
Packit 6c4009
	getcontext setcontext makecontext swapcontext
Packit 6c4009
aux =	grouping groupingwc tens_in_limb
Packit 6c4009
Packit 6c4009
# These routines will be omitted from the libc shared object.
Packit 6c4009
# Instead the static object files will be included in a special archive
Packit 6c4009
# linked against when the shared library will be used.
Packit 6c4009
static-only-routines = atexit at_quick_exit
Packit 6c4009
Packit 6c4009
test-srcs	:= tst-fmtmsg
Packit 6c4009
tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
Packit 6c4009
		   test-canon test-canon2 tst-strtoll tst-environ	    \
Packit 6c4009
		   tst-xpg-basename tst-random tst-random2 tst-bsearch	    \
Packit 6c4009
		   tst-limits tst-rand48 bug-strtod tst-setcontext	    \
Packit 6c4009
		   tst-setcontext2 test-a64l tst-qsort tst-system testmb2   \
Packit 6c4009
		   bug-strtod2 tst-atof1 tst-atof2 tst-strtod2		    \
Packit 6c4009
		   tst-rand48-2 tst-makecontext tst-strtod5		    \
Packit 6c4009
		   tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1    \
Packit 6c4009
		   tst-makecontext3 bug-getcontext bug-fmtmsg1		    \
Packit 6c4009
		   tst-secure-getenv tst-strtod-overflow tst-strtod-round   \
Packit 6c4009
		   tst-tininess tst-strtod-underflow tst-setcontext3	    \
Packit 6c4009
		   tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l    \
Packit 6c4009
		   tst-quick_exit tst-thread-quick_exit tst-width	    \
Packit 6c4009
		   tst-width-stdint tst-strfrom tst-strfrom-locale	    \
Packit 6c4009
		   tst-getrandom tst-atexit tst-at_quick_exit 		    \
Packit 6c4009
		   tst-cxa_atexit tst-on_exit test-atexit-race 		    \
Packit 6c4009
		   test-at_quick_exit-race test-cxa_atexit-race             \
Packit 6c4009
		   test-on_exit-race test-dlclose-exit-race 		    \
Packit 6c4009
		   tst-makecontext-align test-bz22786 tst-strtod-nan-sign \
Packit 6c4009
		   tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
Packit 6c4009
		   tst-setcontext6 tst-setcontext7 tst-setcontext8 \
Packit 6c4009
		   tst-setcontext9
Packit 6c4009
Packit 6c4009
tests-internal	:= tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
Packit 6c4009
		   tst-tls-atexit tst-tls-atexit-nodelete
Packit 6c4009
tests-static	:= tst-secure-getenv
Packit 6c4009
Packit 6c4009
ifeq ($(build-hardcoded-path-in-tests),yes)
Packit 6c4009
tests += tst-empty-env
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
LDLIBS-test-atexit-race = $(shared-thread-library)
Packit 6c4009
LDLIBS-test-at_quick_exit-race = $(shared-thread-library)
Packit 6c4009
LDLIBS-test-cxa_atexit-race = $(shared-thread-library)
Packit 6c4009
LDLIBS-test-on_exit-race = $(shared-thread-library)
Packit 6c4009
Packit 6c4009
LDLIBS-test-dlclose-exit-race = $(shared-thread-library) $(libdl)
Packit 6c4009
LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)
Packit 6c4009
LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)
Packit 6c4009
Packit 6c4009
ifeq ($(have-cxx-thread_local),yes)
Packit 6c4009
CFLAGS-tst-quick_exit.o = -std=c++11
Packit 6c4009
LDLIBS-tst-quick_exit = -lstdc++
Packit 6c4009
CFLAGS-tst-thread-quick_exit.o = -std=c++11
Packit 6c4009
LDLIBS-tst-thread-quick_exit = -lstdc++
Packit 6c4009
$(objpfx)tst-thread-quick_exit: $(shared-thread-library)
Packit 6c4009
else
Packit 6c4009
tests-unsupported += tst-quick_exit tst-thread-quick_exit
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
modules-names	= tst-tls-atexit-lib test-dlclose-exit-race-helper
Packit 6c4009
extra-test-objs += $(addsuffix .os, $(modules-names))
Packit 6c4009
Packit 6c4009
ifeq ($(build-shared),yes)
Packit 6c4009
tests		+= tst-putenv
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
# Several mpn functions from GNU MP are used by the strtod function.
Packit 6c4009
mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
Packit 6c4009
		lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
Packit 6c4009
mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
Packit 6c4009
Packit 6c4009
routines := $(strip $(routines) $(mpn-routines))	\
Packit 6c4009
	    dbl2mpn ldbl2mpn				\
Packit 6c4009
	    mpn2flt mpn2dbl mpn2ldbl
Packit 6c4009
aux += fpioconst mp_clz_tab
Packit 6c4009
Packit 6c4009
tests-extras += tst-putenvmod
Packit 6c4009
extra-test-objs += tst-putenvmod.os
Packit 6c4009
Packit 6c4009
generated += isomac isomac.out tst-putenvmod.so
Packit 6c4009
Packit 6c4009
CFLAGS-bsearch.c += $(uses-callbacks)
Packit 6c4009
CFLAGS-msort.c += $(uses-callbacks)
Packit 6c4009
CFLAGS-qsort.c += $(uses-callbacks)
Packit 6c4009
CFLAGS-system.c += -fexceptions
Packit 6c4009
CFLAGS-system.os = -fomit-frame-pointer
Packit 6c4009
CFLAGS-fmtmsg.c += -fexceptions
Packit 6c4009
Packit 6c4009
CFLAGS-strfmon.c += $(libio-mtsafe)
Packit 6c4009
CFLAGS-strfmon_l.c += $(libio-mtsafe)
Packit 6c4009
Packit 6c4009
# The strfrom class of functions call __printf_fp in order to convert the
Packit 6c4009
# floating-point value to characters.  This requires the value of IO_MTSAFE_IO.
Packit 6c4009
CFLAGS-strfromd.c += $(libio-mtsafe)
Packit 6c4009
CFLAGS-strfromf.c += $(libio-mtsafe)
Packit 6c4009
CFLAGS-strfroml.c += $(libio-mtsafe)
Packit 6c4009
Packit 6c4009
CFLAGS-tst-bsearch.c += $(stack-align-test-flags)
Packit 6c4009
CFLAGS-tst-qsort.c += $(stack-align-test-flags)
Packit 6c4009
CFLAGS-tst-makecontext.c += -funwind-tables
Packit 6c4009
CFLAGS-tst-makecontext2.c += $(stack-align-test-flags)
Packit 6c4009
Packit 6c4009
# Run a test on the header files we use.
Packit 6c4009
tests-special += $(objpfx)isomac.out
Packit 6c4009
Packit 6c4009
ifeq ($(run-built-tests),yes)
Packit 6c4009
tests-special += $(objpfx)tst-fmtmsg.out
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
include ../Rules
Packit 6c4009
Packit 6c4009
ifeq ($(run-built-tests),yes)
Packit 6c4009
LOCALES := cs_CZ.UTF-8 de_DE.UTF-8 en_US.ISO-8859-1 tr_TR.UTF-8 \
Packit 6c4009
	   tr_TR.ISO-8859-9 tg_TJ.UTF-8 hr_HR.UTF-8 hi_IN.UTF-8 \
Packit 6c4009
	   el_GR.UTF-8
Packit 6c4009
include ../gen-locales.mk
Packit 6c4009
Packit 6c4009
$(objpfx)bug-strtod2.out: $(gen-locales)
Packit 6c4009
$(objpfx)testmb2.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod1i.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod3.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod4.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod5.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod5i.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtol-locale.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strtod-nan-locale.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strfmon_l.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strfrom.out: $(gen-locales)
Packit 6c4009
$(objpfx)tst-strfrom-locale.out: $(gen-locales)
Packit 6c4009
$(objpfx)test-dlclose-exit-race.out: $(objpfx)test-dlclose-exit-race-helper.so
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
# Testdir has to be named stdlib and needs to be writable
Packit 6c4009
test-canon-ARGS = --test-dir=${common-objpfx}stdlib
Packit 6c4009
Packit 6c4009
bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
Packit 6c4009
Packit 6c4009
$(objpfx)isomac.out: $(objpfx)isomac
Packit 6c4009
	$(dir $<)$(notdir $<) '$(CC)'  \
Packit 6c4009
	'-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
Packit 6c4009
	$(evaluate-test)
Packit 6c4009
Packit 6c4009
isomac-CFLAGS = -O
Packit 6c4009
$(objpfx)isomac: isomac.c
Packit 6c4009
	$(native-compile)
Packit 6c4009
Packit 6c4009
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
Packit 6c4009
	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
Packit 6c4009
		 '$(run-program-env)' '$(test-program-prefix-after-env)' \
Packit 6c4009
		 $(common-objpfx)stdlib/ > $@; \
Packit 6c4009
	$(evaluate-test)
Packit 6c4009
Packit 6c4009
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
Packit 6c4009
LDFLAGS-tst-putenv = $(no-as-needed)
Packit 6c4009
Packit 6c4009
$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
Packit 6c4009
	$(build-module)
Packit 6c4009
libof-tst-putenvmod = extramodules
Packit 6c4009
Packit 6c4009
$(objpfx)bug-getcontext: $(libm)
Packit 6c4009
$(objpfx)bug-strtod2: $(libm)
Packit 6c4009
$(objpfx)tst-strtod-round: $(libm)
Packit 6c4009
$(objpfx)tst-tininess: $(libm)
Packit 6c4009
$(objpfx)tst-strtod-underflow: $(libm)
Packit 6c4009
$(objpfx)tst-strtod6: $(libm)
Packit 6c4009
$(objpfx)tst-strtod-nan-locale: $(libm)
Packit 6c4009
$(objpfx)tst-strtod-nan-sign: $(libm)
Packit 6c4009
Packit 6c4009
tst-tls-atexit-lib.so-no-z-defs = yes
Packit 6c4009
test-dlclose-exit-race-helper.so-no-z-defs = yes
Packit 6c4009
Packit 6c4009
$(objpfx)tst-tls-atexit: $(shared-thread-library) $(libdl)
Packit 6c4009
$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
Packit 6c4009
Packit 6c4009
$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library) $(libdl)
Packit 6c4009
$(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so
Packit 6c4009
Packit 6c4009
$(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
Packit 6c4009
	$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
Packit 6c4009
		 '$(run-program-env)' '$(test-program-prefix-after-env)' \
Packit 6c4009
		 $(common-objpfx)stdlib/ > $@; \
Packit 6c4009
	$(evaluate-test)
Packit 6c4009
Packit 6c4009
$(objpfx)tst-makecontext: $(libdl)