about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile60
1 files changed, 26 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 774cf3bc23..ceaf5b0b62 100644
--- a/Makefile
+++ b/Makefile
@@ -82,14 +82,14 @@ subdirs	:= $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
 		   $(addprefix install-, no-libc.a bin lib data headers others)
 
 headers := errno.h sys/errno.h errnos.h limits.h values.h	\
-	   features.h gnu-versions.h libc-lock.h libc-version.h
+	   features.h gnu-versions.h libc-lock.h
 aux	 = sysdep $(libc-init) version
-before-compile = $(objpfx)version-info.h $(objpfx)libc-version.h
+before-compile = $(objpfx)version-info.h
 
 echo-headers: subdir_echo-headers
 
 # What to install.
-install-others = $(includedir)/stubs.h
+install-others = $(includedir)/stubs.h $(includedir)/gnu/lib-names.h
 
 ifeq (yes,$(gnu-ld))
 libc-init = set-init
@@ -152,36 +152,6 @@ generated += version-info.h
 version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
 $(version.c-objects): $(objpfx)version-info.h
 
-$(objpfx)libc-version.h: Makefile $(common-objpfx)soversions.mk \
-			 $(common-objpfx)version.mk
-	nr="$(libc.so-version)"; \
-	lnr=`echo $(version) | sed 's/[.].*//'`; \
-	lmnr=`echo $(version) | sed 's/[^.]*[.]//'`; \
-	if test -n $$nr; then \
-	  nr=`echo $$nr | sed 's/^[.]\([0-9]*\).*/\1/'`; \
-	else \
-	  nr="$$lnr"; \
-	fi; \
-	rm -f $@T; \
-	(echo '#ifndef __LIBC_VERSION_H'; \
-	 echo '#define __LIBC_VERSION_H 1'; \
-	 echo; \
-	 if test -n "$(libc.so-version)"; then \
-	   echo '/* Show that this is the GNU C Library.  The value is the'; \
-	   echo '   interface number of the shared library.  */'; \
-	 else \
-	   echo '/* Show that this is the GNU C Library.  */'; \
-	 fi; \
-	 echo "#define	__GNU_LIBRARY__	$$nr"; \
-	 echo; \
-	 echo '/* Version numbers for GNU libc release.  */'; \
-	 echo "#define	__GLIBC__	$$lnr"; \
-	 echo "#define	__GLIBC_MINOR__	$$lmnr"; \
-	 echo; \
-	 echo '#endif	/* libc-version.h */') > $@T
-	mv -f $@T $@
-generated += libc-version.h
-
 # Makerules creates a file `stub-$(subdir)' for each subdirectory, which
 # contains `#define __stub_FUNCTION' for each function which is a stub.
 # Here we paste all of these together into <stubs.h>.
@@ -202,10 +172,32 @@ $(includedir)/stubs.h: subdir_install
 	 echo '   every time called, usually setting errno to ENOSYS.  */';\
 	 sort $(subdir-stubs)) > $(objpfx)stubs.h
 	if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
-	then echo stubs.h unchanged ; \
+	then echo 'stubs.h unchanged'; \
 	else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
 	rm -f $(objpfx)stubs.h
 
+# Like stubs.h the gnu/lib-names.h header is not used while building the
+# libc itself.  So we generate it while installing.
+$(includedir)/gnu/lib-names.h: $(common-objpfx)soversions.mk
+	@rm -f $(objpfx)lib-names.h
+	(echo '/* This file is automatically generated.';\
+	 echo '   It defines macros to allow user program to find the shared';\
+	 echo '   library files which come as part of GNU libc.  */';\
+	 echo '#ifndef __GNU_LIB_NAMES_H'; \
+	 echo '#define __GNU_LIB_NAMES_H	1'; \
+	 echo; \
+	 (libs='$(all-sonames)';\
+	  for l in $$libs; do \
+	    upname=`echo $$l | sed 's/[.]so.*//' | tr [:lower:]- [:upper:]_`; \
+	    echo "#define	$${upname}_SO	$$l"; \
+	  done;) | sort; \
+	 echo; \
+	 echo '#endif	/* gnu/lib-names.h */';) > $(objpfx)lib-names.h
+	if test -r $@ && cmp -s $(objpfx)lib-names.h $@; \
+	then echo 'gnu/lib-names.h unchanged'; \
+	else $(INSTALL_DATA) $(objpfx)lib-names.h $@; fi
+	rm -f $(objpfx)lib-names.h
+
 # This makes the Info or DVI file of the documentation from the Texinfo source.
 .PHONY: info dvi
 info dvi: