(CFLAGS-regex.c): Remove not needed warning flag.
[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
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
36 routines :=                                                                   \
37         uname                                                                 \
38         times                                                                 \
39         wait waitpid wait3 wait4 waitid                                       \
40         alarm sleep pause nanosleep                                           \
41         fork vfork _exit                                                      \
42         execve fexecve execv execle execl execvp execlp                       \
43         getpid getppid                                                        \
44         getuid geteuid getgid getegid getgroups setuid setgid group_member    \
45         getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid             \
46         getlogin getlogin_r setlogin                                          \
47         pathconf sysconf fpathconf                                            \
48         glob glob64 fnmatch regex                                             \
49         confstr                                                               \
50         getopt getopt1 getopt_init                                            \
51         sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax  \
52         sched_primin sched_rr_gi                                              \
53         getaddrinfo gai_strerror wordexp                                      \
54         pread pwrite pread64 pwrite64
55
56 include ../Makeconfig
57
58 aux             := init-posix environ
59 tests           := tstgetopt testfnm runtests runptests      \
60                    tst-preadwrite test-vfork regexbug1 tst-getlogin tst-mmap
61 ifeq (yes,$(build-shared))
62 test-srcs       := globtest
63 tests           += wordexp-test
64 endif
65 others          := getconf
66 install-bin     := getconf
67 ifeq (yes,$(build-static))
68 install-lib     := libposix.a
69 endif
70 gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h
71
72 before-compile  := testcases.h ptestcases.h
73
74 # So they get cleaned up.
75 generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
76              annexc annexc.out
77
78 include ../Rules
79
80 ifeq (no,$(cross-compiling))
81 # globtest and wordexp-test currently only works with shared libraries
82 ifeq (yes,$(build-shared))
83 .PHONY: do-globtest do-wordexp-test
84 tests: do-globtest do-wordexp-test
85 do-globtest: $(objpfx)globtest
86         $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \
87                  $(rtld-installed-name)
88 do-wordexp-test: $(objpfx)wordexp-test
89         $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \
90                  $(rtld-installed-name)
91 endif
92 endif
93
94 CFLAGS-regex.c = -Wno-strict-prototypes -DDEBUG
95 CFLAGS-getaddrinfo.c = -DRESOLVER
96
97 $(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
98 lib: $(objpfx)libposix.a
99
100 testcases.h: TESTS TESTS2C.sed
101         sed -f TESTS2C.sed < $< > $@T
102         mv -f $@T $@
103 ifeq ($(with-cvs),yes)
104         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
105 endif
106
107 ptestcases.h: PTESTS PTESTS2C.sed
108         sed -f PTESTS2C.sed < $< > $@T
109         mv -f $@T $@
110 ifeq ($(with-cvs),yes)
111         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
112 endif
113 \f
114 # Make the standalone glob/fnmatch package.
115
116 glob.tar: glob/ChangeLog glob/COPYING.LIB \
117           glob/Makefile.in glob/configure glob/configure.in glob/configure.bat\
118           glob/SCOPTIONS glob/SMakefile glob/Makefile.ami \
119           glob/fnmatch.h glob/glob.h glob/fnmatch.c glob/glob.c
120         tar cho$(verbose)f $@ $^
121 glob/%.c: %.c
122         rm -f $@
123         ln -s ../$< $@
124 glob/%.h: %.h
125         rm -f $@
126         ln -s ../$< $@
127
128 glob/configure: glob/configure.in
129         cd glob && autoconf $(ACFLAGS)
130 ifeq ($(with-cvs),yes)
131         test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
132 endif
133
134 glob/ChangeLog: ../ChangeLog
135         changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new
136         chmod a-w $@.new
137         mv -f $@.new $@
138 ifeq ($(with-cvs),yes)
139         test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
140 endif
141
142 %.Z: %
143         compress -c $< > $@-tmp
144         mv $@-tmp $@
145 %.gz: %
146         gzip -9v -c $< > $@-tmp
147         mv $@-tmp $@
148
149 # Run a test on the header files we use.
150 # XXX Please note that for now we ignore the result of this test.
151 tests: $(objpfx)annexc
152         -$(dir $<)$(notdir $<) '$(CC)' \
153                                '-I../include -I.. $(+sysdep-includes)' > $<.out
154
155 $(objpfx)annexc: annexc.c
156         $(native-compile)