]> sourceware.org Git - glibc.git/blame - Makerules
Update.
[glibc.git] / Makerules
CommitLineData
3c5edd4d 1# Copyright (C) 1991,92,93,94,95,96,97,98,99 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
5# modify it under the terms of the GNU Library General Public License as
6# published by the Free Software Foundation; either version 2 of the
7# 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# Library General Public License for more details.
13
14# You should have received a copy of the GNU Library General Public
54d79e99
UD
15# License along with the GNU C Library; see the file COPYING.LIB. If not,
16# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17# Boston, MA 02111-1307, USA.
28f540f4
RM
18
19#
20# Common rules for making the GNU C library. This file is included
21# by the top-level Makefile and by all subdirectory makefiles
22# (through Rules).
23#
24ifneq (,)
25This makefile requires GNU Make.
26endif
27
14bab8de 28REQUIRED_MAKE_VERSION = 3.74
6952e59e 29REAL_MAKE_VERSION = $(firstword $(MAKE_VERSION))
14bab8de
UD
30
31ifneq ($(REQUIRED_MAKE_VERSION), \
54d79e99 32 $(firstword $(sort $(REAL_MAKE_VERSION) $(REQUIRED_MAKE_VERSION))))
14bab8de
UD
33Wrong GNU Make version. See above for the version needed.
34endif
35
28f540f4
RM
36
37ifdef subdir
38.. := ../
39endif # subdir
40
41# If `sources' was defined by the parent makefile, undefine it so
42# we will later get it from wildcard search in this directory.
43ifneq "$(findstring env,$(origin sources))" ""
44sources :=
45endif
46
28f540f4
RM
47oPATH := $(PATH)
48PATH := this definition should take precedence over $(oPATH)
49ifeq ($(PATH),$(oPATH))
50You must not use the -e flag when building the GNU C library.
51else
52PATH := $(oPATH)
53endif
54\f
55ifndef +included-Makeconfig
56include $(..)Makeconfig
57endif
58
59# `configure' writes a definition of `config-sysdirs' in `config.make'.
57ba7bb4 60sysdirs = $(strip $(full-config-sysdirs))
28f540f4
RM
61
62+sysdir_pfx = $(common-objpfx)
63
64export sysdirs := $(sysdirs)
65
57ba7bb4 66+sysdep_dirs := $(full-config-sysdirs)
28f540f4
RM
67ifdef objdir
68+sysdep_dirs := $(objdir) $(+sysdep_dirs)
69endif
70
71# Add -I switches to get the right sysdep directories.
72# `+includes' in Makeconfig references $(+sysdep-includes).
73+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
dbdb6189 74
ceb2d9aa
UD
75# This variable is used in ``include $(o-iterator)'' after defining
76# $(o-iterator-doit) to produce some desired rule using $o for the object
77# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
78# is produced for each object suffix in use.
79o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
28f540f4
RM
80\f
81# Include any system-specific makefiles.
82
83# This is here so things in sysdep Makefiles can easily depend on foo.h as
84# appropriate and not worry about where foo.h comes from, which may be
85# system dependent and not known by that Makefile.
6e953631 86vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
57ba7bb4 87 $(+sysdep_dirs) $(..)))
28f540f4 88
714a562f
UD
89# The same is true for RPC source files.
90vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
91 $(+sysdep_dirs) $(..)))
92
28f540f4
RM
93# Some sysdep makefiles use this to distinguish being included here from
94# being included individually by a subdir makefile (hurd/Makefile needs this).
95in-Makerules := yes
96
555f3a39 97-include $(+sysdir_pfx)sysd-Makefile
da2d1bc5 98ifndef avoid-generated
57ba7bb4 99ifneq ($(sysd-Makefile-sysdirs),$(config-sysdirs))
273d56ce
RM
100sysd-Makefile-force = FORCE
101FORCE:
102endif
103$(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules \
104 $(sysd-Makefile-force)
28f540f4 105 -@rm -f $@T
57ba7bb4 106 (echo 'sysd-Makefile-sysdirs := $(config-sysdirs)'; \
9c4c0024
UD
107 for file in $(config-sysdirs:=/Makefile); do \
108 if [ -f $(..)$$file ]; then \
109 echo include "\$$(..)$$file"; \
28f540f4 110 else true; fi; \
0d204b0a 111 done; \
28f540f4
RM
112 echo 'sysd-Makefile-done=t') > $@T
113 mv -f $@T $@
114endif
115
3bbceb12
RM
116ifndef sysd-Makefile-done
117# Don't do deps until this exists, because it might change the sources list.
118no_deps=t
119endif
120
121
28f540f4
RM
122# Reorder before-compile so that mach things come first, and hurd things
123# second, before all else. The mach and hurd subdirectories have many
124# generated header files which the much of rest of the library depends on,
125# so it is best to build them first (and mach before hurd, at that).
126before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
127 $(before-compile)) \
128 $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
129 $(before-compile))
130
131# Remove existing files from `before-compile'. Things are added there when
132# they must exist for dependency generation to work right, but once they
133# exist there is no further need for every single file to depend on them,
134# and those gratuitous dependencies result in many gratuitous
135# recompilations.
136before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
137
138# Don't let any before-compile file be an intermediate and get removed.
139ifdef before-compile
140$(before-compile):
141endif
142\f
143# Generate an ordered list of implicit rules which find the source files in
144# each sysdep directory. The old method was to use vpath to search all the
145# sysdep directories. However, that had the problem that a .S file in a
146# later directory would be chosen over a .c file in an earlier directory,
147# which does not preserve the desired sysdeps ordering behavior.
148
149# When making the list of .d files to include, we can't know which ones
150# have source in .s files, and thus do not in fact need a .d file.
151# So we must define rules to make .d files for .s files.
152define make-dummy-dep
6e953631 153$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
28f540f4 154endef
6e953631 155$(common-objpfx)dummy.d:
28f540f4
RM
156 echo '# .s files cannot contain includes, so they need no deps.' > $@
157
158# It matters that this set of rules, for compiling from sources in
159# the current directory (the $srcdir/$subdir) come before the
160# generated sysdep rules in included from sysd-rules below. When
161# compiling in the source tree, generated sources go into the current
162# directory, and those should be chosen before any sources in sysdeps.
ceb2d9aa
UD
163define o-iterator-doit
164$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
165endef
3f62b69a 166object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 167include $(o-iterator)
28f540f4 168$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
ceb2d9aa
UD
169
170define o-iterator-doit
171$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
172endef
3f62b69a 173object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 174include $(o-iterator)
6e953631 175$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)
ceb2d9aa
UD
176
177define o-iterator-doit
178$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
179endef
3f62b69a 180object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 181include $(o-iterator)
28f540f4
RM
182$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
183
184# Omit the objpfx rules when building in the source tree, because
185# objpfx is empty and so these rules just override the ones above.
186ifdef objpfx
187# Define first rules to find the source files in $(objpfx).
188# Generated source files will end up there.
ceb2d9aa
UD
189define o-iterator-doit
190$(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S)
191endef
3f62b69a 192object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 193include $(o-iterator)
28f540f4 194$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
ceb2d9aa
UD
195
196define o-iterator-doit
197$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
198endef
3f62b69a 199object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 200include $(o-iterator)
6e953631 201$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)
ceb2d9aa
UD
202
203define o-iterator-doit
204$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
205endef
3f62b69a 206object-suffixes-left := $(all-object-suffixes)
ceb2d9aa 207include $(o-iterator)
28f540f4
RM
208$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
209endif
210
211# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
212# patterns matching sysdep directories whose assembly source files should
213# be suppressed.
214ifdef inhibit-sysdep-asm
215define open-check-inhibit-asm
216case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
217endef
51f75302 218close-check-inhibit-asm = ;; esac ;
28f540f4
RM
219endif
220
221# Don't include sysd-rules until sysd-Makefile is already there and has been
222# included. It might define inhibit-sysdep-asm, which would affect the
223# contents of sysd-rules.
224ifdef sysd-Makefile-done
555f3a39 225-include $(+sysdir_pfx)sysd-rules
57ba7bb4
UD
226ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
227# The value of $(+sysdep_dirs) the sysd-rules was computed for
273d56ce
RM
228# differs from the one we are using now. So force a rebuild of sysd-rules.
229sysd-rules-force = FORCE
230FORCE:
231endif
28f540f4
RM
232endif
233$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
234 $(wildcard $(foreach dir,$(sysdirs),\
57ba7bb4 235 $(dir)/Makefile))\
273d56ce 236 $(sysd-rules-force)
28f540f4 237 -@rm -f $@T
57ba7bb4 238 (echo 'sysd-rules-sysdirs := $(config-sysdirs)'; \
9c4c0024 239 for dir in $(config-sysdirs:%='$$(..)%'); do \
795fbc9a 240 for o in $(all-object-suffixes); do \
51f75302
RM
241 $(open-check-inhibit-asm) \
242 echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
243 \$$(compile-command.S)"; \
244 echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
245 \$$(compile-command.s)"; \
246 $(close-check-inhibit-asm) \
247 echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
248 \$$(compile-command.c)"; \
249 done; \
28f540f4 250 $(open-check-inhibit-asm) \
6e953631 251 echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
51f75302 252 \$$(make-dummy-dep)"; \
28f540f4
RM
253 echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
254 \$$(+make-deps)"; \
51f75302 255 $(close-check-inhibit-asm) \
28f540f4
RM
256 echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
257 \$$(+make-deps)"; \
3bbceb12
RM
258 done; \
259 echo 'sysd-rules-done = t') > $@T
28f540f4
RM
260 mv -f $@T $@
261
3bbceb12
RM
262ifndef sysd-rules-done
263# Don't do deps until this exists, because it provides rules to make the deps.
264no_deps=t
265endif
266
7a68c94a
UD
267# Generate version maps, but wait until sysdep-subdirs is known
268ifdef sysd-dirs-done
8eaaffde
UD
269ifeq ($(versioning),yes)
270-include $(common-objpfx)sysd-versions
4bae5567 271$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
3c022f42 272common-generated += $(version-maps) sysd-versions $(common-objpfx)Versions.all
4bae5567 273
7a68c94a
UD
274ifndef avoid-generated
275ifneq ($(sysd-versions-subdirs),$(all-subdirs) $(config-sysdirs))
276sysd-versions-force = FORCE
277FORCE:
278endif
99c9e773
UD
279$(common-objpfx)Versions.all: $(..)Versions.def \
280 $(wildcard $(add-ons:%=$(..)%/Versions.def))
281 cat $^ > $@T
282 mv -f $@T $@
99c9e773
UD
283$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
284 $(..)scripts/versions.awk \
8eaaffde 285 $(wildcard $(all-subdirs:%=$(..)%/Versions)) \
7a68c94a
UD
286 $(wildcard $(sysdirs:%=%/Versions)) \
287 $(sysd-versions-force)
288 { echo 'sysd-versions-subdirs = $(all-subdirs) $(config-sysdirs)' ; \
289 $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
290 -v move_if_change='$(move-if-change)' \
291 -f $(filter-out $< $(sysd-versions-force),$^); \
292 } > $@T
8eaaffde 293 mv -f $@T $@
7a68c94a
UD
294endif # avoid-generated
295endif # $(versioning) = yes
296endif # sysd-dirs-done
3bbceb12 297
28f540f4
RM
298ifndef compile-command.S
299compile-command.S = $(compile.S) $(OUTPUT_OPTION)
300endif
301ifndef compile-command.s
302compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
303endif
304ifndef compile-command.c
305compile-command.c = $(compile.c) $(OUTPUT_OPTION)
306endif
307
28f540f4 308# GCC can grok options after the file name, and it looks nicer that way.
28f540f4 309compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
f166d865
UD
310compile.S = \
311 $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
312COMPILE.S = \
313 $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
aeb72b16 314COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
28f540f4 315
28f540f4
RM
316# We need this for the output to go in the right place. It will default to
317# empty if make was configured to work with a cc that can't grok -c and -o
318# together. You can't compile the C library with such a compiler.
319OUTPUT_OPTION = -o $@
28f540f4
RM
320
321S-CPPFLAGS = $(asm-CPPFLAGS)
322define +make-deps
6e953631 323$(make-target-directory)
28f540f4 324-@rm -f $@
60c96635 325$(+mkdep) $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
795fbc9a
UD
326sed \
327-e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
51f75302 328$(sed-remove-objpfx) > $(@:.d=.T)
28f540f4
RM
329mv -f $(@:.d=.T) $@
330endef
331ifneq (,$(objpfx))
215dbbb1
RM
332# Continuation lines here are dangerous because they introduce spaces!
333define sed-remove-objpfx
6e953631
UD
334-e 's@ $(subst .,\.,$(subst @,\@,$(common-objpfx)))@ $$(common-objpfx)@g' \
335-e 's@^$(subst .,\.,$(subst @,\@,$(common-objpfx)))@$$(common-objpfx)@g'
215dbbb1 336endef
28f540f4
RM
337endif
338\f
5f0e6fc7
RM
339# Shared library building.
340
341ifeq (yes,$(build-shared))
342
ae1025be
UD
343# Reference map file only when versioning is selected and a map file name
344# is given.
345ifeq ($(versioning),yes)
a9ddb793
UD
346map-file = $(firstword $($(@F:.so=-map)) \
347 $(addprefix $(common-objpfx), \
348 $(filter $(@F:.so=.map),$(version-maps))))
b17277cf 349load-map-file = $(map-file:%=-Wl,--version-script=%)
ae1025be
UD
350endif
351
5f0e6fc7
RM
352# Pattern rule to build a shared object from an archive of PIC objects.
353# This must come after the installation rules so Make doesn't try to
354# build shared libraries in place from the installed *_pic.a files.
355# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
356# on other shared objects.
66715f83 357lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
40a55d20 358 $(build-shlib)
5f0e6fc7 359
5f0e6fc7 360define build-shlib
0155a773 361$(LINK.o) -shared -Wl,-O1 -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
b17277cf 362 -B$(csu-objpfx) $(load-map-file) \
5f0e6fc7
RM
363 -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
364 $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
365 -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
40a55d20 366 -Wl,--whole-archive \
a9ddb793 367 $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
714a562f 368 $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
5f0e6fc7
RM
369endef
370
5d003fb2
UD
371# This macro is similar to build-shlib but it does not define a soname
372# and it does not depend on the destination name to start with `lib'.
373define build-module
374$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
375 -B$(csu-objpfx) $(load-map-file) \
376 $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
377 -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
378 -Wl,--whole-archive \
379 $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
380 $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
381endef
382
9afc8a59
UD
383ifndef libc.so-version
384# Undefine this because it can't work when we libc.so is unversioned.
385static-only-routines =
386endif
387
b22fc5f5
UD
388elide-routines.oS += $(filter-out $(static-only-routines),\
389 $(routines) $(aux) $(sysdep_routines))
97a47867 390elide-routines.os += $(static-only-routines)
9afc8a59 391
9afc8a59
UD
392# If we have versioned code we don't need the old versions in any of the
393# static libraries.
b22fc5f5
UD
394elide-routines.o += $(shared-only-routines)
395elide-routines.op += $(shared-only-routines)
396elide-routines.og += $(shared-only-routines)
397elide-routines.ob += $(shared-only-routines)
9afc8a59 398
5f0e6fc7
RM
399# Don't try to use -lc when making libc.so itself.
400# Also omits crti.o and crtn.o, which we do not want
401# since we define our own `.init' section specially.
402LDFLAGS-c.so = -nostdlib -nostartfiles
9a0a462c 403# But we still want to link libc.so against $(gnulib).
2698e32c 404LDLIBS-c.so += $(gnulib)
5f0e6fc7
RM
405# Give libc.so an entry point and make it directly runnable itself.
406LDFLAGS-c.so += -e __libc_main
b93492aa
UD
407# Force the backward compatibility EH functions to be linked.
408LDFLAGS-c.so += -u __register_frame
da2d1bc5
UD
409# Pre-link the objects of libc_pic.a so that we can locally resolve
410# COMMON symbols before we link against ld.so. This is because ld.so
411# contains some of libc_pic.a already, which will prevent the COMMONs
412# from being allocated in libc.so, which introduces evil dependencies
413# between libc.so and ld.so, which can make it impossible to upgrade.
414$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
415 $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
416 -Wl,-d -Wl,--whole-archive $^
5f0e6fc7 417# Use our own special initializer and finalizer files for libc.so.
40a55d20 418$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
da2d1bc5 419 $(common-objpfx)libc_pic.os \
66715f83 420 $(elfobjdir)/sofini.os \
a9ddb793 421 $(elfobjdir)/interp.os $(elfobjdir)/ld.so
5f0e6fc7 422 $(build-shlib)
a9ddb793
UD
423ifeq ($(versioning),yes)
424$(common-objpfx)libc.so: $(common-objpfx)libc.map
425endif
1b5fd830 426common-generated += libc.so libc_pic.os
d705269e
UD
427ifdef libc.so-version
428$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
429 $(make-link)
da2d1bc5 430common-generated += libc.so$(libc.so-version)
d705269e 431endif
5f0e6fc7
RM
432endif
433\f
28f540f4
RM
434# Figure out the source filenames in this directory.
435
436override sources := $(addsuffix .c,$(filter-out $(elided-routines),\
437 $(routines) $(aux) \
438 $(sysdep_routines)))
439sysdep_routines := $(sysdep_routines)
440
e60062b7
RM
441headers := $(headers) $(sysdep_headers)
442
28f540f4
RM
443# This is the list of all object files, gotten by
444# replacing every ".c" in `sources' with a ".o".
445override objects := $(addprefix $(objpfx),$(sources:.c=.o))
693e7b96
RM
446
447
693e7b96
RM
448# The makefile may define $(extra-libs) with `libfoo libbar'
449# to build libfoo.a et al from the modules listed in $(libfoo-routines).
450ifdef extra-libs
451# extra-lib.mk is included once for each extra lib to define rules
452# to build it, and to add its objects to the various variables.
453# During its evaluation, $(lib) is set to the name of the library.
454extra-libs-left := $(extra-libs)
455include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
456endif
28f540f4 457\f
eb406346
UD
458+depfiles := $(sources:.c=.d) \
459 $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
3c5edd4d 460 $(addsuffix .d,$(tests) $(test-srcs))
0413b54c 461ifeq ($(build-programs),yes)
414fd335 462+depfiles += $(addsuffix .d,$(others) $(sysdep-others))
0413b54c 463endif
28f540f4
RM
464+depfiles := $(addprefix $(objpfx),\
465 $(filter-out $(addsuffix .d,$(omit-deps)),\
466 $(+depfiles)))
467
28f540f4 468ifdef +depfiles
28f540f4 469ifneq ($(no_deps),t)
555f3a39 470-include $(+depfiles)
deab9dea 471endif
28f540f4
RM
472endif
473\f\f
474# Maximize efficiency by minimizing the number of rules.
9756dfe1 475.SUFFIXES: # Clear the suffix list. We don't use suffix rules.
f649c201
UD
476# Don't define any builtin rules.
477MAKEFLAGS := $(MAKEFLAGS)r
28f540f4
RM
478
479# Generic rule for making directories.
480%/:
481# mkdir isn't smart enough to strip a trailing /.
482 mkdir $(@:%/=%)
483\f
484# Make sure that object files are not removed
485# when they are intermediates between sources and library members.
9afc8a59 486.PRECIOUS: $(addprefix $(objpfx)%,$(all-object-suffixes))
28f540f4
RM
487
488# Make sure that the parent library archive is never removed.
51f75302 489.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
28f540f4
RM
490\f
491# Use the verbose option of ar and tar when not running silently.
492ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
493verbose := v
494else # -s
495verbose :=
496endif # not -s
497
498ARFLAGS := r$(verbose)
f38931a9 499CREATE_ARFLAGS := cru$(verbose)
28f540f4
RM
500\f
501# This makes all the object files in the parent library archive.
502
97a47867 503.PHONY: lib lib-noranlib
ae9b308c 504lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
b22fc5f5 505lib-noranlib: libobjs
51f75302 506
564210fe
RM
507# For object-suffix $o, the list of objects with that suffix.
508# Makefiles can define `elide-routines.so = foo' to leave foo.so out.
509o-objects = $(patsubst %.o,%$o,$(filter-out $(patsubst %,$(objpfx)%.o,\
510 $(elide-routines$o)),\
511 $(objects)))
3bbceb12 512others: $(addprefix $(objpfx),$(install-lib))
28f540f4 513
072ebcef
RM
514ifndef objects
515
516# Create the stamp$o files to keep the parent makefile happy.
9afc8a59
UD
517subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
518$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
6e953631 519 $(make-target-directory)
072ebcef
RM
520 rm -f $@; > $@
521else
51f75302 522
97a47867 523# Define explicit rules to update each $(objpfx)stamp.SUFFIX
564210fe 524# timestamp file; these rules (one explicit rule is generated for each
97a47867
UD
525# object suffix) write a list of objects to update in the stamp file.
526# The parent will then actually add them all to the archive in the
527# archive rule, below.
564210fe 528define o-iterator-doit
97a47867
UD
529$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
530endef
531define do-stamp
a709dd43 532echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
b22fc5f5 533mv -f $@T $@
564210fe 534endef
9afc8a59 535object-suffixes-left := $(object-suffixes-for-libc)
564210fe 536include $(o-iterator)
28f540f4 537
51f75302 538endif
28f540f4 539
97a47867 540# Now define explicit rules to build the library archives; these depend
a709dd43 541# on the stamp files built above.
dbdb6189 542define o-iterator-doit
97a47867
UD
543$(common-objpfx)$(patsubst %,$(libtype$o),c): \
544 $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
545endef
546define do-makelib
b22fc5f5 547cd $(common-objdir) && \
a709dd43
UD
548$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
549$(RANLIB) $@
dbdb6189 550endef
97a47867
UD
551subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
552subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
b22fc5f5 553ifndef subdir
ae9b308c 554$(subdirs-stamps): subdir_lib;
97a47867 555endif
9afc8a59 556object-suffixes-left = $(object-suffixes-for-libc)
dbdb6189
RM
557include $(o-iterator)
558
28f540f4
RM
559
560# This makes all the object files.
97a47867
UD
561.PHONY: objects objs libobjs extra-objs
562objects objs: libobjs extra-objs
563libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
564extra-objs: $(addprefix $(objpfx),$(extra-objs))
f0bf9cb9
RM
565
566# Canned sequence for building an extra library archive.
567define build-extra-lib
af3878df 568$(patsubst %/,cd % &&,$(objpfx)) \
f38931a9 569$(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \
f0bf9cb9
RM
570 $(patsubst $(objpfx)%,%,$^)
571$(RANLIB) $@
572endef
28f540f4
RM
573\f
574# Installation.
575
73237de3
UD
576.PHONY: force-install
577force-install:
578
28f540f4
RM
579# $(install-lib) are installed from the object directory into $(libdir);
580# files in $(install-lib) matching `lib%.a' are ranlib'd after installation
581# unless they also appear in $(non-lib.a). $(install-data) are installed
582# as they are into $(datadir). $(headers) are installed as they are in
583# $(includedir). $(install-bin) and $(install-sbin) are installed from the
584# object directory into $(bindir) and $(sbindir), respectively.
585# $(install-others) are absolute path names of files to install; rules to
586# install them are defined elsewhere.
587
588# The simple library name to install libc.a under.
589# This could be defined by a sysdep Makefile.
590ifndef libc-name
591libc-name := c
592endif
593
594define do-install
595$(make-target-directory)
596$(INSTALL_DATA) $< $@
597endef
598
a182affd
RM
599# Make the target directory if it doesn't exist, using the `mkinstalldirs'
600# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
28f540f4 601define make-target-directory
5bc2f642 602$(addprefix $(..)./scripts/mkinstalldirs ,\
a182affd 603 $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
28f540f4
RM
604endef
605
a709dd43
UD
606# Any directory (parent or subdir) should install libc.a; this way
607# "make install" in a subdir is guaranteed to install everything it changes.
cab24c37 608installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
8d57beea
UD
609 $(inst_libdir)/$(patsubst %,$(libtype$o),\
610 $(libprefix)$(libc-name)))
51f75302 611install: $(installed-libcs)
73237de3 612$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
28f540f4 613 $(make-target-directory)
c316b486 614 $(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
9f2233e8
RM
615# Running ranlib after installing makes the __.SYMDEF time stamp up to
616# date, which avoids messages from some linkers.
28f540f4 617 $(RANLIB) $@
28f540f4 618
273d56ce
RM
619define do-install-program
620$(make-target-directory)
621$(INSTALL_PROGRAM) $< $@.new
622mv -f $@.new $@
623endef
624
5bf62f2d 625install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
0700dfa1 626install-lib := $(filter-out %.so %_pic.a,$(install-lib))
0e3426bb 627
a9ddb793 628ifeq (yes,$(build-shared))
0e3426bb 629# Find which .so's have versions.
05d4c982
RM
630versioned := $(strip $(foreach so,$(install-lib.so),\
631 $(patsubst %,$(so),$($(so)-version))))
0e3426bb 632
a9ddb793
UD
633install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
634install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
635
636install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \
637 $(install-lib.so-unversioned:%=$(inst_slibdir)/%)
638
0e3426bb 639# Install all the unversioned shared libraries.
a9ddb793
UD
640$(install-lib.so-unversioned:%=$(inst_slibdir)/%): $(inst_slibdir)/%.so: \
641 $(objpfx)%.so $(+force)
642 $(do-install-program)
0e3426bb 643
8a523922 644ifneq ($(findstring -s,$(LN_S)),)
f36f8dcf 645define make-link
f8b87ef0 646rm -f $@.new
5bc2f642 647$(SHELL) $(..)scripts/rellns-sh $< $@.new
8a523922
UD
648mv -f $@.new $@
649endef
650else
651# If we have no symbolic links don't bother with rellns-sh.
652define make-link
f8b87ef0
UD
653rm -f $@.new
654$(LN_S) $< $@.new
8a523922 655mv -f $@.new $@
f36f8dcf 656endef
8a523922 657endif
0e3426bb 658
9d141cae
UD
659ifeq (no,$(cross-compiling))
660ifeq (yes,$(build-shared))
9d141cae
UD
661symbolic-link-prog := $(common-objpfx)elf/sln
662symbolic-link-list := $(common-objpfx)elf/symlink.list
1ef32c3d 663define make-shlib-link
9d141cae 664echo $(<F) $@ >> $(symbolic-link-list)
1ef32c3d
UD
665endef
666endif
667endif
668ifndef make-shlib-link
669define make-shlib-link
9d141cae
UD
670rm -f $@
671$(LN_S) $(<F) $@
1ef32c3d
UD
672endef
673endif
674
0e3426bb
RM
675ifdef libc.so-version
676# For a library specified to be version N, install three files:
677# libc.so -> libc.so.N (e.g. libc.so.6)
678# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)
679
73237de3
UD
680$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
681 $(+force)
1ef32c3d 682 $(make-shlib-link)
73237de3 683$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
8d57beea
UD
684 $(do-install-program)
685install: $(inst_slibdir)/libc.so$(libc.so-version)
7c713e28 686
aa1075ea 687ifndef subdir
57ba7bb4
UD
688# What we install as libc.so for programs to link against is in fact a
689# link script. It contains references for the various libraries we need.
690# The libc.so object is not complete since some functions are only defined
71bedb76 691# in libc_nonshared.a.
e980ca92
UD
692# We need to use absolute paths since otherwise local copies (if they exist)
693# of the files are taken by the linker.
8d57beea
UD
694install: $(inst_libdir)/libc.so
695$(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
a44d2393 696 $(inst_libdir)/$(patsubst %,$(libtype.oS),\
73237de3
UD
697 $(libprefix)$(libc-name)) \
698 $(+force)
47707456
UD
699 (echo '/* GNU ld script';\
700 echo ' Use the shared library, but some functions are only in';\
a44d2393 701 echo ' the static library, so try that secondarily. */';\
af6f3906 702 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
a44d2393
UD
703 '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
704 ')' \
705 ) > $@.new
0f90ef96
RM
706 mv -f $@.new $@
707
aa1075ea 708endif
7c713e28 709
0e3426bb 710else
8d57beea 711install: $(inst_slibdir)/libc.so
73237de3 712$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)
8d57beea 713 $(do-install-program)
0e3426bb
RM
714endif
715
0e3426bb
RM
716ifneq (,$(versioned))
717# Produce three sets of rules as above for all the smaller versioned libraries.
718
719define o-iterator-doit
73237de3 720$(inst_libdir)/$o: $(inst_slibdir)/$o$($o-version) $(+force); $$(make-link)
0e3426bb
RM
721endef
722object-suffixes-left := $(versioned)
dc997231 723include $(o-iterator)
0e3426bb 724
20c81189
RM
725# Make symlinks in the build directory, because the versioned names might
726# be referenced by a DT_NEEDED in another library.
727define o-iterator-doit
728$(objpfx)$o$($o-version): $(objpfx)$o; $$(make-link)
729endef
730object-suffixes-left := $(versioned)
dc997231 731include $(o-iterator)
20c81189 732
da2d1bc5 733generated += $(foreach o,$(versioned),$o$($o-version))
20c81189 734
499e7464 735ifeq (,$($(subdir)-version))
0e3426bb 736define o-iterator-doit
73237de3
UD
737$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
738 $(+force);
1ef32c3d 739 $$(make-shlib-link)
0e3426bb
RM
740endef
741object-suffixes-left := $(versioned)
dc997231 742include $(o-iterator)
0e3426bb
RM
743
744define o-iterator-doit
73237de3
UD
745$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
746 $$(do-install-program)
0e3426bb
RM
747endef
748object-suffixes-left := $(versioned)
dc997231 749include $(o-iterator)
499e7464
UD
750else
751define o-iterator-doit
8d57beea 752$(inst_slibdir)/$o$($o-version): \
73237de3 753 $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);
1ef32c3d 754 $$(make-shlib-link)
499e7464
UD
755endef
756object-suffixes-left := $(versioned)
757include $(o-iterator)
758
759define o-iterator-doit
73237de3 760$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);
499e7464
UD
761 $$(do-install-program)
762endef
763object-suffixes-left := $(versioned)
764include $(o-iterator)
765endif
0e3426bb 766endif
102800e0
RM
767
768define do-install-so
769$(do-install-program)
770$(patsubst %,ln -s -f $(@F) $(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\
771 $(filter-out %.so,$@))
772endef
094bacdb 773
102800e0
RM
774so-versions := $(sort $(foreach so,$(install-lib.so),.so$($(so)-version)))
775$(foreach v,$(so-versions),\
73237de3
UD
776 $(inst_slibdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so \
777 $(+force)
102800e0
RM
778 $(do-install-so)
779$(foreach v,$(so-versions),\
73237de3 780 $(inst_slibdir)/$(libprefix)%$v): $(common-objpfx)%.so $(+force)
102800e0 781 $(do-install-so)
51f75302
RM
782endif
783
28f540f4 784ifdef install-bin
73237de3
UD
785$(addprefix $(inst_bindir)/,$(install-bin)): \
786 $(inst_bindir)/%: $(objpfx)% $(+force)
273d56ce 787 $(do-install-program)
28f540f4 788endif
1ef32c3d 789ifdef install-rootsbin
73237de3
UD
790$(addprefix $(inst_rootsbindir)/,$(install-rootsbin)): \
791 $(inst_rootsbindir)/%: $(objpfx)% $(+force)
1ef32c3d
UD
792 $(do-install-program)
793endif
28f540f4 794ifdef install-sbin
73237de3
UD
795$(addprefix $(inst_sbindir)/,$(install-sbin)): \
796 $(inst_sbindir)/%: $(objpfx)% $(+force)
273d56ce 797 $(do-install-program)
28f540f4
RM
798endif
799ifdef install-lib
800install-lib.a := $(filter lib%.a,$(install-lib))
801install-lib-non.a := $(filter-out lib%.a,$(install-lib))
802ifdef install-lib-non.a
9d187dd4 803$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
73237de3 804 $(inst_libdir)/$(libprefix)%: $(objpfx)% $(+force)
28f540f4
RM
805 $(do-install)
806endif
807ifdef install-lib.a
8d57beea 808$(install-lib.a:lib%.a=$(inst_libdir)/lib$(libprefix)%.a): \
73237de3 809 $(inst_libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a $(+force)
28f540f4
RM
810 $(do-install)
811 $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
812endif
813endif
814ifdef install-data
73237de3 815$(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
8d57beea 816 $(do-install)
28f540f4
RM
817endif
818headers := $(strip $(headers))
819ifdef headers
73237de3 820$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)
8d57beea 821 $(do-install)
28f540f4
RM
822endif # headers
823
1ef32c3d
UD
824.PHONY: install-bin-nosubdir install-rootsbin-nosubdir install-sbin-nosubdir \
825 install-lib-nosubdir install-data-nosubdir install-headers-nosubdir
8d57beea
UD
826install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
827install-rootsbin-nosubdir: \
828 $(addprefix $(inst_rootsbindir)/,$(install-rootsbin))
829install-sbin-nosubdir: $(addprefix $(inst_sbindir)/,$(install-sbin))
830install-lib-nosubdir: $(addprefix $(inst_libdir)/,\
28f540f4
RM
831 $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
832 $(addprefix $(libprefix),$(install-lib-non.a)))
8d57beea
UD
833install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
834install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
28f540f4
RM
835install-others-nosubdir: $(install-others)
836
837# We need all the `-nosubdir' targets so that `install' in the parent
838# doesn't depend on several things which each iterate over the subdirs.
839# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
840# subroutine. Then in the parent `install-FOO' also causes subdir makes.
841install-%:: install-%-nosubdir ;
842
843.PHONY: install install-no-libc.a-nosubdir
da2d1bc5 844ifeq ($(build-programs),yes)
28f540f4
RM
845install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
846 install-bin-nosubdir install-lib-nosubdir \
1ef32c3d
UD
847 install-others-nosubdir install-rootsbin-nosubdir \
848 install-sbin-nosubdir
da2d1bc5
UD
849else
850install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
851 install-lib-nosubdir install-others-nosubdir
852endif
28f540f4
RM
853install: install-no-libc.a-nosubdir
854\f
855# Command to compile $< in $(objdir) using the native libraries.
856define native-compile
377a515b 857$(make-target-directory)
af3878df 858$(patsubst %/,cd % &&,$(objpfx)) \
377a515b
UD
859$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
860 $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
28f540f4
RM
861endef
862
863# Command to compile $< in $(common-objdir) using the native libraries.
0d204b0a 864# We must cd to $(objdir) anyway so that $(..)config.h is valid.
28f540f4 865define common-objdir-compile
af3878df 866$(patsubst %/,cd % &&,$(objpfx)) \
377a515b
UD
867$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
868 $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
28f540f4
RM
869endef
870
871# We always want to use configuration definitions.
377a515b
UD
872# Note that this is only used for commands running in $(objpfx).
873ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
28f540f4
RM
874
875# Support the GNU standard name for this target.
876.PHONY: check
877check: tests
878\f
879.PHONY: TAGS
5649a1d6 880TAGS: $(objpfx)distinfo $(..)MakeTAGS
dbdb6189 881 $(MAKE) $(addprefix -f ,$^) $@
28f540f4 882
5649a1d6 883$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE
ce563359
RM
884 $(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@
885FORCE:
a182affd
RM
886
887
28f540f4
RM
888.PHONY: echo-headers
889echo-headers:
890 @echo $(headers)
891
892\f
893# Common cleaning targets.
894
3c5edd4d 895.PHONY: common-mostlyclean common-clean mostlyclean clean do-tests-clean
28f540f4
RM
896clean: common-clean
897mostlyclean: common-mostlyclean
898
3c5edd4d 899do-tests-clean:
68ef28ed 900 -rm -f $(patsubst %,$(objpfx)%.out,$(tests) $(test-srcs))
3c5edd4d 901
28f540f4
RM
902# Remove the object files.
903common-mostlyclean:
e61abf83 904 -rm -f $(addprefix $(objpfx),$(tests) $(test-srcs) $(others) \
3c5edd4d 905 $(sysdep-others) stubs \
e61abf83 906 $(addsuffix .o,$(tests) $(test-srcs) \
414fd335
UD
907 $(others) \
908 $(sysdep-others)) \
1686c452 909 $(addsuffix .out,$(tests) $(test-srcs)))
da2d1bc5
UD
910 -rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib) \
911 $(install-lib.so) \
912 $(install-lib.so:%.so=%_pic.a))
97a47867 913 -rm -f core
51f75302
RM
914 $(rmobjs)
915define rmobjs
9afc8a59 916$(foreach o,$(object-suffixes-for-libc),
51702635 917-rm -f $(objpfx)stamp$o $(o-objects))
51f75302 918endef
28f540f4
RM
919
920# Also remove the dependencies and generated source files.
921common-clean: common-mostlyclean
deab9dea 922 -rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
5290baf0 923 -rm -fr $(addprefix $(objpfx),$(generated-dirs))
924840c5 924 -rm -f $(addprefix $(common-objpfx),$(common-generated))
5649a1d6 925 -rm -f $(objpfx)distinfo
28f540f4 926\f
97a47867 927# Produce a file `stubs' which contains `#define __stub_FUNCTION'
28f540f4 928# for each function which is a stub. We grovel over all the .d files
f2ea0f5b
UD
929# looking for references to <stub-tag.h>. Then we grovel over each
930# referenced source file to see what stub function it defines.
28f540f4 931
b22fc5f5 932ifdef objpfx
28f540f4 933.PHONY: stubs # The parent Makefile calls this target.
97a47867 934stubs: $(objpfx)stubs
b22fc5f5 935endif
f2ea0f5b 936s = $(sysdep_dir)/generic
97a47867 937$(objpfx)stubs: $(+depfiles)
28f540f4 938# Use /dev/null since `...` might expand to empty.
af3878df
UD
939 (s=`cd $s && /bin/pwd`; \
940 $(patsubst %/,cd % &&,$(objpfx)) \
c4cc693d 941 sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
f43ce637 942 `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \
f2ea0f5b 943 -e '/stub-tag\.h/{; g; p; }' \
c4cc693d
RM
944 $(patsubst $(objpfx)%,%,$^) /dev/null` \
945 /dev/null) > $@T
28f540f4
RM
946 mv -f $@T $@
947\f
948# Make the distribution tar file.
949
950.PHONY: dist
5649a1d6 951dist: $(objpfx)distinfo $(..)Make-dist
28f540f4
RM
952 $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
953
10ceac89
RM
954# Avoid depending on source files found in sysdeps dirs,
955# because the references affect implicit rule selection.
956dist: $(filter-out %.c %.S %.s,$(distribute))
28f540f4
RM
957
958# We used to simply export all these variables, but that frequently made the
959# environment get too large. Instead, we write all the information into
960# a generated makefile fragment `distinfo', and then include it with -f in
961# the sub-make that makes the distribution (above).
5649a1d6
UD
962$(objpfx)distinfo: Makefile $(..)Makerules \
963 $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile))
714a562f 964 $(make-target-directory)
28f540f4
RM
965 $(distinfo-vars)
966 mv -f $@.new $@
5649a1d6
UD
967.PHONY: subdir_distinfo
968subdir_distinfo: $(objpfx)distinfo
28f540f4
RM
969
970define distinfo-vars
971rm -f $@.new
a4242e25
RM
972echo > $@.new 'subdir := $(subdir)'
973$(foreach var,subdir-dirs sources elided-routines sysdep_routines \
dfe1754a 974 headers sysdep_headers distribute dont_distribute generated \
478b92f0 975 others tests test-srcs extra-libs $(extra-libs:%=%-routines) \
3c5edd4d 976 versioned \
6a441471 977 $(addprefix install-,lib lib.so data bin sbin others),
4d6acc61
RM
978echo >> $@.new '$(subdir)-$(var) := $($(var))'
979echo >> $@.new '$(var) = $$($(subdir)-$(var))')
28f540f4
RM
980endef
981\f
982ifneq (,$(strip $(gpl2lgpl)))
983ifneq (,$(wildcard $(..)gpl2lgpl.sed))
984# Snarf from the master source and frob the copying notice.
985$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
986 sed -f $^ > $@-tmp
987# So I don't edit them by mistake.
988 chmod a-w $@-tmp
989 mv -f $@-tmp $@
4d06461a 990ifeq ($(with-cvs),yes)
379bb425 991 test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $^' $@
28f540f4
RM
992endif
993endif
4d06461a 994endif
This page took 0.209012 seconds and 5 git commands to generate.