This is the mail archive of the
mailing list for the libc-ports project.
[COMMITTED PATCH] Support sysdeps/.../include/ directories.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: libc-ports at sourceware dot org
- Date: Fri, 8 Feb 2013 10:27:02 -0800 (PST)
- Subject: [COMMITTED PATCH] Support sysdeps/.../include/ directories.
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
2013-02-08 Roland McGrath <email@example.com>
* Makeconfig (+sysdep-includes): Define with := rather than =.
Use an existing include/ subdir of each sysdeps dir before it.
@@ -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)