Do not build manual in the source directory
[platform/upstream/glibc.git] / mach / Machrules
index b5a6998..d211bce 100644 (file)
@@ -1,22 +1,21 @@
 # Rules for MiG interfaces that want to go into the C library.
-
-# Copyright (C) 1991,92,93,94,95,96,98,99 Free Software Foundation, Inc.
+# Copyright (C) 1991,1992,1993,1994,1995,1996,1998,1999,2001,2002,2006
+#      Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License
-# as published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
 
 # The GNU C Library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
+# Lesser General Public License for more details.
 
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
 
 # Makefiles may define these variable before including this file:
 #      user-interfaces         Names of interfaces to put user stubs in for.
@@ -55,6 +54,9 @@ $(objpfx)dummy.mk:
 
 MIGFLAGS = -DMACH_IPC_COMPAT=0 -DSTANDALONE -DTypeCheck=0 \
           $(+includes) $(migdefines) -subrprefix __
+# Putting CC in the enivronment makes the mig wrapper script
+# use the same compiler setup we are using to run cpp.
+MIG := CC='${CC}' CPP='${CPP} -x c' $(MIG)
 
 .SUFFIXES: .defs       # Just to set specified_rule_matched.
 
@@ -132,12 +134,14 @@ $(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp:
 $(patsubst %,$(objpfx)%.udeps,$(user-interfaces)):
   $(objpfx)%.udeps: $(..)mach/Machrules
        $(make-target-directory)
+# We must use $(CFLAGS) to get -O flags that affect #if's in header files.
        $(include-%.defs) | \
-       $(CC) $(CPPFLAGS) -M -x c - | \
-       sed -e 's,- *:,$@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h)\
-                         $(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
+       $(CC) $(CFLAGS) $(CPPFLAGS) -M -x c - | \
+       sed -e 's,- *:,$(.udeps-targets):,' \
            $(sed-remove-objpfx) > $@.new
        mv -f $@.new $@
+.udeps-targets = $@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h) \
+                $(@:.udeps=_server.c) $(@:.udeps=_server.h)
 endif
 
 # Look for the server stub files where they will be written.
@@ -154,14 +158,14 @@ $(objpfx)%_server.c $(objpfx)%_server.h:
 
 # To get header files that declare both the straight and __ functions,
 # we generate two files and paste them together.
-$(objpfx)%.uh:; $(mig.uh)
+$(patsubst %,$(objpfx)%.uh,$(user-interfaces)): $(objpfx)%.uh:; $(mig.uh)
 define mig.uh
 $(make-target-directory)
 $(include-%.defs) | \
 $(MIG) - /dev/null $(MIGFLAGS) $(MIGFLAGS-$*) \
        -header $@ -server /dev/null -user /dev/null
 endef
-$(objpfx)%.__h:; $(mig.__h)
+$(patsubst %,$(objpfx)%.__h,$(user-interfaces)): $(objpfx)%.__h:; $(mig.__h)
 define mig.__h
 $(make-target-directory)
 $(include-%.defs) | \
@@ -169,7 +173,8 @@ $(MIG) - /dev/null $(MIGFLAGS) $(MIGFLAGS-$*) -prefix __ \
        -header $@ -server /dev/null -user /dev/null
 endef
 
-$(objpfx)%.h: $(objpfx)%.__h $(objpfx)%.uh
+$(patsubst %,$(objpfx)%.h,$(user-interfaces)): $(objpfx)%.h: $(objpfx)%.__h \
+                                                            $(objpfx)%.uh
 # The last line of foo.__h is "#endif _foo_user_".
 # The first two lines of foo.uh are "#ifndef _foo_user_"/"#define _foo_user_".
        (sed -e '$$d' $<; sed -e '1,2d' $(word 2,$^)) > $@-new
@@ -221,13 +226,11 @@ $(interface-library)-routines = $(interface-routines)
 extra-libs += $(interface-library)
 extra-libs-others += $(interface-library)
 
-# Avoid -lmachuser requiring -lc, which may not be built yet.  If the
-# shared object is absent, ld may choose a static library someplace and
-# produce a bogus libmachuser.so.
-+preinit =
-+postinit =
-+interp =
-interface.so = $(interface-library:lib%=%.so)
-LDFLAGS-$(interface.so) = -nostdlib -nostartfiles
+ifeq (yes,$(build-shared))
+interface.so = $(interface-library:=.so)
+
+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
+$(objpfx)$(interface.so): $(common-objpfx)libc.so
+endif
 
 endif