1 # Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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
6 # as published by the Free Software Foundation; either version 2 of
7 # the License, or (at your option) any later version.
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.
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.
21 subdirs := $(filter-out sunrpc,$(subdirs)) # XXX skip broken dirs
22 # See hurd/Makefile for commands that install some crucial sunrpc headers.
24 # Look for header files in hurd/ under the top-level library source directory.
25 # Look for generated header files where they get created.
26 includes += -I$(..)hurd -I$(common-objpfx)hurd/
28 # We use the style `if (err = call(...))' a lot in the Hurd code,
29 # where we have a lot of functions that return zero or an errno code.
30 +cflags += -Wno-parentheses
32 # Do not use any assembly code from sysdeps/unix (and subdirectories).
33 # This bypasses all the system call stubs and uses any existing posix or
34 # generic C files instead.
35 inhibit-sysdep-asm += unix*
36 inhibit-unix-syscalls = yes
38 # Don't try to generate anything from the installed Unix system and its
39 # libraries. That is only of use when building for a Unix system, so as to
40 # be compatible with some existing binaries for that system.
43 ifeq (,$(filter mach hurd,$(subdir)))
44 # Subdirectories other than hurd/ might use the generated Hurd headers.
45 # So make sure we get a chance to run in hurd/ to make them before all else.
46 # (But we don't want to do this in mach/, because hurd/ needs some things
47 # there, and we know mach/ doesn't need anything from hurd/.)
49 hurd-objpfx = $(common-objpfx)hurd/
51 # These are all the generated headers that <hurd.h> includes.
52 before-compile += $(patsubst %,$(hurd-objpfx)hurd/%.h,auth io fs process)
53 $(patsubst %,$(hurd-objpfx)hurd/%.%,auth io fs process):
54 $(MAKE) -C $(..)hurd before-compile no_deps=t
57 # Hurd profil.c includes this file, so give a rule to make it.
59 $(common-objpfx)hurd/../mach/RPC_task_get_sampled_pcs.c:
60 $(MAKE) -C $(..)mach before-compile no_deps=t
64 # Generate errnos.h from the section of the manual that lists all the errno
67 errno.texinfo = $(..)manual/errno.texi
69 hurd = $(..)sysdeps/mach/hurd
72 ($(foreach h,mach/message.h \
75 device/device_types.h,\
76 echo '#include <$h>';\
80 # We use the compiler to generate a list of absolute file names for
81 # the headers we want to search for Mach error codes, listed above (and
82 # incidentally, all other headers those include).
83 -include $(common-objpfx)errnos.d
84 $(common-objpfx)errnos.d: $(mach-errnos-deps)
86 $(CC) $(CPPFLAGS) -M -x c - | \
87 sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' \
88 -e 's,\.\./,$(..),g' > $@t
91 $(hurd)/errnos.h: $(common-objpfx)stamp-errnos ;
92 $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
94 $(AWK) -f $^ > $(hurd)/errnos.h-tmp
95 # Make it unwritable so noone will edit it by mistake.
96 -chmod a-w $(hurd)/errnos.h-tmp
97 $(move-if-change) $(hurd)/errnos.h-tmp $(hurd)/errnos.h
98 ifeq ($(with-cvs),yes)
99 test ! -d $(hurd)/CVS || \
100 (cd $(hurd) && cvs commit -m'Regenerated from $^' errnos.h)
104 common-generated += errnos.d stamp-errnos
106 # We install the real libc.a as libcrt.a and as libc.a we install a linker
107 # script which does -( -lcrt -lmachuser -lhurduser -).
112 install-others += $(inst_libdir)/libc.a $(inst_libdir)/libc_p.a
113 $(inst_libdir)/libc.a: $(hurd)/libc-ldscript $(+force); $(do-install)
114 $(inst_libdir)/libc_p.a: $(hurd)/libc_p-ldscript $(+force); $(do-install)
117 # Make sure these are used to build the libc.so shared object too.
118 rpcuserlibs := $(common-objpfx)mach/libmachuser.so \
119 $(common-objpfx)hurd/libhurduser.so
120 $(common-objpfx)libc.so: $(rpcuserlibs)
121 rpath-dirs += mach hurd
123 # And get them into the libc.so ldscript.
124 $(inst_libdir)/libc.so: $(rpcuserlibs)
126 # The RPC stubs from these libraries are needed in building the dynamic
127 # linker, too. It must be self-contained, so we link the needed PIC
128 # objects directly into the shared object.
130 $(objpfx)librtld.os: $(rpcuserlibs:.so=_pic.a)
132 CFLAGS-dl-load.c = -DEXTERNAL_MAP_FROM_FD
135 # We need these libs to link static programs in the libc source tree, too.
136 ifeq (yes,$(build-static))
137 link-libc-static := -Wl,-\( \
138 $(patsubst %,$(common-objpfx)%.a,\
139 libc mach/libmachuser hurd/libhurduser) \
142 ifeq (yes,$(build-shared))
143 # We can try to link the programs with lib*_pic.a...
144 link-libc-static := $(link-libc) -Wl,-\( \
145 $(patsubst %,$(common-objpfx)%_pic.a,\
146 libc mach/libmachuser hurd/libhurduser) \
151 ifeq (hurd, $(subdir))
152 sysdep_routines += cthreads