]> git.ipfire.org Git - thirdparty/glibc.git/blame - posix/Makefile
[BZ #24]
[thirdparty/glibc.git] / posix / Makefile
CommitLineData
f39eef7b 1# Copyright (C) 1991-1999, 2000-2003, 2004 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 \
a5a6f926 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
UD
67 spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
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 \
6c2a04a7 82 bug-regex21 bug-regex22 bug-regex23 tst-nice tst-nanosleep \
f39eef7b 83 transbug tst-rxspencer tst-pcre tst-boost
df455ccb 84ifeq (yes,$(build-shared))
2604afb1 85test-srcs := globtest
e8c6a442 86tests += wordexp-test tst-exec tst-spawn
df455ccb 87endif
28f540f4
RM
88others := getconf
89install-bin := getconf
2b83a2a4 90gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h
28f540f4 91
92040cbc 92before-compile := testcases.h ptestcases.h
4cca6b86 93
414fd335 94# So they get cleaned up.
ba9234d9 95generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
cb207240 96 annexc annexc.out wordexp-tst.out bug-regex2-mem \
240e87c2 97 bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
ee70274a 98 bug-regex21-mem bug-regex21.mtrace \
6c805a2b
UD
99 tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
100 tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace
414fd335 101
28f540f4
RM
102include ../Rules
103
e1e3ba54 104ifeq (yes,$(build-static-nss))
8f3f1e09
UD
105# We need it for "make check" only. We can skip them if they haven't
106# been built yet during "make".
107otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \
108 $(resolvobjdir)/libnss_dns.a \
109 $(resolvobjdir)/libresolv.a)
110endif
111
61eb22d3 112ifeq (no,$(cross-compiling))
df455ccb
AS
113# globtest and wordexp-test currently only works with shared libraries
114ifeq (yes,$(build-shared))
3f36c563
UD
115tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out
116$(objpfx)globtest.out: globtest.sh $(objpfx)globtest
31161268
UD
117 $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
118 $(rtld-installed-name)
3f36c563 119$(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
31161268
UD
120 $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
121 $(rtld-installed-name)
61eb22d3 122endif
df455ccb 123endif
61eb22d3 124
5a6bbb41 125CFLAGS-regex.c = -Wno-strict-prototypes
8dab36a1 126CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions
7a114794
UD
127CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
128CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
129CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
130CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
131CFLAGS-sleep.c = -fexceptions
132CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
133CFLAGS-waitid.c = -fexceptions
134CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
cdbfa9f8 135CFLAGS-getopt.c = -fexceptions
f1c30c98
UD
136CFLAGS-wordexp.c = -fexceptions
137CFLAGS-sysconf.c = -fexceptions
1db52d14
UD
138CFLAGS-pathconf.c = -fexceptions
139CFLAGS-fpathconf.c = -fexceptions
8dab36a1
UD
140CFLAGS-spawn.c = -fexceptions
141CFLAGS-spawnp.c = -fexceptions
142CFLAGS-spawni.c = -fexceptions
143CFLAGS-pause.c = -fexceptions
e07bb02a
UD
144CFLAGS-glob.c = $(uses-callbacks) -fexceptions
145CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
7a114794 146
e25054c4 147tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
b64cd08a 148 --none random --col --color --colour
0793d348 149
079199de 150tst-exec-ARGS = -- $(built-program-cmd)
08c7f6b0 151tst-spawn-ARGS = -- $(built-program-cmd)
53e5cdd8 152tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir
55f462ed 153tst-chmod-ARGS = `pwd`
079199de 154
0d6af3a8 155tst-fnmatch-ENV = LOCPATH=$(common-objpfx)localedata
47b853e8 156tst-regexloc-ENV = LOCPATH=$(common-objpfx)localedata
5c0111e9 157bug-regex1-ENV = LOCPATH=$(common-objpfx)localedata
64333c66 158tst-regex-ENV = LOCPATH=$(common-objpfx)localedata
2f76d88d 159bug-regex5-ENV = LOCPATH=$(common-objpfx)localedata
81c64d40 160bug-regex6-ENV = LOCPATH=$(common-objpfx)localedata
74e12fbc
UD
161bug-regex17-ENV = LOCPATH=$(common-objpfx)localedata
162bug-regex18-ENV = LOCPATH=$(common-objpfx)localedata
3c0fb574 163bug-regex19-ENV = LOCPATH=$(common-objpfx)localedata
14744156 164bug-regex20-ENV = LOCPATH=$(common-objpfx)localedata
f39eef7b 165bug-regex22-ENV = LOCPATH=$(common-objpfx)localedata
6c2a04a7 166bug-regex23-ENV = LOCPATH=$(common-objpfx)localedata
c13c99fa
UD
167tst-rxspencer-ARGS = --utf8 rxspencer/tests
168tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
6c805a2b
UD
169tst-pcre-ARGS = PCRE.tests
170tst-boost-ARGS = BOOST.tests
0d6af3a8 171
4cca6b86
UD
172testcases.h: TESTS TESTS2C.sed
173 sed -f TESTS2C.sed < $< > $@T
174 mv -f $@T $@
880f421f 175ifeq ($(with-cvs),yes)
4eb36693 176 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
880f421f 177endif
92040cbc
UD
178
179ptestcases.h: PTESTS PTESTS2C.sed
180 sed -f PTESTS2C.sed < $< > $@T
181 mv -f $@T $@
182ifeq ($(with-cvs),yes)
183 test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
184endif
4959e310
UD
185
186# Run a test on the header files we use.
187# XXX Please note that for now we ignore the result of this test.
b647f210
AJ
188tests: $(objpfx)annexc.out
189ifeq (no,$(cross-compiling))
ee70274a
UD
190tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
191 $(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \
6c805a2b 192 $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out
b647f210
AJ
193endif
194
3f36c563 195$(objpfx)annexc.out: $(objpfx)annexc
8eaaffde 196 -$(dir $<)$(notdir $<) '$(CC)' \
d7e82198 197 '$(patsubst %,-I../%,$(sorted-subdirs)) -I../include -I.. $(+sysdep-includes) $(sysincludes)' > $@
4959e310 198
e69924e3 199annexc-CFLAGS = -O
4959e310
UD
200$(objpfx)annexc: annexc.c
201 $(native-compile)
770d454d
UD
202
203bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
204
205$(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
206 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex2.mtrace > $@
a3bbce5b 207
240e87c2
RM
208bug-regex14-ENV = MALLOC_TRACE=$(objpfx)bug-regex14.mtrace
209
210$(objpfx)bug-regex14-mem: $(objpfx)bug-regex14.out
211 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex14.mtrace > $@
212
ee70274a
UD
213bug-regex21-ENV = MALLOC_TRACE=$(objpfx)bug-regex21.mtrace
214
215$(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
216 $(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@
217
c13c99fa
UD
218# tst-rxspencer.mtrace is generated only when run without --utf8
219# option, since otherwise the file has almost 100M and takes very long
220# time to process.
ee70274a 221$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out
c13c99fa
UD
222 MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \
223 $(run-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \
224 > /dev/null
ee70274a
UD
225 $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
226
6c805a2b
UD
227tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
228$(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out
229 $(common-objpfx)malloc/mtrace $(objpfx)tst-pcre.mtrace > $@
230
231tst-boost-ENV = MALLOC_TRACE=$(objpfx)tst-boost.mtrace
232$(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
233 $(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@
234
a3bbce5b
UD
235$(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
236 $(SHELL) -e $< $(common-objpfx) $(elf-objpfx) $(rtld-installed-name)
64333c66
UD
237
238ifeq (yes,$(build-shared))
239$(objpfx)tst-regex: $(common-objpfx)rt/librt.so
240else
241$(objpfx)tst-regex: $(common-objpfx)rt/librt.a
242endif