]> git.ipfire.org Git - thirdparty/glibc.git/blame - posix/Makefile
* posix/unistd.h: symlink and readlink are unconditionally
[thirdparty/glibc.git] / posix / Makefile
CommitLineData
57b47af9 1# Copyright (C) 1991-1999, 2000-2003, 2004, 2005 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4
RM
8
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
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2
AJ
14# You should have received a copy of the GNU Lesser General Public
15# License along with the GNU C Library; if not, write to the Free
16# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17# 02111-1307 USA.
28f540f4
RM
18
19#
20# Sub-makefile for POSIX portion of the library.
21#
22subdir := posix
23
7b3547eb 24headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
3efdabe7 25 glob.h regex.h wordexp.h fnmatch.h getopt.h \
13a571a7 26 bits/types.h bits/typesizes.h bits/pthreadtypes.h \
9c83a5ec 27 bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \
5107cf1d
UD
28 bits/local_lim.h tar.h bits/utsname.h bits/confname.h \
29 bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \
d1462d2e 30 bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \
a334319f 31 sys/sysmacros.h spawn.h
28f540f4 32
61eb22d3 33distribute := confstr.h TESTS TESTS2C.sed testcases.h \
92040cbc 34 PTESTS PTESTS2C.sed ptestcases.h \
a5a6f926 35 globtest.c globtest.sh wordexp-tst.sh annexc.c fnmatch_loop.c \
3b0bdc72 36 spawn_int.h tst-getconf.sh regcomp.c regexec.c regex_internal.c \
6c805a2b
UD
37 regex_internal.h fork.h rxspencer/tests rxspencer/COPYRIGHT \
38 PCRE.tests BOOST.tests
28f540f4
RM
39
40routines := \
41 uname \
42 times \
bd355af0 43 wait waitpid wait3 wait4 waitid \
7b3547eb 44 alarm sleep pause nanosleep \
e8c6a442 45 fork vfork _exit \
28f540f4
RM
46 execve fexecve execv execle execl execvp execlp \
47 getpid getppid \
3bbceb12 48 getuid geteuid getgid getegid getgroups setuid setgid group_member \
0d8733c4 49 getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
747bf98e 50 getresuid getresgid setresuid setresgid \
ee188d55 51 getlogin getlogin_r setlogin \
28f540f4 52 pathconf sysconf fpathconf \
a5f4e34a 53 glob glob64 fnmatch regex \
28f540f4 54 confstr \
7cc27f44 55 getopt getopt1 getopt_init \
7b3547eb 56 sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
972e719e 57 sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
a5a0310d 58 getaddrinfo gai_strerror wordexp \
a5a6f926
UD
59 pread pwrite pread64 pwrite64 \
60 spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
61 spawn_faction_addopen spawn_faction_adddup2 \
62 spawnattr_init spawnattr_destroy \
63 spawnattr_getdefault spawnattr_setdefault \
64 spawnattr_getflags spawnattr_setflags \
afa0569f
UD
65 spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni \
66 spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
bfef9264 67 spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
a334319f 68 posix_madvise
7b3547eb 69
7cabd57c
UD
70include ../Makeconfig
71
5f9e57ba 72aux := init-posix environ
df455ccb 73tests := tstgetopt testfnm runtests runptests \
bd9df4cd 74 tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
ad92208d 75 tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
726b7b0f 76 tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
3eab00bd 77 tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
d683fe11 78 tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
82bbb29e 79 bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
74e12fbc 80 bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
14744156 81 bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
7db61208 82 bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
c06a6956 83 tst-nice tst-nanosleep tst-regex2 \
380f06d3 84 transbug tst-rxspencer tst-pcre tst-boost \
a334319f
UD
85 bug-ga1 tst-vfork1 tst-vfork2 tst-waitid \
86 tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf
5605e117 87xtests := bug-ga2
df455ccb 88ifeq (yes,$(build-shared))
2604afb1 89test-srcs := globtest
e8c6a442 90tests += wordexp-test tst-exec tst-spawn
df455ccb 91endif
28f540f4
RM
92others := getconf
93install-bin := getconf
28f367c4 94install-others := $(inst_libexecdir)/getconf
28f540f4 95
92040cbc 96before-compile := testcases.h ptestcases.h
4cca6b86 97
414fd335 98# So they get cleaned up.
ba9234d9 99generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
cb207240 100 annexc annexc.out wordexp-tst.out bug-regex2-mem \
240e87c2 101 bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
ee70274a 102 bug-regex21-mem bug-regex21.mtrace \
6c805a2b 103 tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
5605e117 104 tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
a334319f 105 bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem
414fd335 106
28f540f4
RM
107include ../Rules
108
e1e3ba54 109ifeq (yes,$(build-static-nss))
8f3f1e09
UD
110# We need it for "make check" only. We can skip them if they haven't
111# been built yet during "make".
112otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \
113 $(resolvobjdir)/libnss_dns.a \
114 $(resolvobjdir)/libresolv.a)
115endif
116
61eb22d3 117ifeq (no,$(cross-compiling))
df455ccb
AS
118# globtest and wordexp-test currently only works with shared libraries
119ifeq (yes,$(build-shared))
3f36c563
UD
120tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
121$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
31161268
UD
122 $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
123 $(rtld-installed-name)
3f36c563 124$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
31161268
UD
125 $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
126 $(rtld-installed-name)
61eb22d3 127endif
df455ccb 128endif
61eb22d3 129
5a6bbb41 130CFLAGS-regex.c = -Wno-strict-prototypes
d1fe1f22 131CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
7a114794
UD
132CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
133CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
134CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
135CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
136CFLAGS-sleep.c = -fexceptions
137CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
a334319f 138CFLAGS-waitid.c = -fexceptions
7a114794 139CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
cdbfa9f8 140CFLAGS-getopt.c = -fexceptions
70fb71fd
UD
141CFLAGS-wordexp.c = -fexceptions
142CFLAGS-wordexp.os = -fomit-frame-pointer
28f367c4 143CFLAGS-sysconf.c = -fexceptions -DGETCONF_DIR='"$(libexecdir)/getconf"'
1db52d14
UD
144CFLAGS-pathconf.c = -fexceptions
145CFLAGS-fpathconf.c = -fexceptions
70fb71fd
UD
146CFLAGS-spawn.c = -fexceptions
147CFLAGS-spawn.os = -fomit-frame-pointer
148CFLAGS-spawnp.c = -fexceptions
149CFLAGS-spawnp.os = -fomit-frame-pointer
150CFLAGS-spawni.c = -fexceptions
151CFLAGS-spawni.os = -fomit-frame-pointer
8dab36a1 152CFLAGS-pause.c = -fexceptions
e07bb02a
UD
153CFLAGS-glob.c = $(uses-callbacks) -fexceptions
154CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
28f367c4 155CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'
70fb71fd
UD
156CFLAGS-execve.os = -fomit-frame-pointer
157CFLAGS-fexecve.os = -fomit-frame-pointer
158CFLAGS-execv.os = -fomit-frame-pointer
159CFLAGS-execle.os = -fomit-frame-pointer
160CFLAGS-execl.os = -fomit-frame-pointer
161CFLAGS-execvp.os = -fomit-frame-pointer
162CFLAGS-execlp.os = -fomit-frame-pointer
7a114794 163
e25054c4 164tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
b64cd08a 165 --none random --col --color --colour
0793d348 166
079199de 167tst-exec-ARGS = -- $(built-program-cmd)
08c7f6b0 168tst-spawn-ARGS = -- $(built-program-cmd)
53e5cdd8 169tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
55f462ed 170tst-chmod-ARGS = `pwd`
079199de 171
0d6af3a8 172tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata
47b853e8 173tst-regexloc-ENV = LOCPATH=$(common-objpfx)localedata
5c0111e9 174bug-regex1-ENV = LOCPATH=$(common-objpfx)localedata
64333c66 175tst-regex-ENV = LOCPATH=$(common-objpfx)localedata
c06a6956 176tst-regex2-ENV = LOCPATH=$(common-objpfx)localedata
2f76d88d 177bug-regex5-ENV = LOCPATH=$(common-objpfx)localedata
81c64d40 178bug-regex6-ENV = LOCPATH=$(common-objpfx)localedata
74e12fbc
UD
179bug-regex17-ENV = LOCPATH=$(common-objpfx)localedata
180bug-regex18-ENV = LOCPATH=$(common-objpfx)localedata
3c0fb574 181bug-regex19-ENV = LOCPATH=$(common-objpfx)localedata
14744156 182bug-regex20-ENV = LOCPATH=$(common-objpfx)localedata
f39eef7b 183bug-regex22-ENV = LOCPATH=$(common-objpfx)localedata
6c2a04a7 184bug-regex23-ENV = LOCPATH=$(common-objpfx)localedata
c13c99fa
UD
185tst-rxspencer-ARGS = --utf8 rxspencer/tests
186tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
6c805a2b
UD
187tst-pcre-ARGS = PCRE.tests
188tst-boost-ARGS = BOOST.tests
0da4ee55 189bug-glob1-ARGS = "$(objpfx)"
0d6af3a8 190
4cca6b86
UD
191testcases.h: TESTS TESTS2C.sed
192 sed -f TESTS2C.sed < $< > $@T
193 mv -f $@T $@
880f421f 194ifeq ($(with-cvs),yes)
4eb36693 195 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
880f421f 196endif
92040cbc
UD
197
198ptestcases.h: PTESTS PTESTS2C.sed
199 sed -f PTESTS2C.sed < $< > $@T
200 mv -f $@T $@
201ifeq ($(with-cvs),yes)
202 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
203endif
4959e310
UD
204
205# Run a test on the header files we use.
206# XXX Please note that for now we ignore the result of this test.
b647f210
AJ
207tests: $(objpfx)annexc.out
208ifeq (no,$(cross-compiling))
ee70274a
UD
209tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
210 $(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \
778cddad 211 $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
a334319f 212 $(objpfx)bug-glob2-mem
5605e117 213xtests: $(objpfx)bug-ga2-mem
b647f210
AJ
214endif
215
3f36c563 216$(objpfx)annexc.out: $(objpfx)annexc
8eaaffde 217 -$(dir $<)$(notdir $<) '$(CC)' \
a334319f 218 '$(patsubst %,-I../%,$(sorted-subdirs)) -I../include -I.. $(+sysdep-includes) $(sysincludes)' > $@
4959e310 219
e69924e3 220annexc-CFLAGS = -O
4959e310
UD
221$(objpfx)annexc: annexc.c
222 $(native-compile)
770d454d
UD
223
224bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
225
226$(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
227 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex2.mtrace > $@
a3bbce5b 228
240e87c2
RM
229bug-regex14-ENV = MALLOC_TRACE=$(objpfx)bug-regex14.mtrace
230
231$(objpfx)bug-regex14-mem: $(objpfx)bug-regex14.out
232 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex14.mtrace > $@
233
ee70274a
UD
234bug-regex21-ENV = MALLOC_TRACE=$(objpfx)bug-regex21.mtrace
235
236$(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
237 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@
238
c13c99fa
UD
239# tst-rxspencer.mtrace is generated only when run without --utf8
240# option, since otherwise the file has almost 100M and takes very long
241# time to process.
ee70274a 242$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out
c13c99fa
UD
243 MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \
244 $(run-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
245 > /dev/null
ee70274a
UD
246 $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
247
6c805a2b
UD
248tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
249$(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out
250 $(common-objpfx)malloc/mtrace $(objpfx)tst-pcre.mtrace > $@
251
252tst-boost-ENV = MALLOC_TRACE=$(objpfx)tst-boost.mtrace
253$(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
254 $(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
255
a3bbce5b
UD
256$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
257 $(SHELL) -e $< $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
64333c66
UD
258
259ifeq (yes,$(build-shared))
260$(objpfx)tst-regex: $(common-objpfx)rt/librt.so
c06a6956 261$(objpfx)tst-regex2: $(common-objpfx)rt/librt.so
64333c66
UD
262else
263$(objpfx)tst-regex: $(common-objpfx)rt/librt.a
c06a6956 264$(objpfx)tst-regex2: $(common-objpfx)rt/librt.a
64333c66 265endif
5605e117
UD
266
267$(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
268 $(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@
269
270bug-ga2-ENV = MALLOC_TRACE=$(objpfx)bug-ga2.mtrace
778cddad
UD
271
272bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace
273
274$(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
275 $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@
28f367c4 276
a334319f 277$(inst_libexecdir)/getconf: $(objpfx)getconf FORCE
28f367c4
UD
278 $(addprefix $(..)./scripts/mkinstalldirs ,\
279 $(filter-out $(wildcard $@),$@))
a334319f
UD
280 for spec in `LC_ALL=C GETCONF_DIR=/dev/null \
281 $(run-program-prefix) $< \
282 _POSIX_V6_WIDTH_RESTRICTED_ENVS`; do \
283 $(INSTALL_PROGRAM) $< $@/$$spec.new; \
284 mv -f $@/$$spec.new $@/$$spec; \
28f367c4 285 done