1 # Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
20 # Common rules for making the GNU C library. This file is included
21 # by the top-level Makefile and by all subdirectory makefiles
25 This makefile requires GNU Make.
33 # If `sources' was defined by the parent makefile, undefine it so
34 # we will later get it from wildcard search in this directory.
35 ifneq "$(findstring env,$(origin sources))" ""
39 headers := $(headers) $(sysdep_headers)
42 PATH := this definition should take precedence over $(oPATH)
43 ifeq ($(PATH),$(oPATH))
44 You must not use the -e flag when building the GNU C library.
49 ifndef +included-Makeconfig
50 include $(..)Makeconfig
53 # `configure' writes a definition of `config-sysdirs' in `config.make'.
54 sysdirs = $(config-sysdirs)
56 +sysdir_pfx = $(common-objpfx)
58 export sysdirs := $(sysdirs)
60 +sysdep_dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
62 +sysdep_dirs := $(objdir) $(+sysdep_dirs)
65 # Add -I switches to get the right sysdep directories.
66 # `+includes' in Makeconfig references $(+sysdep-includes).
67 +sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
69 # Enable object files for different versions of the library.
70 # Various things use $(object-suffixes) to know what all to make.
71 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
72 # to pass different flags for each flavor.
73 libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
76 override CFLAGS += $(CFLAGS-$(suffix $@))
77 override CPPFLAGS += $(CPPFLAGS-$(suffix $@))
78 ifeq (yes,$(build-shared))
79 # Under --enable-shared, we will build a shared library of PIC objects.
80 # The PIC object files are named foo.so.
81 object-suffixes += .so
84 libtype.so := lib%_pic.a
86 ifeq (yes,$(build-profile))
87 # Under --enable-profile, we will build a static library of profiled objects.
88 # The profiled object files are named foo.po.
89 object-suffixes += .po
93 ifeq (yes,$(build-omitfp))
94 # Under --enable-omitfp, we build an the library optimized without
95 # debugging information using -fomit-frame-pointer, and build an extra
96 # library with debugging information. The debuggable objects are named foo.go.
97 object-suffixes += .go
99 CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
100 CFLAGS-.so += $(CFLAGS.o)
101 libtype.go = lib%_g.a
104 # Include any system-specific makefiles.
106 # This is here so things in sysdep Makefiles can easily depend on foo.h as
107 # appropriate and not worry about where foo.h comes from, which may be
108 # system dependent and not known by that Makefile.
109 vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) \
110 $(addprefix $(sysdep_dir)/,$(sysdirs)) \
113 ifeq ($(wildcard $(+sysdir_pfx)sysd-Makefile),)
114 # Don't do deps until this exists, because it might change the sources list.
118 # Some sysdep makefiles use this to distinguish being included here from
119 # being included individually by a subdir makefile (hurd/Makefile needs this).
122 ifndef avoid-generated
123 include $(+sysdir_pfx)sysd-Makefile
124 $(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules
126 (for dir in $(sysdirs); do \
127 file=sysdeps/$$dir/Makefile; \
128 if [ -f $(..)$$file ]; then \
129 echo include "\$$(..)$$file"; \
132 echo 'sysd-Makefile-done=t') > $@T
136 # Reorder before-compile so that mach things come first, and hurd things
137 # second, before all else. The mach and hurd subdirectories have many
138 # generated header files which the much of rest of the library depends on,
139 # so it is best to build them first (and mach before hurd, at that).
140 before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
142 $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
145 # Remove existing files from `before-compile'. Things are added there when
146 # they must exist for dependency generation to work right, but once they
147 # exist there is no further need for every single file to depend on them,
148 # and those gratuitous dependencies result in many gratuitous
150 before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
152 # Don't let any before-compile file be an intermediate and get removed.
157 # Generate an ordered list of implicit rules which find the source files in
158 # each sysdep directory. The old method was to use vpath to search all the
159 # sysdep directories. However, that had the problem that a .S file in a
160 # later directory would be chosen over a .c file in an earlier directory,
161 # which does not preserve the desired sysdeps ordering behavior.
163 # When making the list of .d files to include, we can't know which ones
164 # have source in .s files, and thus do not in fact need a .d file.
165 # So we must define rules to make .d files for .s files.
166 define make-dummy-dep
167 $(addprefix ln $(objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
170 echo '# .s files cannot contain includes, so they need no deps.' > $@
172 # It matters that this set of rules, for compiling from sources in
173 # the current directory (the $srcdir/$subdir) come before the
174 # generated sysdep rules in included from sysd-rules below. When
175 # compiling in the source tree, generated sources go into the current
176 # directory, and those should be chosen before any sources in sysdeps.
177 $(objpfx)%.o: %.S $(before-compile); $(compile-command.S)
178 $(objpfx)%.so: %.S $(before-compile); $(compile-command.S)
179 $(objpfx)%.po: %.S $(before-compile); $(compile-command.S)
180 $(objpfx)%.go: %.S $(before-compile); $(compile-command.S)
181 $(objpfx)%.d: %.S $(before-compile); $(+make-deps)
182 $(objpfx)%.o: %.s $(before-compile); $(compile-command.s)
183 $(objpfx)%.so: %.s $(before-compile); $(compile-command.s)
184 $(objpfx)%.po: %.s $(before-compile); $(compile-command.s)
185 $(objpfx)%.go: %.s $(before-compile); $(compile-command.s)
186 $(objpfx)%.d: %.s $(objpfx)dummy.d; $(make-dummy-dep)
187 $(objpfx)%.o: %.c $(before-compile); $(compile-command.c)
188 $(objpfx)%.so: %.c $(before-compile); $(compile-command.c)
189 $(objpfx)%.po: %.c $(before-compile); $(compile-command.c)
190 $(objpfx)%.go: %.c $(before-compile); $(compile-command.c)
191 $(objpfx)%.d: %.c $(before-compile); $(+make-deps)
193 # Omit the objpfx rules when building in the source tree, because
194 # objpfx is empty and so these rules just override the ones above.
196 # Define first rules to find the source files in $(objpfx).
197 # Generated source files will end up there.
198 $(objpfx)%.o: $(objpfx)%.S $(before-compile); $(compile-command.S)
199 $(objpfx)%.so: $(objpfx)%.S $(before-compile); $(compile-command.S)
200 $(objpfx)%.po: $(objpfx)%.S $(before-compile); $(compile-command.S)
201 $(objpfx)%.go: $(objpfx)%.S $(before-compile); $(compile-command.S)
202 $(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
203 $(objpfx)%.o: $(objpfx)%.s $(before-compile); $(compile-command.s)
204 $(objpfx)%.so: $(objpfx)%.s $(before-compile); $(compile-command.s)
205 $(objpfx)%.po: $(objpfx)%.s $(before-compile); $(compile-command.s)
206 $(objpfx)%.go: $(objpfx)%.s $(before-compile); $(compile-command.s)
207 $(objpfx)%.d: $(objpfx)%.s $(objpfx)dummy.d; $(make-dummy-dep)
208 $(objpfx)%.o: $(objpfx)%.c $(before-compile); $(compile-command.c)
209 $(objpfx)%.so: $(objpfx)%.c $(before-compile); $(compile-command.c)
210 $(objpfx)%.po: $(objpfx)%.c $(before-compile); $(compile-command.c)
211 $(objpfx)%.go: $(objpfx)%.c $(before-compile); $(compile-command.c)
212 $(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
215 # System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
216 # patterns matching sysdep directories whose assembly source files should
218 ifdef inhibit-sysdep-asm
219 define open-check-inhibit-asm
220 case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
222 close-check-inhibit-asm = ;; esac ;
225 # Don't include sysd-rules until sysd-Makefile is already there and has been
226 # included. It might define inhibit-sysdep-asm, which would affect the
227 # contents of sysd-rules.
228 ifdef sysd-Makefile-done
229 include $(+sysdir_pfx)sysd-rules
231 $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
232 $(wildcard $(foreach dir,$(sysdirs),\
233 $(sysdep_dir)/$(dir)/Makefile))
235 (for sysdir in $(sysdirs); do \
236 dir="\$$(sysdep_dir)/$$sysdir"; \
237 for o in $(object-suffixes); do \
238 $(open-check-inhibit-asm) \
239 echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
240 \$$(compile-command.S)"; \
241 echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
242 \$$(compile-command.s)"; \
243 $(close-check-inhibit-asm) \
244 echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
245 \$$(compile-command.c)"; \
247 $(open-check-inhibit-asm) \
248 echo "\$$(objpfx)%.d: $$dir/%.s \$$(objpfx)dummy.d; \
249 \$$(make-dummy-dep)"; \
250 echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
252 $(close-check-inhibit-asm) \
253 echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
258 ifndef compile-command.S
259 compile-command.S = $(compile.S) $(OUTPUT_OPTION)
261 ifndef compile-command.s
262 compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
264 ifndef compile-command.c
265 compile-command.c = $(compile.c) $(OUTPUT_OPTION)
268 # GCC can grok options after the file name, and it looks nicer that way.
269 compile.S = $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS)
270 compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
272 # We need this for the output to go in the right place. It will default to
273 # empty if make was configured to work with a cc that can't grok -c and -o
274 # together. You can't compile the C library with such a compiler.
275 OUTPUT_OPTION = -o $@
277 S-CPPFLAGS = $(asm-CPPFLAGS)
280 $(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
281 sed -e 's,$*\.o,$(foreach o,$(object-suffixes),$(@:.d=$o)) $@,' \
282 $(sed-remove-objpfx) > $(@:.d=.T)
286 sed-remove-objpfx = -e 's@ $(subst @,\@,$(objpfx))@ $$(objpfx)@g' \
287 -e 's@^$(subst @,\@,$(objpfx))@$$(objpfx)@g'
290 # Figure out the source filenames in this directory.
292 override sources := $(addsuffix .c,$(filter-out $(elided-routines),\
295 sysdep_routines := $(sysdep_routines)
297 # This is the list of all object files, gotten by
298 # replacing every ".c" in `sources' with a ".o".
299 override objects := $(addprefix $(objpfx),$(sources:.c=.o))
301 +depfiles := $(strip $(sources:.c=.d) \
302 $(patsubst %.o,%.d,$(filter %.o,$(extra-objs))) \
303 $(addsuffix .d,$(others) $(tests)))
304 +depfiles := $(addprefix $(objpfx),\
305 $(filter-out $(addsuffix .d,$(omit-deps)),\
308 $(objpfx)depend-$(subdir): Makefile
310 for file in $(+depfiles:$(objpfx)%=%); do \
311 echo "include \$$(objpfx)$$file"; \
319 # Include the generated dependencies of the sources in this directory.
320 include $(objpfx)depend-$(subdir)
323 # Maximize efficiency by minimizing the number of rules.
324 .SUFFIXES: # Clear the suffix list.
325 # Add the suffixes we use.
326 .SUFFIXES: .a $(object-suffixes) .S .s .c .h .d
328 # Generic rule for making directories.
330 # mkdir isn't smart enough to strip a trailing /.
333 # Make sure that object files are not removed
334 # when they are intermediates between sources and library members.
335 .PRECIOUS: $(addprefix $(objpfx)%,$(object-suffixes))
337 # Make sure that the parent library archive is never removed.
338 .PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
340 # Use the verbose option of ar and tar when not running silently.
341 ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
347 ARFLAGS := r$(verbose)
349 # This makes all the object files in the parent library archive.
351 .PHONY: lib libobjs lib-noranlib
352 lib: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
354 # Pattern rule for libraries: depend on the __.SYMDEF member updated by ranlib.
355 lib%.a: lib%.a(__.SYMDEF) ;
357 ifeq (yes,$(build-shared))
358 # Pattern rule to build a shared object from an archive of PIC objects.
359 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
360 # on other shared objects.
362 $(LINK.o) -shared -o $@ -Wl,--whole-archive $< $(LDLIBS-$*.so)
365 libobjs: $(foreach o,$(object-suffixes),\
366 $(common-objpfx)$(patsubst %,$(libtype$o),c)(\
367 $(notdir $(objects:.o=$o))))
368 lib-noranlib: libobjs
372 # Define a pattern rule that will match many targets libc.a(foo.%), for
373 # each foo.o in $(objects) (% will just happen always to match `o'). This is
374 # the only way to define a rule that updates many targets at once with one
375 # sequence of commands. We in fact define the pattern rule to match
376 # targets libc.a(foo.%), libc_pic.a(foo.%), etc, to avoid repeating the rule.
377 # Each match will only ever be called upon to make member objects of
378 # the appropriate type in each library (i.e. libc_pic.a(foo.so)).
379 $(foreach l,$(libtypes),\
380 $(common-objpfx)$(patsubst %,$l,c)($(notdir $(objects:.o=.%)))): \
381 $(objpfx)stamp.%-$(subdir) ;
383 # The pattern rule tells Make to remake $(objpfx)stamp.%-$(subdir) as
384 # the way to update all the foo.% object files in $(objects).
385 # Now we define a static pattern rule to update each
386 # $(objpfx)stamp.SUFFIX-$(subdir) timestamp file;
387 # these rules (one explicit rule is generated for each object suffix)
388 # will update the parent archive with
389 $(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir)): \
390 $(objpfx)stamp%-$(subdir): $(objects:.o=%)
391 $(patsubst %,cd %;,$(objdir)) \
392 $(AR) cru$(verbose) ${O%-lib} \
393 $(patsubst $(objpfx)%,%,$^)
395 O%-lib = $(filter ../,$(firstword $(objdir) ../))$(patsubst %,$(libtype$*),c)
399 # Rules to update the __.SYMDEF member with ranlib.
400 # To consolidate, each flavor library's __.SYMDEF member
401 # depends on the imaginary intermediate file `symdef.SUFFIX',
402 # where SUFFIX is that flavor's object suffix; then a pattern rule
403 # "remakes" symdef.% depending on all the libc.a(foo.%) files in $(objects).
404 $(common-objpfx)$(patsubst %,$(libtype.o),c)(__.SYMDEF): symdef.o
405 $(common-objpfx)$(patsubst %,$(libtype.so),c)(__.SYMDEF): symdef.so
406 $(common-objpfx)$(patsubst %,$(libtype.po),c)(__.SYMDEF): symdef.po
407 $(common-objpfx)$(patsubst %,$(libtype.go),c)(__.SYMDEF): symdef.go
408 symdef.%: $(foreach o,$(object-suffixes),\
409 $(common-objpfx)$(patsubst %,$(libtype$o),c)(\
410 $(patsubst $(objpfx)%.o,%.%,$(objects)))) \
411 $(filter subdir_lib,$(firstword $(subdir) subdir_lib))
412 # The last line above makes it also depend on subdir_lib for the parent.
413 $(RANLIB) $(common-objpfx)$(patsubst %,$(libtype.$*),c)
415 # This makes all the object files.
417 objects objs: $(foreach o,$(object-suffixes),$(objects:.o=$o)) \
418 $(addprefix $(objpfx),$(extra-objs))
422 # $(install-lib) are installed from the object directory into $(libdir);
423 # files in $(install-lib) matching `lib%.a' are ranlib'd after installation
424 # unless they also appear in $(non-lib.a). $(install-data) are installed
425 # as they are into $(datadir). $(headers) are installed as they are in
426 # $(includedir). $(install-bin) and $(install-sbin) are installed from the
427 # object directory into $(bindir) and $(sbindir), respectively.
428 # $(install-others) are absolute path names of files to install; rules to
429 # install them are defined elsewhere.
431 # The simple library name to install libc.a under.
432 # This could be defined by a sysdep Makefile.
438 $(make-target-directory)
439 $(INSTALL_DATA) $< $@
442 # Make the target directory if it doesn't exist. Because of make's
443 # directory cache, this will produce the `mkdir' command when the directory
444 # already exists, if it didn't exist at the start of the `make' run. The
445 # `-' prefix ignores errors from mkdir, so there will just be some
446 # gratuitous but harmless `File exists' messages.
447 define make-target-directory
448 $(addprefix -mkdir ,$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
451 # Any directory (parent or subdir) that has any object files to build
452 # should install libc.a; this way "make install" in a subdir is guaranteed
453 # to install everything it changes.
455 installed-libcs := $(foreach o,$(object-suffixes),\
456 $(libdir)/$(patsubst %,$(libtype$o),\
457 $(libprefix)$(libc-name)))
458 install: $(installed-libcs)
459 # We avoid depending on lib-noranlib because that makes the parent make
460 # subdir_lib in all the subdirs, when the make install run they do will
461 # update the library anyway. Running ranlib after installing makes the
462 # __.SYMDEF time stamp up to date, which avoids messages from some linkers.
463 # Depending on subdir_install gets all the subdirs to update the library,
464 # and is optimal for `make install' at top level.
465 $(install-libcs): $(libdir)/lib$(libprefix)%: libobjs subdir_install
466 $(make-target-directory)
467 $(INSTALL_DATA) $(common-objpfx)lib$* $@
471 install-lib.so := libc.so $(filter lib%.so,$(install-lib))
472 install-lib := $(filter-out lib%.so,$(install-lib))
473 ifeq (yes,$(build-shared))
474 install: $(foreach so,$(install-lib.so), \
475 $(libdir)/$(so:lib%=lib$(libprefix)%).$($(so)-version))
476 $(libdir)/lib$(libprefix)%.so: $(common-objpfx)lib%.so; $(do-install)
480 $(addprefix $(bindir)/,$(install-bin)): $(bindir)/%: $(objpfx)%
481 $(make-target-directory)
482 $(INSTALL_PROGRAM) $< $@
485 $(addprefix $(sbindir)/,$(install-sbin)): $(sbindir)/%: $(objpfx)%
486 $(make-target-directory)
487 $(INSTALL_PROGRAM) $< $@
490 install-lib.a := $(filter lib%.a,$(install-lib))
491 install-lib-non.a := $(filter-out lib%.a,$(install-lib))
492 ifdef install-lib-non.a
493 $(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
494 $(libdir)/$(libprefix)%: $(objpfx)%
498 $(install-lib.a:lib%.a=$(libdir)/lib$(libprefix)%.a): \
499 $(libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a
501 $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
505 $(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install)
507 headers := $(strip $(headers))
509 $(addprefix $(includedir)/,$(headers)): \
510 $(includedir)/%: %;$(do-install)
513 .PHONY: install-bin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
514 install-data-nosubdir install-headers-nosubdir
515 install-bin-nosubdir: $(addprefix $(bindir)/,$(install-bin))
516 install-sbin-nosubdir: $(addprefix $(sbindir)/,$(install-sbin))
517 install-lib-nosubdir: $(addprefix $(libdir)/,\
518 $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
519 $(addprefix $(libprefix),$(install-lib-non.a)))
520 install-data-nosubdir: $(addprefix $(datadir)/,$(install-data))
521 install-headers-nosubdir: $(addprefix $(includedir)/,$(headers))
522 install-others-nosubdir: $(install-others)
524 # We need all the `-nosubdir' targets so that `install' in the parent
525 # doesn't depend on several things which each iterate over the subdirs.
526 # This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
527 # subroutine. Then in the parent `install-FOO' also causes subdir makes.
528 install-%:: install-%-nosubdir ;
530 .PHONY: install install-no-libc.a-nosubdir
531 install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
532 install-bin-nosubdir install-lib-nosubdir \
533 install-others-nosubdir install-sbin-nosubdir
534 install: install-no-libc.a-nosubdir
536 # Command to compile $< in $(objdir) using the native libraries.
537 define native-compile
538 cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
539 $(addprefix $$cwd/,$^) -o $(@F)
542 # Command to compile $< in $(common-objdir) using the native libraries.
543 define common-objdir-compile
544 cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=%) -o $(@F)
547 # We always want to use configuration definitions.
548 BUILD_CFLAGS = -include $(common-objpfx)config.h
550 # Support the GNU standard name for this target.
555 TAGS: distinfo $(..)MakeTAGS
556 $(MAKE) $(addprefix -f ,$^)
563 # Common cleaning targets.
565 .PHONY: common-mostlyclean common-clean mostlyclean clean
567 mostlyclean: common-mostlyclean
569 # Remove the object files.
571 -rm -f $(addprefix $(objpfx),$(tests) $(others) \
572 $(addsuffix .o,$(tests) $(others)) \
573 $(addsuffix .out,$(tests)))
574 -rm -f $(addprefix $(objpfx),$(extra-objs))
578 $(foreach o,$(object-suffixes),
579 -rm -f $(addprefix $(objpfx),stamp$o-$(subdir)) $(objects:.o=$o))
582 # Also remove the dependencies and generated source files.
583 common-clean: common-mostlyclean
584 -rm -f $(objpfx)depend-$(subdir) $(+depfiles)
585 -rm -f $(addprefix $(objpfx),$(generated))
587 # Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
588 # for each function which is a stub. We grovel over all the .d files
589 # looking for references to source files in sysdeps/stub. Then we grovel
590 # over each referenced source file to see what stub function it defines.
592 .PHONY: stubs # The parent Makefile calls this target.
593 stubs: $(common-objpfx)stub-$(subdir)
594 s = $(sysdep_dir)/stub
595 $(common-objpfx)stub-$(subdir): $(+depfiles)
596 # Use /dev/null since `...` might expand to empty.
597 s=`cd $s; /bin/pwd`; \
598 $(patsubst %,cd %;,$(objdir)) \
599 sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
600 `sed -n 's@^.*$s/\([a-z0-9_-]*\.c\).*$$@'"$$s"/'\1@p' \
601 $(patsubst $(objpfx)%,%,$^) /dev/null` \
605 # Make the distribution tar file.
608 dist: distinfo $(..)Make-dist
609 $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
613 # We used to simply export all these variables, but that frequently made the
614 # environment get too large. Instead, we write all the information into
615 # a generated makefile fragment `distinfo', and then include it with -f in
616 # the sub-make that makes the distribution (above).
617 distinfo: Makefile $(..)Makerules
623 $(foreach var,subdir sources elided-routines headers distribute \
624 dont_distribute generated others tests,
625 echo >> $@.new '$(var) := $($(var))')
626 echo >> $@.new 'sources := $$(sources) $$(addsuffix .c,$$(elided-routines))'
629 ifneq (,$(strip $(gpl2lgpl)))
630 ifneq (,$(wildcard $(..)gpl2lgpl.sed))
631 # Snarf from the master source and frob the copying notice.
632 $(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
634 # So I don't edit them by mistake.
637 test -d CVS && cvs commit -m'Updated from $^' $@