update from main archive 960829
[platform/upstream/linaro-glibc.git] / sysdeps / mach / hurd / Makefile
1 # Copyright (C) 1993, 1994, 1995, 1996 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
6 # as published by the Free Software Foundation; either version 2 of
7 # the 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
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
18
19 ifdef in-Makerules
20
21 subdirs := $(filter-out sunrpc,$(subdirs)) # XXX skip broken dirs
22
23 # Look for header files in hurd/ under the top-level library source directory.
24 includes += -I$(..)hurd
25
26 # Do not use any assembly code from sysdeps/unix (and subdirectories).
27 # This bypasses all the system call stubs and uses any existing posix or
28 # generic C files instead.
29 inhibit-sysdep-asm += unix*
30 inhibit-unix-syscalls = yes
31
32 # Don't try to generate anything from the installed Unix system and its
33 # libraries.  That is only of use when building for a Unix system, so as to
34 # be compatible with some existing binaries for that system.
35 inhibit-glue = yes
36
37
38 ifeq (,$(filter mach hurd,$(subdir)))
39 # Subdirectories other than hurd/ might use the generated Hurd headers.
40 # So make sure we get a chance to run in hurd/ to make them before all else.
41 # (But we don't want to do this in mach/, because hurd/ needs some things
42 # there, and we know mach/ doesn't need anything from hurd/.)
43
44 hurd-objpfx = $(common-objpfx)hurd/
45
46 # These are all the generated headers that <hurd.h> includes.
47 before-compile += $(patsubst %,$(hurd-objpfx)hurd/%.h,io fs process)
48 $(patsubst %,$(hurd-objpfx)hurd/%.%,io fs process):
49         $(MAKE) -C $(..)hurd generated no_deps=t
50 endif
51 \f
52 # Generate errnos.h from the section of the manual that lists all the errno
53 # codes.
54
55 errno.texinfo = $(..)manual/errno.texi
56
57 hurd = $(..)sysdeps/mach/hurd
58
59 define mach-errno-h
60 ($(foreach h,mach/message.h \
61              mach/kern_return.h \
62              mach/mig_errors.h \
63              device/device_types.h,\
64  echo '#include <$h>';\
65  ))
66 endef
67
68 # We use the compiler to generate a list of absolute file names for
69 # the headers we want to search for Mach error codes, listed above (and
70 # incidentally, all other headers those include).
71 -include $(common-objpfx)errnos.d
72 $(common-objpfx)errnos.d: $(mach-errnos-deps)
73         $(mach-errno-h) | \
74         $(CC) $(CPPFLAGS) -M -x c - | \
75         sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' \
76             -e 's,\.\./,$(..),g' > $@t
77         mv -f $@t $@
78
79 $(hurd)/errnos.h: $(common-objpfx)stamp-errnos ;
80 $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
81                               $(mach-errnos-deps)
82         gawk -f $^ > $(hurd)/errnos.h-tmp
83 # Make it unwritable so noone will edit it by mistake.
84         -chmod a-w $(hurd)/errnos.h-tmp
85         ./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
86         test ! -d CVS || \
87           (cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
88         touch $@
89 generated += errnos.d stamp-errnos
90 \f
91 # We install the real libc.a as libcrt.a and as libc.a we install a linker
92 # script which does -( -lcrt -lmachuser -lhurduser -).
93
94 libc-name = crt
95
96 ifeq (,$(subdir))
97 install-others += $(libdir)/libc.a
98 $(libdir)/libc.a: $(hurd)/libc-ldscript; $(do-install)
99 endif
100
101 # For the shared library, we don't need to do the linker script machination.
102 # Instead, we specify the required libraries when building the shared object.
103 rpcuserlibs := $(common-objpfx)mach/libmachuser.so \
104                $(common-objpfx)hurd/libhurduser.so
105 $(common-objpfx)libc.so: $(rpcuserlibs)
106 rpath-link += $(common-objpfx)mach:$(common-objpfx)hurd
107
108 # The RPC stubs from these libraries are needed in building the dynamic
109 # linker, too.  It must be self-contained, so we link the needed PIC
110 # objects directly into the shared object.
111 ifeq (elf,$(subdir))
112 $(objpfx)librtld.so: $(rpcuserlibs:.so=_pic.a)
113 endif
114 \f
115
116 endif   # in-Makerules