public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED PATCH] Support sysdeps/.../include/ directories.
@ 2013-02-08 18:27 Roland McGrath
  0 siblings, 0 replies; only message in thread
From: Roland McGrath @ 2013-02-08 18:27 UTC (permalink / raw)
  To: GNU C. Library; +Cc: libc-ports

With this, you can now create an include/ subdirectory under a
sysdeps/... directory.  This is treated about like the top-level
include/ directory: sysdeps/foo/include comes before sysdeps/foo in
the -I order, but headers from sysdeps/foo/include will never be
installed.  Hence this can be used for wrapper headers of the same
name as installed headers, that serve to override definitions or add
additional definitions meant only for internal code.

It might now make sense to move all the miscellaneous noninstalled
headers from sysdeps/.../ to sysdeps/.../include/ just for better
clarity of reading the sources.  But I'm not completely convinced this
would be an improvement.  It would require changes to any explicit
#include <sysdeps/.../foo.h> lines.  So I'll leave that for later 
consideration.


Thanks,
Roland


2013-02-08  Roland McGrath  <roland@hack.frob.com>

	* Makeconfig (+sysdep-includes): Define with := rather than =.
	Use an existing include/ subdir of each sysdeps dir before it.

--- a/Makeconfig
+++ b/Makeconfig
@@ -765,11 +765,18 @@ endif	# $(+cflags) == ""
 # Don't duplicate options if we inherited variables from the parent.
 +cflags	:= $(sort $(+cflags))
 
+# Each sysdeps directory can contain header files that both will be
+# used to compile and will be installed.  Each can also contain an
+# include/ subdirectory, whose header files will be used to compile
+# but will not be installed, and will take precedence over the
+# installed files.  This mirrors the top-level include/ subdirectory.
++sysdep-includes := $(foreach dir,$(+sysdep_dirs),\
+			      $(addprefix -I,$(wildcard $(dir)/include) $(dir)))
+
 # These are flags given to the C compiler to tell it to look for
 # include files (including ones given in angle brackets) in the parent
 # library source directory, in the include directory, and in the
 # current directory.
-+sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
 +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
 	    $(+sysdep-includes) $(includes) \
 	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-08 18:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 18:27 [COMMITTED PATCH] Support sysdeps/.../include/ directories Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).