]>
Commit | Line | Data |
---|---|---|
9ae10332 | 1 | # Copyright (C) 1991-2000,2002,2003 Free Software Foundation, Inc. |
28f540f4 RM |
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 | |
41bdb6e2 AJ |
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. | |
28f540f4 RM |
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 | |
41bdb6e2 | 12 | # Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 AJ |
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. | |
28f540f4 RM |
18 | |
19 | # | |
20 | # Rules for making a subdirectory in the GNU C library. | |
21 | # Each subdirectory Makefile defines some variables and includes this. | |
22 | # | |
23 | ifneq (,) | |
24 | This makefile requires GNU Make. | |
25 | endif | |
26 | ||
27 | all: # Don't let the default goal come from Makeconfig. | |
28 | ||
29 | include ../Makeconfig | |
30 | ||
31 | ifndef subdir | |
32 | Each subdirectory makefile must define the `subdir' variable. | |
33 | endif | |
c7562c74 | 34 | # This ` unconfuses emacs. |
28f540f4 RM |
35 | # This is benign and useless in GNU make before 3.63. |
36 | export subdir := $(subdir) | |
37 | \f | |
38 | # This is the default target; it makes the library and auxiliary programs. | |
39 | .PHONY: all | |
96f873b9 | 40 | all: objs lib others |
28f540f4 | 41 | |
0413b54c | 42 | ifeq ($(build-programs),yes) |
a182affd | 43 | others: $(addprefix $(objpfx),$(extra-objs) \ |
6c3ebebd UD |
44 | $(install-lib) \ |
45 | $(install-bin) $(install-bin-script) \ | |
1ef32c3d | 46 | $(install-rootsbin) $(install-sbin)) |
0413b54c UD |
47 | else |
48 | others: $(addprefix $(objpfx),$(extra-objs) \ | |
49 | $(install-lib)) | |
50 | endif | |
a182affd | 51 | |
28f540f4 RM |
52 | ifneq "$(findstring env,$(origin headers))" "" |
53 | headers := | |
54 | endif | |
55 | ||
56 | ifneq "$(findstring env,$(origin generated))" "" | |
57 | generated := | |
58 | endif | |
59 | ||
924840c5 TBB |
60 | ifneq "$(findstring env,$(origin common-generated))" "" |
61 | common-generated := | |
62 | endif | |
63 | ||
adee0e1f RM |
64 | # See below. This must be set before Makerules processes it. |
65 | before-compile += $(common-objpfx)bits/stdio_lim.h | |
66 | ||
28f540f4 RM |
67 | include ../Makerules |
68 | ||
69 | .PHONY: subdir_lib | |
3bbceb12 | 70 | subdir_lib: lib-noranlib |
28f540f4 RM |
71 | |
72 | # Some subdirs need to install a dummy library. | |
73 | # They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)". | |
6e953631 | 74 | dep-dummy-lib = $(common-objpfx)dummy.o |
28f540f4 RM |
75 | define make-dummy-lib |
76 | $(AR) cr$(verbose) $@ $< | |
77 | endef | |
74015205 | 78 | |
6e953631 | 79 | $(common-objpfx)dummy.c: |
f0097fa0 | 80 | rm -f $@ |
27ee0a55 AJ |
81 | (echo 'extern void __dummy__ (void);'; \ |
82 | echo 'void __dummy__ (void) { }') > $@ | |
464d646f | 83 | common-generated += dummy.o dummy.c |
28f540f4 | 84 | \f |
6d52618b | 85 | # This makes all the auxiliary and test programs. |
28f540f4 RM |
86 | |
87 | .PHONY: others tests | |
0413b54c | 88 | ifeq ($(build-programs),yes) |
414fd335 | 89 | others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs)) |
0413b54c UD |
90 | else |
91 | others: $(addprefix $(objpfx),$(extra-objs)) | |
92 | endif | |
28f540f4 | 93 | ifeq ($(cross-compiling),yes) |
7cabd57c | 94 | tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) |
c238ecf7 | 95 | xtests: tests |
28f540f4 | 96 | else |
ac556388 GM |
97 | ifeq ($(build-bounded),yes) |
98 | tests-bp.out = $(tests:%=$(objpfx)%-bp.out) | |
c238ecf7 | 99 | xtests-bp.out = $(tests:%=$(objpfx)%-bp.out) $(xtests:%=$(objpfx)%-bp.out) |
ac556388 GM |
100 | endif |
101 | tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out) | |
c238ecf7 | 102 | xtests: $(tests:%=$(objpfx)%.out) $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) |
786a5421 | 103 | endif |
28f540f4 | 104 | |
0413b54c | 105 | ifeq ($(build-programs),yes) |
c238ecf7 | 106 | binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) |
5afe6c02 | 107 | binaries-static = $(others-static) $(tests-static) |
0413b54c | 108 | else |
c238ecf7 | 109 | binaries-all = $(tests) $(xtests) $(test-srcs) |
3c5edd4d | 110 | binaries-static = |
e1586792 UD |
111 | endif |
112 | ||
113 | binaries-shared = $(filter-out $(binaries-static), $(binaries-all)) | |
114 | ||
115 | ifneq "$(strip $(binaries-shared))" "" | |
116 | $(addprefix $(objpfx),$(binaries-shared)): %: %.o \ | |
9992e360 | 117 | $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ |
0413b54c UD |
118 | $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) |
119 | $(+link) | |
120 | endif | |
e1586792 UD |
121 | |
122 | ifneq "$(strip $(binaries-static))" "" | |
123 | $(addprefix $(objpfx),$(binaries-static)): %: %.o \ | |
9992e360 | 124 | $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ |
e1586792 UD |
125 | $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) |
126 | $(+link-static) | |
0413b54c | 127 | endif |
28f540f4 | 128 | |
ac556388 | 129 | ifeq ($(build-bounded),yes) |
c238ecf7 | 130 | binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs)) |
ac556388 GM |
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) | |
135 | endif | |
136 | ||
c238ecf7 | 137 | ifneq "$(strip $(tests) $(xtests) $(test-srcs))" "" |
28f540f4 RM |
138 | # These are the implicit rules for making test outputs |
139 | # from the test programs and whatever input files are present. | |
41d998a6 GM |
140 | |
141 | make-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,$^) | |
196980f5 | 145 | $(objpfx)%.out: %.input $(objpfx)% |
41d998a6 | 146 | $(make-test-out) > $@ < $(word 1,$^) |
196980f5 | 147 | $(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence. |
41d998a6 GM |
148 | $(make-test-out) > $@ |
149 | ||
28f540f4 RM |
150 | endif # tests |
151 | \f | |
152 | .PHONY: distclean realclean subdir_distclean subdir_realclean \ | |
3c5edd4d | 153 | subdir_clean subdir_mostlyclean subdir_testclean |
28f540f4 RM |
154 | subdir_mostlyclean: mostlyclean |
155 | subdir_clean: clean | |
156 | subdir_distclean: distclean | |
157 | subdir_realclean: realclean | |
3c5edd4d | 158 | subdir_testclean: do-tests-clean |
28f540f4 RM |
159 | realclean: distclean |
160 | distclean: clean | |
161 | ||
162 | .PHONY: subdir_echo-headers | |
163 | subdir_echo-headers: echo-headers | |
164 | ||
165 | .PHONY: subdir_echo-distinfo | |
166 | subdir_echo-distinfo: | |
d705269e | 167 | @echo $(addprefix +header+,$(headers) $(filter %.h,$(distribute))) \ |
924840c5 | 168 | $(addprefix +nodist+,$(generated) $(common-generated) $(dont_distribute)) |
28f540f4 RM |
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 | |
613a76ff | 174 | subdir_install: install-no-libc.a lib-noranlib stubs |
28f540f4 RM |
175 | |
176 | .PHONY: subdir_TAGS subdir_dist | |
177 | subdir_TAGS: TAGS | |
178 | subdir_dist: dist | |
179 | ||
bd78530f UD |
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 | |
183 | before-compile: $(before-compile) | |
184 | ||
3c5edd4d UD |
185 | $(common-objpfx)dummy.o: $(common-objpfx)dummy.c $(before-compile); |
186 | $(compile-command.c) | |
7ef90c15 | 187 | |
c238ecf7 UD |
188 | # Local Variables: |
189 | # mode: makefile | |
190 | # End: |