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