]> git.proxmox.com Git - wasi-libc.git/commitdiff
Use `-isystem` instead of `--sysroot` for the installed headers
authorJohn Ericson <John.Ericson@Obsidian.Systems>
Mon, 21 Mar 2022 23:16:23 +0000 (23:16 +0000)
committerDan Gohman <dev@sunfishcode.online>
Mon, 21 Mar 2022 23:24:46 +0000 (16:24 -0700)
This is less of a sledgehammer, and prepares the way for #270.

Makefile

index 5f253f3527ffa75a1d04a513572e35162580bab2..e6c20a167a8bb2d29f9605d7b37d08903fa02765 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -210,8 +210,19 @@ ifeq ($(THREAD_MODEL), posix)
 CFLAGS += -mthread-model posix -pthread
 endif
 
-# Set the sysroot.
-CFLAGS += --sysroot="$(SYSROOT)"
+# Expose the public headers to the implementation. We use `-isystem` for
+# purpose for two reasons:
+#
+# 1. It only does `<...>` not `"...."` lookup. We are making a libc,
+#    which is a system library, so all public headers should be
+#    accessible via `<...>` and never also need `"..."`. `-isystem` main
+#    purpose is to only effect `<...>` lookup.
+#
+# 2. The `-I` for private headers added for specific C files below
+#    should come earlier in the search path, so they can "override"
+#    and/or `#include_next` the public headers. `-isystem` (like
+#    `-idirafter`) comes later in the search path than `-I`.
+CFLAGS += -isystem "$(SYSROOT_INC)"
 
 # These variables describe the locations of various files and directories in
 # the build tree.