]> sourceware.org Git - glibc.git/blobdiff - Makerules
Add GLIBC_2.3.4.
[glibc.git] / Makerules
index ef608c29eaac9d0b4ca9ad997a5ebeae1b526b1a..7e955b657d9d47bcab7e80347e3a8e4bd5126239 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -125,29 +125,9 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
 endif # avoid-generated
 endif # $(versioning) = yes
 
-
-# Generating headers for assembly constants.
-# We need this defined early to get into before-compile before
-# it's used in sysd-rules, below.
-$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
-                                          %.sym $(before-compile)
-       $(AWK) -f $< $(filter %.sym,$^) \
-       | $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \
-               -MD -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' \
-       | sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T
-       sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
-           $(@:.h=.h.d)T > $(@:.h=.h.d)T2
-       rm -f $(@:.h=.h.d)T
-       mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d)
-       mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
-vpath %.sym $(sysdirs)
-before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
-
-
-# When we have no deps pass doing it, then make sure the subdirectory
-# for object files gets created.
-ifdef no_deps
+# Make sure the subdirectory for object files gets created.
 ifdef objpfx
+ifeq (,$(wildcard $(objpfx).))
 before-compile += $(objpfx).
 $(objpfx).:
        $(make-target-directory)
@@ -166,26 +146,61 @@ ifdef before-compile
 $(before-compile):
 endif
 
+# We don't want $(common-objpfx) files to depend on miscellaneous stuff
+# in subdirs.
+ifdef subdir
+common-before-compile := $(filter-out $(objpfx)%,$(before-compile))
+else
+common-before-compile = $(before-compile)
+endif
+
+ifndef subdir
 # If a makefile needs to do something conditional on something that
 # can only be figured out from headers, write a FOO.make.c input
 # file that uses cpp contructs and contains @@@ LINE @@@ for each LINE
 # to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.
-$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(before-compile)
+#
+# We only generate these in the top-level makefile, to avoid any weirdness
+# from subdir-specific makefile tweaks creeping in on an update.
+$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile)
        rm -f $@T $@.dT
        (echo '# Generated from $*.make.c by Makerules.'; \
-        SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \
         $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \
+              -MD -MP -MT '$$(common-objpfx)$*.make' -MF $@.dT \
         | sed -n '/@@@/{s/@@@[  ]*\(.*\)@@@/\1/;s/[     ]*$$//p;}'; \
         echo 'common-generated += $(@F)'; \
         sed $(sed-remove-objpfx) $(sed-remove-dotdot) $@.dT; \
         rm -f $@.dT) > $@T
        mv -f $@T $@
+endif
 
 ifdef subdir
-sed-remove-dotdot := -e 's@  *\.\.\/\([^       \]*\)@ $$(..)\1@g'
+sed-remove-dotdot := -e 's@  *\.\.\/\([^       \]*\)@ $$(..)\1@g' \
+                    -e 's@^\.\.\/\([^  \]*\)@$$(..)\1@g'
 else
-sed-remove-dotdot := -e 's@  *\([^     \/$$][^         \]*\)@ $$(..)\1@g'
+sed-remove-dotdot := -e 's@  *\([^     \/$$][^         \]*\)@ $$(..)\1@g' \
+                    -e 's@^\([^        \/$$][^         \]*\)@$$(..)\1@g'
 endif
+
+
+# Generating headers for assembly constants.
+# We need this defined early to get into before-compile before
+# it's used in sysd-rules, below.
+$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
+                                          %.sym $(common-before-compile)
+       $(AWK) -f $< $(filter %.sym,$^) \
+       | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) -x c - \
+               -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)'
+       sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \
+               $(@:.h.d=.h)T3 > $(@:.h.d=.h)T
+       rm -f $(@:.h.d=.h)T3
+       sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
+           $(@:.h=.h.d)T > $(@:.h=.h.d)T2
+       rm -f $(@:.h=.h.d)T
+       mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d)
+       mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
+vpath %.sym $(sysdirs)
+before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
 \f
 # Generate an ordered list of implicit rules which find the source files in
 # each sysdep directory.  The old method was to use vpath to search all the
@@ -193,15 +208,6 @@ endif
 # later directory would be chosen over a .c file in an earlier directory,
 # which does not preserve the desired sysdeps ordering behavior.
 
