]> git.ipfire.org Git - thirdparty/glibc.git/blame - Rules
2006-02-27 Roland McGrath <roland@redhat.com>
[thirdparty/glibc.git] / Rules
CommitLineData
9de06f3c
RM
1# Copyright (C) 1991-2000,2002,2003,2004,2005,2006
2# Free Software Foundation, Inc.
28f540f4
RM
3# This file is part of the GNU C Library.
4
5# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
28f540f4
RM
9
10# The GNU C Library is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13# Lesser General Public License for more details.
28f540f4 14
41bdb6e2
AJ
15# You should have received a copy of the GNU Lesser General Public
16# License along with the GNU C Library; if not, write to the Free
17# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18# 02111-1307 USA.
28f540f4
RM
19
20#
21# Rules for making a subdirectory in the GNU C library.
22# Each subdirectory Makefile defines some variables and includes this.
23#
24ifneq (,)
25This makefile requires GNU Make.
26endif
27
28all: # Don't let the default goal come from Makeconfig.
29
a334319f 30include ../Makeconfig
28f540f4
RM
31
32ifndef subdir
33Each subdirectory makefile must define the `subdir' variable.
34endif
c7562c74 35# This ` unconfuses emacs.
28f540f4
RM
36# This is benign and useless in GNU make before 3.63.
37export subdir := $(subdir)
38\f
39# This is the default target; it makes the library and auxiliary programs.
40.PHONY: all
96f873b9 41all: objs lib others
28f540f4 42
0413b54c 43ifeq ($(build-programs),yes)
a182affd 44others: $(addprefix $(objpfx),$(extra-objs) \
6c3ebebd
UD
45 $(install-lib) \
46 $(install-bin) $(install-bin-script) \
1ef32c3d 47 $(install-rootsbin) $(install-sbin))
0413b54c
UD
48else
49others: $(addprefix $(objpfx),$(extra-objs) \
50 $(install-lib))
51endif
a182affd 52
28f540f4
RM
53ifneq "$(findstring env,$(origin headers))" ""
54headers :=
55endif
56
57ifneq "$(findstring env,$(origin generated))" ""
58generated :=
59endif
60
924840c5
TBB
61ifneq "$(findstring env,$(origin common-generated))" ""
62common-generated :=
63endif
64
adee0e1f
RM
65# See below. This must be set before Makerules processes it.
66before-compile += $(common-objpfx)bits/stdio_lim.h
67
a334319f 68include ../Makerules
28f540f4
RM
69
70.PHONY: subdir_lib
3bbceb12 71subdir_lib: lib-noranlib
28f540f4
RM
72
73# Some subdirs need to install a dummy library.
74# They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
6e953631 75dep-dummy-lib = $(common-objpfx)dummy.o
28f540f4
RM
76define make-dummy-lib
77$(AR) cr$(verbose) $@ $<
78endef
74015205 79
6e953631 80$(common-objpfx)dummy.c:
f0097fa0 81 rm -f $@
27ee0a55
AJ
82 (echo 'extern void __dummy__ (void);'; \
83 echo 'void __dummy__ (void) { }') > $@
464d646f 84common-generated += dummy.o dummy.c
28f540f4 85\f
6d52618b 86# This makes all the auxiliary and test programs.
28f540f4
RM
87
88.PHONY: others tests
0413b54c 89ifeq ($(build-programs),yes)
414fd335 90others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
0413b54c
UD
91else
92others: $(addprefix $(objpfx),$(extra-objs))
93endif
28f540f4 94ifeq ($(cross-compiling),yes)
7cabd57c 95tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
c238ecf7 96xtests: tests
28f540f4 97else
ac556388
GM
98ifeq ($(build-bounded),yes)
99tests-bp.out = $(tests:%=$(objpfx)%-bp.out)
cc24242d 100xtests-bp.out = $(xtests:%=$(objpfx)%-bp.out)
ac556388
GM
101endif
102tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out)
cc24242d 103xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out)
786a5421 104endif
28f540f4 105
0413b54c 106ifeq ($(build-programs),yes)
c238ecf7 107binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
ccd8de9a 108binaries-static = $(others-static) $(tests-static) $(xtests-static)
0413b54c 109else
c238ecf7 110binaries-all = $(tests) $(xtests) $(test-srcs)
3c5edd4d 111binaries-static =
e1586792
UD
112endif
113
114binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
115
116ifneq "$(strip $(binaries-shared))" ""
117$(addprefix $(objpfx),$(binaries-shared)): %: %.o \
9992e360 118 $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
0413b54c
UD
119 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
120 $(+link)
121endif
e1586792
UD
122
123ifneq "$(strip $(binaries-static))" ""
124$(addprefix $(objpfx),$(binaries-static)): %: %.o \
9992e360 125 $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \
e1586792
UD
126 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
127 $(+link-static)
0413b54c 128endif
28f540f4 129
ac556388 130ifeq ($(build-bounded),yes)
c238ecf7 131binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs))
ac556388
GM
132$(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \
133 $(sort $(filter $(common-objpfx)lib%,$(link-libc-bounded))) \
134 $(addprefix $(csu-objpfx),start.ob) $(+preinit) $(+postinit)
135 $(+link-bounded)
136endif
137
c238ecf7 138ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
28f540f4
RM
139# These are the implicit rules for making test outputs
140# from the test programs and whatever input files are present.
41d998a6
GM
141
142make-test-out = GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
143 $($*-ENV) $(built-program-cmd) $($*-ARGS)
144$(objpfx)%-bp.out: %.input $(objpfx)%-bp
145 $(make-test-out) > $@ < $(word 1,$^)
196980f5 146$(objpfx)%.out: %.input $(objpfx)%
41d998a6 147 $(make-test-out) > $@ < $(word 1,$^)
196980f5 148$(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
41d998a6
GM
149 $(make-test-out) > $@
150
28f540f4
RM
151endif # tests
152\f
153.PHONY: distclean realclean subdir_distclean subdir_realclean \
3c5edd4d 154 subdir_clean subdir_mostlyclean subdir_testclean
28f540f4
RM
155subdir_mostlyclean: mostlyclean
156subdir_clean: clean
157subdir_distclean: distclean
158subdir_realclean: realclean
3c5edd4d 159subdir_testclean: do-tests-clean
28f540f4
RM
160realclean: distclean
161distclean: clean
162
28f540f4
RM
163# We want to install everything except the library itself, but update all
164# our portions of the library because the parent make will install it later
165# (likewise the stubs file).
166.PHONY: subdir_install
613a76ff 167subdir_install: install-no-libc.a lib-noranlib stubs
28f540f4 168
9de06f3c 169.PHONY: subdir_objs subdir_stubs
5d9e8991
RM
170subdir_objs: objs
171subdir_stubs: stubs
28f540f4 172
bd78530f
UD
173# Target required by the Hurd to ensure that all the MiG-generated
174# headers are in place before building a subdirectory.
175.PHONY: before-compile
176before-compile: $(before-compile)
177
3c5edd4d
UD
178$(common-objpfx)dummy.o: $(common-objpfx)dummy.c $(before-compile);
179 $(compile-command.c)
7ef90c15 180
c238ecf7
UD
181# Local Variables:
182# mode: makefile
183# End: