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