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