mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
newlib.mk: sanitize output before getting include path
Only keep lines that are indeed include path. It also keeps newlines as they do not matter. It fixes Mingw32 support where `grep '^\s'` is not working the same way. It also handles some mac `sed` that do not support `\s`. Ouput tested with: make -C examples/hello-world BOARD=samr21-xpro info-debug-variable-COMPILER_INCLUDE_PATHS # by also putting newlines for readability Now: /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include Before: /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
This commit is contained in:
parent
18a4ccf315
commit
3a4538ee76
@ -23,7 +23,11 @@ export LINKFLAGS += -lc
|
||||
|
||||
# Try to search for newlib in the standard search path of the compiler for includes
|
||||
ifeq (,$(NEWLIB_INCLUDE_DIR))
|
||||
COMPILER_INCLUDE_PATHS := $(shell $(PREFIX)gcc -v -x c -E /dev/null 2>&1 | grep '^\s' | tr -d '\n')
|
||||
COMPILER_INCLUDE_PATHS := $(shell $(PREFIX)gcc -v -x c -E /dev/null 2>&1 | \
|
||||
sed \
|
||||
-e '1,/\#include <...> search starts here:/d' \
|
||||
-e '/End of search list./,$$d' \
|
||||
-e 's/^ *//')
|
||||
NEWLIB_INCLUDE_DIR := $(firstword $(dir $(wildcard $(addsuffix /newlib.h, $(COMPILER_INCLUDE_PATHS)))))
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user