-# When making the list of .d files to include, we can't know which ones
-# have source in .s files, and thus do not in fact need a .d file.
-# So we must define rules to make .d files for .s files.
-define make-dummy-dep
-$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
-endef
-$(common-objpfx)dummy.d:
-       echo '# .s files cannot contain includes, so they need no deps.' > $@
-
 # It matters that this set of rules, for compiling from sources in
 # the current directory (the $srcdir/$subdir) come before the
 # generated sysdep rules in included from sysd-rules below.  When
@@ -212,21 +218,18 @@ $(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
 
 define o-iterator-doit
 $(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)
 
 define o-iterator-doit
 $(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
 
 # Omit the objpfx rules when building in the source tree, because
 # objpfx is empty and so these rules just override the ones above.
@@ -238,21 +241,18 @@ $(objpfx)%$o: $(objpfx)%.S $(before-compile); $$(compile-command.S)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
 
 define o-iterator-doit
 $(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)
 
 define o-iterator-doit
 $(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
 endef
 object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
-$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
 endif
 
 # System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
@@ -301,26 +301,6 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
             echo "\$$(objpfx)ptw-%$$o: $$dir/%.c \$$(before-compile); \
                  \$$(compile-command.c)";                                    \
           done; \
-          $(open-check-inhibit-asm) \
-          echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
-               \$$(make-dummy-dep)";                          \
-          echo "\$$(objpfx)rtld-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
-               \$$(make-dummy-dep)";                          \
-          echo "\$$(objpfx)ptw-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
-               \$$(make-dummy-dep)";                          \
-          echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
-               \$$(+make-deps)";                                             \
-          echo "\$$(objpfx)rtld-%.d: $$dir/%.S \$$(before-compile); \
-               \$$(+make-deps)";                                             \
-          echo "\$$(objpfx)ptw-%.d: $$dir/%.S \$$(before-compile); \
-               \$$(+make-deps)";                                             \
-          $(close-check-inhibit-asm)   \
-          echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
-               \$$(+make-deps)";                                             \
-          echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \
-               \$$(+make-deps)";                                             \
-          echo "\$$(objpfx)ptw-%.d: $$dir/%.c \$$(before-compile); \
-               \$$(+make-deps)";                                             \
           echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)";   \
           echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)";   \
         done;                                                                \
@@ -383,32 +363,20 @@ endif # avoid-generated
 endif # $(versioning) = yes
 endif # sysd-sorted-done
 
-
-ifndef compile-command.S
-compile-command.S = $(compile.S) $(OUTPUT_OPTION)
-endif
-ifndef compile-command.s
-compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
-endif
-ifndef compile-command.c
-compile-command.c = $(compile.c) $(OUTPUT_OPTION)
-endif
+# Generate .dT files as we compile.
+compile-mkdep-flags = -MD -MP -MF $@.dt
+compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
+compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) $(compile-mkdep-flags)
+compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
 
 # GCC can grok options after the file name, and it looks nicer that way.
 compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
-compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) $(ASFLAGS-$(suffix $@))
+compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \
+                 $(ASFLAGS) $(ASFLAGS-$(suffix $@))
+COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
+                 $(ASFLAGS) $(ASFLAGS-$(suffix $@))
 COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
 
-# If we want to generate MD5 checksums for the sources do this now.
-ifeq ($(md5),yes)
-generate-md5 = ; rm -f $(@:.d=.md5); \
-$(CC) -E $< $(CFLAGS) $(CPPFLAGS) $($(patsubst .%,%,$(suffix $(<F)))-CPPFLAGS) | \
-sed '/^\#/d;/^[[:space:]]*$$/d' | md5sum > $(@:.d=.md5)
-else
-generate-md5 =
-endif
-
 # We need this for the output to go in the right place.  It will default to
 # empty if make was configured to work with a cc that can't grok -c and -o
 # together.  You can't compile the C library with such a compiler.
@@ -418,14 +386,16 @@ OUTPUT_OPTION = -o $@
 # the dependency run for C sources.  But having it for assembly sources can
 # get the wrong predefines.
 S-CPPFLAGS = -DASSEMBLER $(asm-CPPFLAGS)
