New test to expose erroneous negative sign on logb(1) (bug 887).
[glibc.git] / elf / rtld-Rules
blob6526aec19ae84df4e8eaae3c60f333e927f81eba
1 # Subroutine makefile for compiling libc modules linked into dynamic linker.
3 # Copyright (C) 2002,2003,2005,2006,2008,2010,2011
4 #   Free Software Foundation, Inc.
5 # This file is part of the GNU C Library.
7 # The GNU C Library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # The GNU C Library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with the GNU C Library; if not, see
19 # <http://www.gnu.org/licenses/>.
21 # This makefile is never used by itself, but only from the rtld-libc.a
22 # rule in Makefile, which does make -f librtld.mk -f rtld-Rules.
23 # librtld.mk is the generated file containing variable definitions for
24 # `rtld-subdirs', a subset of the top-level $(subdirs) list; and for each
25 # SUBDIR in $(rtld-subdirs), `rtld-SUBDIR' listing `module.os' file names.
27 .PHONY: rtld-all
28 rtld-all:
30 # When run from the elf/Makefile to build rtld-libc.a, $(subdir) is elf.
31 ifneq ($(subdir),elf)
32 ifndef rtld-modules
33 error rtld-modules not set
34 endif
35 endif
37 ifndef rtld-modules
38 # Running to build rtld-libc.a, driving runs of $(rtld-subdir-make), below.
40 ifndef rtld-subdirs
41 error This makefile is a subroutine of elf/Makefile not to be used directly
42 endif
44 include ../Makeconfig
46 rtld-all: $(objpfx)rtld-libc.a
48 $(objpfx)rtld-libc.a: $(foreach dir,$(rtld-subdirs),\
49                                 $(addprefix $(common-objpfx)$(dir)/rtld-,\
50                                             $(rtld-$(dir))))
51         @-rm -f $@T
52         $(AR) cq$(verbose) $@T $^
53         mv -f $@T $@
55 # Use the verbose option of ar and tar when not running silently.
56 ifeq    "$(findstring s,$(MAKEFLAGS))" ""       # if not -s
57 verbose := v
58 else                                            # -s
59 verbose :=
60 endif                                           # not -s
63 # For each subdirectory, define a pattern rule that makes all of that
64 # subdirectory's modules at once with one recursive make command.
65 object-suffixes-left := $(rtld-subdirs)
66 define o-iterator-doit
67 $(foreach obj,$(rtld-$o),$(common-objpfx)%/rtld-$(obj)): FORCE ; \
68         +$$(rtld-subdir-make)
69 endef
70 include $(patsubst %,../o-iterator.mk,$(object-suffixes-left))
72 # This is how we descend into each subdirectory.  See below.
73 define rtld-subdir-make
74 $(MAKE) $(subdir-args) objdir=$(objdir) \
75         -f Makefile -f ../elf/rtld-Rules rtld-all \
76         rtld-modules='$(addprefix rtld-,$(rtld-$*))'
77 endef
79 # See subdir-target-args in ../Makefile for the model.
80 subdir-args = subdir=$*$(if $($*-srcdir),\
81                             -C $($*-srcdir) ..=`pwd`/,\
82                             -C $(..)$* ..=../)
84 FORCE:
86 else
88 # In this case we are being run by $(rtld-subdir-make), above.
89 # Some other subdir's Makefile has provided all its normal rules,
90 # and we just provide some additional definitions.
92 # These are the basic compilation rules corresponding to the Makerules ones.
93 # The sysd-rules generated makefile already defines pattern rules for rtld-%
94 # targets built from sysdeps source files.
95 $(objpfx)rtld-%.os: rtld-%.S $(before-compile)
96         $(compile-command.S) $(rtld-CPPFLAGS)
97 $(objpfx)rtld-%.os: rtld-%.s $(before-compile)
98         $(compile-command.s) $(rtld-CPPFLAGS)
99 $(objpfx)rtld-%.os: rtld-%.c $(before-compile)
100         $(compile-command.c) $(rtld-CPPFLAGS)
101 $(objpfx)rtld-%.os: %.S $(before-compile)
102         $(compile-command.S) $(rtld-CPPFLAGS)
103 $(objpfx)rtld-%.os: %.s $(before-compile)
104         $(compile-command.s) $(rtld-CPPFLAGS)
105 $(objpfx)rtld-%.os: %.c $(before-compile)
106         $(compile-command.c) $(rtld-CPPFLAGS)
108 # The rules for generated source files.
109 $(objpfx)rtld-%.os: $(objpfx)rtld-%.S $(before-compile); $(compile-command.S)
110 $(objpfx)rtld-%.os: $(objpfx)rtld-%.s $(before-compile); $(compile-command.s)
111 $(objpfx)rtld-%.os: $(objpfx)rtld-%.c $(before-compile); $(compile-command.c)
112 $(objpfx)rtld-%.os: $(objpfx)%.S $(before-compile); $(compile-command.S)
113 $(objpfx)rtld-%.os: $(objpfx)%.s $(before-compile); $(compile-command.s)
114 $(objpfx)rtld-%.os: $(objpfx)%.c $(before-compile); $(compile-command.c)
116 # The command line setting of rtld-modules (see above) tells us
117 # what we need to build, and that tells us what dependency files we need.
118 rtld-all: $(addprefix $(objpfx),$(rtld-modules))
120 # Figure out the dependency files we need.  After respecting the $(omit-deps)
121 # list as applied to the names without the `rtld-', there may be none left.
122 rtld-depfiles := $(patsubst %,$(objpfx)rtld-%.os.d,\
123                             $(filter-out $(omit-deps),\
124                                          $(rtld-modules:rtld-%.os=%)))
125 rtld-depfiles := $(strip $(wildcard $(rtld-depfiles)) \
126                          $(patsubst %.dt,%.d,\
127                                     $(wildcard $(rtld-depfiles:.d=.dt))))
128 ifdef rtld-depfiles
129 -include $(rtld-depfiles)
130 endif
132 # This here is the whole point of all the shenanigans.
133 rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
135 endif