(routines): Add spawnattr_getsigmask, spawnattr_getschedpolicy,
[kopensolaris-gnu/glibc.git] / posix / Makefile
1 # Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
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
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
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
12 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB.  If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18
19 #
20 #       Sub-makefile for POSIX portion of the library.
21 #
22 subdir  := posix
23
24 headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h          \
25            glob.h regex.h wordexp.h fnmatch.h bits/types.h getopt.h           \
26            bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h               \
27            bits/local_lim.h tar.h bits/utsname.h bits/confname.h              \
28            bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h            \
29            bits/sched.h re_comp.h wait.h bits/environments.h cpio.h           \
30            sys/sysmacros.h spawn.h
31
32 distribute := confstr.h TESTS TESTS2C.sed testcases.h \
33               PTESTS PTESTS2C.sed ptestcases.h \
34               globtest.c globtest.sh wordexp-tst.sh annexc.c fnmatch_loop.c   \
35               spawn_int.h
36
37 routines :=                                                                   \
38         uname                                                                 \
39         times                                                                 \
40         wait waitpid wait3 wait4 waitid                                       \
41         alarm sleep pause nanosleep                                           \
42         fork vfork _exit                                                      \
43         execve fexecve execv execle execl execvp execlp                       \
44         getpid getppid                                                        \
45         getuid geteuid getgid getegid getgroups setuid setgid group_member    \
46         getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid             \
47         getlogin getlogin_r setlogin                                          \
48         pathconf sysconf fpathconf                                            \
49         glob glob64 fnmatch regex                                             \
50         confstr                                                               \
51         getopt getopt1 getopt_init                                            \
52         sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax  \
53         sched_primin sched_rr_gi                                              \
54         getaddrinfo gai_strerror wordexp                                      \
55         pread pwrite pread64 pwrite64                                         \
56         spawn_faction_init spawn_faction_destroy spawn_faction_addclose       \
57         spawn_faction_addopen spawn_faction_adddup2                           \
58         spawnattr_init spawnattr_destroy                                      \
59         spawnattr_getdefault spawnattr_setdefault                             \
60         spawnattr_getflags spawnattr_setflags                                 \
61         spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni           \
62         spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
63         spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam
64
65 include ../Makeconfig
66
67 aux             := init-posix environ
68 tests           := tstgetopt testfnm runtests runptests      \
69                    tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
70                    tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
71                    tst-truncate64 tst-fork tst-exec tst-spawn
72 ifeq (yes,$(build-shared))
73 test-srcs       := globtest
74 tests           += wordexp-test
75 endif
76 others          := getconf
77 install-bin     := getconf
78 ifeq (yes,$(build-static))
79 install-lib     := libposix.a
80 endif
81 gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h
82
83 before-compile  := testcases.h ptestcases.h
84
85 # So they get cleaned up.
86 generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
87              annexc annexc.out
88
89 include ../Rules
90
91 ifeq (no,$(cross-compiling))
92 # globtest and wordexp-test currently only works with shared libraries
93 ifeq (yes,$(build-shared))
94 .PHONY: do-globtest do-wordexp-test
95 tests: do-globtest do-wordexp-test
96 do-globtest: $(objpfx)globtest
97         $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
98                  $(rtld-installed-name)
99 do-wordexp-test: $(objpfx)wordexp-test
100         $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
101                  $(rtld-installed-name)
102 endif
103 endif
104
105 CFLAGS-regex.c = -Wno-strict-prototypes
106 CFLAGS-getaddrinfo.c = -DRESOLVER
107 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
108                 --none random
109
110 tst-exec-ARGS = -- $(built-program-cmd)
111 tst-spawn-ARGS = -- $(built-program-cmd)
112
113 $(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
114 lib: $(objpfx)libposix.a
115
116 testcases.h: TESTS TESTS2C.sed
117         sed -f TESTS2C.sed < $< > $@T
118         mv -f $@T $@
119 ifeq ($(with-cvs),yes)
120         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
121 endif
122
123 ptestcases.h: PTESTS PTESTS2C.sed
124         sed -f PTESTS2C.sed < $< > $@T
125         mv -f $@T $@
126 ifeq ($(with-cvs),yes)
127         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
128 endif
129 \f
130 # Make the standalone glob/fnmatch package.
131
132 glob.tar: glob/ChangeLog glob/COPYING.LIB \
133           glob/Makefile.in glob/configure glob/configure.in glob/configure.bat\
134           glob/SCOPTIONS glob/SMakefile glob/Makefile.ami \
135           glob/fnmatch.h glob/glob.h glob/fnmatch.c glob/glob.c
136         tar cho$(verbose)f $@ $^
137 glob/%.c: %.c
138         rm -f $@
139         ln -s ../$< $@
140 glob/%.h: %.h
141         rm -f $@
142         ln -s ../$< $@
143
144 glob/configure: glob/configure.in
145         cd glob && autoconf $(ACFLAGS)
146 ifeq ($(with-cvs),yes)
147         test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
148 endif
149
150 glob/ChangeLog: ../ChangeLog
151         changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new
152         chmod a-w $@.new
153         mv -f $@.new $@
154 ifeq ($(with-cvs),yes)
155         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
156 endif
157
158 %.Z: %
159         compress -c $< > $@-tmp
160         mv $@-tmp $@
161 %.gz: %
162         gzip -9v -c $< > $@-tmp
163         mv $@-tmp $@
164
165 # Run a test on the header files we use.
166 # XXX Please note that for now we ignore the result of this test.
167 tests: $(objpfx)annexc
168         -$(dir $<)$(notdir $<) '$(CC)' \
169                                '-I../include -I.. $(+sysdep-includes)' > $<.out
170
171 $(objpfx)annexc: annexc.c
172         $(native-compile)