+
 define +make-deps
 $(make-target-directory)
 $(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \
-            $(CPPFLAGS) $($(patsubst .%,%,$(suffix $(<F)))-CPPFLAGS) | sed \
--e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
-$(sed-remove-objpfx) > $(@:.d=.T)
+            $(CPPFLAGS) $($(patsubst .%,%,$(suffix $(<F)))-CPPFLAGS) | sed -e\
+'s,$(subst .,\.,$(@F:.d=.o)),$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
+$(sed-remove-objpfx) $(sed-remove-dotdot) > $(@:.d=.T)
 mv -f $(@:.d=.T) $@ $(generate-md5)
 endef
+
 ifneq (,$(objpfx))
 # Continuation lines here are dangerous because they introduce spaces!
 define sed-remove-objpfx
@@ -509,17 +479,34 @@ endif
 ifeq (yes,$(elf))
 # binutils only position loadable notes into the first page for binaries,
 # not for shared objects
-define build-shlib
-$(build-shlib-helper) \
-         -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \
-         $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \
-         sed -e '/^=========/,/^=========/!d;/^=========/d' \
+$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
+       $(LINK.o) -shared -Wl,-O1 \
+                 -nostdlib -nostartfiles \
+                 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+                 -Wl,--verbose 2>&1 | \
+         sed > $@T \
+             -e '/^=========/,/^=========/!d;/^=========/d' \
              -e 's/^.*\.hash[  ]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
-             $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds
-rm -f $@.new
-$(build-shlib-helper) -o $@ -T $@.lds \
+             -e 's/^.*\*(\.dynbss).*$$/& \
+                PROVIDE(__start___libc_freeres_ptrs = .); \
+                *(__libc_freeres_ptrs) \
+                PROVIDE(__stop___libc_freeres_ptrs = .);/'\
+             -e 's/^.*\*(\.jcr).*$$/&\n\
+                PROVIDE(__start___libc_subfreeres = .);\n\
+                __libc_subfreeres : { *(__libc_subfreeres) }\n\
+                PROVIDE(__stop___libc_subfreeres = .);\n\
+                PROVIDE(__start___libc_atexit = .);\n\
+                __libc_atexit : { *(__libc_atexit) }\n\
+                PROVIDE(__stop___libc_atexit = .);\n\
+                PROVIDE(__start___libc_thread_subfreeres = .);\n\
+                __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\n\
+                PROVIDE(__stop___libc_thread_subfreeres = .);/'
+       mv -f $@T $@
+common-generated += shlib.lds
+
+define build-shlib
+$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
          $(csu-objpfx)abi-note.o $(build-shlib-objlist)
-rm -f $@.lds
 endef
 else
 ifneq (,$(findstring aix,$(config-os)))
@@ -547,6 +534,7 @@ endef
 else
 define build-module-helper
 $(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+         $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
          -B$(csu-objpfx) $(load-map-file) \
          $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
@@ -559,16 +547,8 @@ ifeq (yes,$(elf))
 # binutils only position loadable notes into the first page for binaries,
 # not for shared objects
 define build-module
-$(build-module-helper) \
-         -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \
-         $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \
-         sed -e '/^=========/,/^=========/!d;/^=========/d' \
-             -e 's/^.*\.hash[  ]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
-         > $@.lds
-rm -f $@.new
-$(build-module-helper) -o $@ -T $@.lds \
+$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
          $(csu-objpfx)abi-note.o $(build-module-objlist)
-rm -f $@.lds
 endef
 else
 ifneq (,$(findstring aix,$(config-os)))
@@ -590,7 +570,7 @@ endif
 
 build-module-helper-objlist = \
        $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
-                  $(filter-out $(map-file) $(+preinit) $(+postinit),$^))
+                  $(filter-out %.lds $(map-file) $(+preinit) $(+postinit),$^))
 whole-archive := -Wl,--whole-archive
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
@@ -605,8 +585,6 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
 LDLIBS-c.so += $(gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
-# Force the backward compatibility EH functions to be linked.
-LDFLAGS-c.so += -u __register_frame
 # Pre-link the objects of libc_pic.a so that we can locally resolve
 # COMMON symbols before we link against ld.so.  This is because ld.so
 # contains some of libc_pic.a already, which will prevent the COMMONs
@@ -616,12 +594,12 @@ ifeq ($(elf),yes)
 $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
        $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
        $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
-LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/'
 # Use our own special initializer and finalizer files for libc.so.
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
                         $(common-objpfx)libc_pic.os \
                         $(elfobjdir)/sofini.os \
-                        $(elfobjdir)/interp.os $(elfobjdir)/ld.so
+                        $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
+                        $(common-objpfx)shlib.lds
        $(build-shlib)
 ifeq ($(versioning),yes)
 $(common-objpfx)libc.so: $(common-objpfx)libc.map
@@ -689,6 +667,15 @@ endif
 +depfiles := $(addprefix $(objpfx),\
                         $(filter-out $(addsuffix .d,$(omit-deps)),\
                                      $(+depfiles)))
+all-dt-files := $(foreach o,$(object-suffixes-for-libc),$(+depfiles:.d=$o.dt))
++depfiles := $(patsubst %.dt,%.d,$(wildcard $(all-dt-files))) \
+            $(wildcard $(all-dt-files:.dt=.d))
+
+# This is a funny rule in that it removes its input file.
+%.d: %.dt
+       @sed $(sed-remove-objpfx) $< > $(@:.d=.T) && \
+        mv -f $(@:.d=.T) $@ && \
+        rm -f $<
 
 # Avoid the .h.d files for any .sym files whose .h files don't exist yet.
 # They will be generated when they're needed, and trying too early won't work.
@@ -762,6 +749,7 @@ define o-iterator-doit
 $(objpfx)stamp$o: $(o-objects); $$(do-stamp)
 endef
 define do-stamp
+$(make-target-directory)
 echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
 mv -f $@T $@
 endef
@@ -872,8 +860,16 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
 install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
 install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
 
-install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \
-                     $(install-lib.so-unversioned:%=$(inst_slibdir)/%)
+# For versioned libraries, we install three files:
+#      $(inst_libdir)/libfoo.so        -- for linking, symlink or ld script
+#      $(inst_slibdir)/libfoo.so.NN    -- for loading by SONAME, symlink
+#      $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
+V := $(firstword $($(subdir)-version) $(version))
+install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
+                     $(foreach L,$(install-lib.so-versioned),\
+                               $(inst_libdir)/$L \
+                               $(inst_slibdir)/$(L:.so=)-$V.so \
+                               $(inst_slibdir)/$L$($L-version))
 
 # Install all the unversioned shared libraries.
 $(install-lib.so-unversioned:%=$(inst_slibdir)/%): $(inst_slibdir)/%.so: \
@@ -1180,15 +1176,23 @@ define check-abi
        LC_ALL=C \
        $(AWK) -f $< -v 'config=$(check-abi-config)' \
               $(filter %.abilist,$^) \
-       | diff -pu0 - $(filter %.symlist,$^)
+       | { diff -pu0 - $(filter %.symlist,$^) $(check-abi-warn) ; }
 endef
+ifeq ($(enable-check-abi),warn)
+check-abi-warn = || echo '*** WARNING: $*.so failed ABI check'
+endif
 
 ifeq ($(firstword $(sysd-sorted-done) f)$(firstword $(generating) f),tf)
 -include $(common-objpfx)tls.make
-config-tls-yes := tls
-config-tls-no := notls
+config-tls := notls
+ifeq ($(use-tls),yes)
+config-tls := tls
+endif
+ifeq ($(use-thread),yes)
+config-tls := thread
+endif
 check-abi-config := \
-  $(config-machine)-$(config-vendor)-$(config-os)/$(config-tls-$(use-thread))
+  $(config-machine)-$(config-vendor)-$(config-os)/$(config-tls)
 endif
 
 update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
@@ -1203,7 +1207,7 @@ define update-abi
 endef
 else
 define update-abi
-LC_ALL=C $(AWK) -v config=$(update-abi-config) -f $^ \
+LC_ALL=C $(AWK) -v config='$(update-abi-config)' -f $^ \
         > $(..)abilist/$*.abilist.new
 @if cmp -s $(..)abilist/$*.abilist.new $(..)abilist/$*.abilist 2> /dev/null; \
  then rm -f $(..)abilist/$*.abilist.new; \
@@ -1225,19 +1229,23 @@ check-abi: subdir_check-abi
 update-abi: subdir_update-abi
 endif
 
-# Enable this when all the .abilist files are in place.
-#tests: check-abi
-
 ifeq ($(subdir),elf)
 check-abi: check-abi-libc
 update-abi: update-abi-libc
 common-generated += libc.symlist
 endif
 
+ifeq ($(build-shared),yes)
+ifneq ($(enable-check-abi),no)
+ifdef subdir
+tests: check-abi
+endif
+endif
+endif
+
 endif
 
 # There's no good place to put this - here will do.
-# The dependencies are wrong if it's run from the top level.
 ifeq ($(filter %posix, $(sysdirs)),)
 L_tmpnam  = 1
 TMP_MAX   = 0
@@ -1255,24 +1263,20 @@ $(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
 $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
                   $(common-objpfx)config.make
        $(make-target-directory)
-       echo '#include "$(..)posix/bits/posix1_lim.h"' |                \
-       SUNPRO_DEPENDENCIES='$(@:st=dT) $@'                             \
-       $(CC) $(+includes) -E -dM -xc - -o $(@:st=hT)
-       echo '#include "$(..)misc/sys/uio.h"' |                         \
-       SUNPRO_DEPENDENCIES='$(@:st=dT) $@'                             \
-       $(CC) -D_LIBC=1 $(+includes) -E -dM -xc - | cat - >> $(@:st=hT)
-ifdef sed-remove-objpfx
-       sed $(sed-remove-objpfx) $(@:st=dT) > $(@:st=dt)
-       cat $(@:st=dt) >> $(@:st=d)
-else
-       cat $(@:st=dT) >> $(@:st=d)
-endif
+       { echo '#include "$(..)posix/bits/posix1_lim.h"';               \
+         echo '#define _LIBC 1';                                       \
+         echo '#include "$(..)misc/sys/uio.h"'; } |                    \
+       $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)'   \
+             $(+includes) -xc - -o $(@:st=hT)
+       sed $(sed-remove-objpfx) $(sed-remove-dotdot)                   \
+           $(@:st=dT) > $(@:st=dt)
+       mv -f $(@:st=dt) $(@:st=d)
        fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`;       \
        filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;    \
        iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`;        \
        fopen_max=$${fopen_max:-16};                                    \
        filename_max=$${filename_max:-1024};                            \
-       if [ -z $$iov_max ]; then                                       \
+       if [ -z "$$iov_max" ]; then                                     \
          define_iov_max="# undef IOV_MAX";                             \
        else                                                            \
          define_iov_max="# define IOV_MAX $$iov_max";                  \
@@ -1347,8 +1351,8 @@ endef
 
 # Also remove the dependencies and generated source files.
 common-clean: common-mostlyclean
-       -rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
-       -rm -f $(objpfx)rtld-*.d
+       -rm -f $(addprefix $(objpfx),$(generated))
+       -rm -f $(objpfx)*.d $(objpfx)*.dt
        -rm -fr $(addprefix $(objpfx),$(generated-dirs))
        -rm -f $(addprefix $(common-objpfx),$(common-generated))
        -rm -f $(objpfx)distinfo
@@ -1362,17 +1366,23 @@ ifdef objpfx
 .PHONY: stubs # The parent Makefile calls this target.
 stubs: $(objpfx)stubs
 endif
-s = $(sysdep_dir)/generic
 $(objpfx)stubs: $(+depfiles)
+ifneq (,$(strip $(+depfiles)))
 # Use /dev/null since `...` might expand to empty.
-       (s=`cd $s && $(PWD_P)`; \
-        $(patsubst %/,cd % &&,$(objpfx)) \
-        sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
-         `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \
-               -e '/stub-tag\.h/{; g; p; }' \
-                 $(patsubst $(objpfx)%,%,$^) /dev/null` \
-            /dev/null) > $@T
+       c=`($(patsubst %/,cd % &&,$(objpfx)) \
+           sed -n -e 's@\$$(common-objpfx)@$(common-objpfx)@g' \
+                  -e 's@\$$(objpfx)@$(objpfx)@g' \
+                  -e '/stub-tag\.h/{; g; s/./&/p; }' \
+                  -e '/:/{x; s/^.*$$//; x; }' \
+                  -e 's/^.*://;s/\\$$//;s/^ *\([^ ][^ ]*\) .*$$/\1/' \
+                  -e '/^[^ ][^ ]*$$/{G;s/^.*\n\(..*\)/\1/;s/\n//;h; }' \
+                  $(patsubst $(objpfx)%,%,$^)) | sort | uniq`; \
+       sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
+           $$c /dev/null > $@T
        mv -f $@T $@
+else
+       > $@
+endif
 \f
 # Make the distribution tar file.
 
This page took 0.040366 seconds and 5 git commands to generate.