]>
Commit | Line | Data |
---|---|---|
28f540f4 RM |
1 | # Copyright (C) 1993, 1994, 1995 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 | # Get mach-srcdir defined. | |
20 | old-in-Makerules := $(in-Makerules) | |
21 | in-Makerules := | |
22 | include $(..)sysdeps/mach/Makefile | |
23 | in-Makerules := $(old-in-Makerules) | |
24 | ||
25 | ||
26 | ifndef hurd-srcdir-computed | |
27 | hurd-srcdir-computed := yes | |
28 | ||
29 | # If we were configured with `--with-hurd=DIR', then config.make sets | |
30 | # hurd-srcdir to DIR. Otherwise guess we are in a big source tree. | |
31 | ifndef hurd-srcdir | |
32 | hurd-srcdir = ../hurd | |
33 | endif | |
34 | ||
35 | # hurd-srcdir is now set to the logical directory name. This name might be | |
36 | # relative to $(objdir), might be relative to the source directory $(..), or | |
37 | # might be absolute. We choose among these possibilities by looking for a | |
38 | # canonical file in each of those places (in that order). | |
39 | f := hurd/hurd_types.defs # Random file that identifies the Hurd source dir. | |
40 | f := $(strip $f) | |
41 | hurd-srcdir := $(firstword $(patsubst %/$f,%,$(wildcard $(addsuffix /$f,\ | |
42 | $(objpfx)$(hurd-srcdir) $(..)$(hurd-srcdir)))) $(hurd-srcdir)) | |
43 | ||
44 | endif # ! hurd-srcdir-computed | |
45 | \f | |
46 | ifdef in-Makerules | |
47 | ||
48 | # For the time being, elide directories where nothing at all works. | |
49 | subdirs := $(filter-out sunrpc manual,$(subdirs)) # XXX | |
50 | ||
51 | # Look for header files in hurd/ under the top-level library source directory. | |
52 | includes += -I$(..)hurd | |
53 | ||
54 | # When compiling, use the Hurd header files directly from the sources. | |
55 | includes += -I$(hurd-srcdir) | |
56 | ||
57 | # When compiling, find cthreads.h in the Hurd cthreads source. | |
58 | # This directory has some other (private) header file with | |
59 | # conflicting names, so we put it last. | |
60 | last-includes += -I$(hurd-srcdir)/libthreads | |
61 | ||
62 | # Find the Hurd header files in the Hurd source. | |
63 | vpath hurd/%.h $(hurd-srcdir) | |
64 | ||
65 | # Do not use any assembly code from sysdeps/unix (and subdirectories). | |
66 | # This bypasses all the system call stubs and uses any existing posix or | |
67 | # generic C files instead. | |
68 | inhibit-sysdep-asm += unix* | |
69 | ||
70 | # Don't try to generate anything from the installed Unix system and its | |
71 | # libraries. That is only of use when building for a Unix system, so as to | |
72 | # be compatible with some existing binaries for that system. | |
73 | inhibit-glue = yes | |
74 | ||
75 | ||
76 | ifeq (,$(filter mach hurd,$(subdir))) | |
77 | # Subdirectories other than hurd/ might use the generated Hurd headers. | |
78 | # So make sure we get a chance to run in hurd/ to make them before all else. | |
79 | # (But we don't want to do this in mach/, because hurd/ needs some things | |
80 | # there, and we know mach/ doesn't need anything from hurd/.) | |
81 | ||
82 | ifdef objpfx | |
83 | hurd-objpfx = $(objpfx) | |
84 | else | |
85 | hurd-objpfx = $(..)hurd/ | |
86 | endif | |
87 | ||
88 | # These are all the generated headers that <hurd.h> includes. | |
89 | before-compile += $(patsubst %,$(hurd-objpfx)hurd/%.h,io fs process) | |
90 | $(patsubst %,$(hurd-objpfx)hurd/%.%,io fs process): | |
91 | $(MAKE) -C $(..)hurd generated no_deps=t | |
92 | endif | |
93 | \f | |
94 | # Generate errnos.h and sys_errlist.c from the section of the manual that | |
95 | # lists all the errno codes. | |
96 | ||
97 | errno.texinfo = $(..)manual/errno.texi | |
98 | ||
99 | hurd = $(..)sysdeps/mach/hurd | |
100 | ||
101 | $(hurd)/errnos.h: $(objpfx)stamp-errnos ; | |
102 | $(objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \ | |
103 | $(mach-srcdir)/mach/message.h \ | |
104 | $(mach-srcdir)/mach/kern_return.h \ | |
105 | $(mach-srcdir)/mach/mig_errors.h \ | |
106 | $(mach-srcdir)/device/device_types.h | |
107 | gawk -f $^ > $(hurd)/errnos.h-tmp | |
108 | # Make it unwritable so noone will edit it by mistake. | |
109 | -chmod a-w $(hurd)/errnos.h-tmp | |
110 | ./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h | |
0923c7a5 RM |
111 | test -d CVS && \ |
112 | (cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h) | |
28f540f4 RM |
113 | touch $@ |
114 | ||
115 | $(hurd)/errlist.c: $(hurd)/errlist.awk $(errno.texinfo) | |
116 | gawk -f $^ > $@-tmp | |
117 | # Make it unwritable so noone will edit it by mistake. | |
118 | -chmod a-w $@-tmp | |
119 | mv -f $@-tmp $@ | |
120 | test -d CVS && cvs commit -m'Regenerated from $^' $@ | |
121 | \f | |
122 | # We install the real libc.a as libcrt.a and as libc.a we install a linker | |
123 | # script which does -( -lcrt -lmachuser -lhurduser -). | |
124 | ||
125 | libc-name = crt | |
126 | ||
127 | ifeq (,$(subdir)) | |
128 | install-others += $(libdir)/libc.a | |
129 | $(libdir)/libc.a: $(hurd)/libc-ldscript; $(do-install) | |
130 | endif | |
131 | \f | |
132 | ||
133 | endif # in-Makerules |