1 # Copyright (C) 1993, 1994 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
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
19 ifndef mach-srcdir-computed
20 mach-srcdir-computed
:= yes
22 # If we were configured with `--with-mach=DIR', then config.make sets
23 # mach-srcdir to DIR. Otherwise guess we are in a big source tree.
28 # mach-srcdir is now set to the logical directory name. This name might be
29 # relative to $(objdir), might be relative to the source directory $(..), or
30 # might be absolute. We choose among these possibilities by looking for a
31 # canonical file in each of those places (in that order).
32 f
:= mach
/mach.defs
# Random file that identifies the Mach source dir.
34 mach-srcdir
:= $(firstword $(patsubst %/$f,%,$(wildcard $(addsuffix /$f,\
35 $(objpfx
)$(mach-srcdir
) $(..
)$(mach-srcdir
)))) $(mach-srcdir
))
37 endif # ! mach-srcdir-computed
41 # Look for header files in mach/ under the top-level library source directory.
42 includes
+= -I
$(..
)mach
44 # When compiling, use the Mach header files directly from the kernel sources.
45 includes
+= -I
$(mach-srcdir
)
47 # Find Mach header files in the kernel source.
48 vpath mach
/%.h
$(mach-srcdir
)
49 vpath device
/%.h
$(mach-srcdir
)
51 ifneq (mach
,$(subdir
))
52 # Subdirectories other than mach/ might use the generated Mach headers.
53 # So make sure we get a chance to run in mach/ to make them before all else.
56 mach-objpfx
= $(objpfx
)
58 mach-objpfx
= $(..
)mach
/
61 # These are all the generated files that <mach.h> includes.
62 mach-before-compile
:= $(mach-objpfx
)mach-shortcuts.h \
63 $(patsubst %,$(mach-objpfx
)mach
/mach_
%.h
,\
66 # This patsubst generates patterns like `m%h-shortcuts.h', which are damn
67 # likely to match just the corresponding particular file we want.
68 $(patsubst mach
%,m\
%h
%,$(mach-before-compile
)): # Run only if doesn't exist.
69 $(MAKE
) -C
$(..
)mach generated no_deps
=t
71 before-compile
+= $(mach-before-compile
)