2.5-18.1
[jlayton/glibc.git] / elf / rtld-Rules
index ac96f728d9e29cf2b005342b70bd8da73580c6d7..01fbbdf0c595bd5689abc95da93cfafc602ca5d4 100644 (file)
@@ -1,6 +1,6 @@
 # Subroutine makefile for compiling libc modules linked into dynamic linker.
 
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 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
 rtld-all:
 
 # When run from the elf/Makefile to build rtld-libc.a, $(subdir) is elf.
-ifeq ($(subdir),elf)
+ifneq ($(subdir),elf)
+ifndef rtld-modules
+error rtld-modules not set
+endif
+endif
+
+ifndef rtld-modules
+# Running to build rtld-libc.a, driving runs of $(rtld-subdir-make), below.
 
 ifndef rtld-subdirs
 error This makefile is a subroutine of elf/Makefile not to be used directly
@@ -65,10 +72,16 @@ include $(patsubst %,../o-iterator.mk,$(object-suffixes-left))
 
 # This is how we descend into each subdirectory.  See below.
 define rtld-subdir-make
-$(MAKE) -C ../$* objdir=$(objdir) -f Makefile -f ../elf/rtld-Rules rtld-all \
+$(MAKE) $(subdir-args) objdir=$(objdir) \
+       -f Makefile -f ../elf/rtld-Rules rtld-all \
        rtld-modules='$(addprefix rtld-,$(rtld-$*))'
 endef
 
+# See subdir-target-args in ../Makefile for the model.
+subdir-args = subdir=$*$(if $($*-srcdir),\
+                           -C $($*-srcdir) ..=`pwd`/,\
+                           -C $(..)$* ..=../)
+
 FORCE:
 
 else