Skip to content

Commit

Permalink
arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
Browse files Browse the repository at this point in the history
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):

```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```

This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.

This PR proposes to change `sed -r` to `sed -E` because:

- `sed -E` on macOS is equivalent to `sed -r` on Linux

- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual

- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
  • Loading branch information
lupyuen committed Oct 10, 2023
1 parent f38cdb0 commit f5cd9d1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_CLANG),y)

ifneq ($(TOOLCHAIN_CLANG_CONFIG),)
ifeq ($(CLANGVER),)
export CLANGVER := $(shell $(CC) --version | grep "clang version" | sed -r "s/.* ([0-9]+\.[0-9]+).*/\1/")
export CLANGVER := $(shell $(CC) --version | grep "clang version" | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/")
endif

ifeq ($(CLANGVER),14.0)
Expand Down Expand Up @@ -257,7 +257,7 @@ else
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523

ifeq ($(GCCVER),)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -r "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
endif

ifeq ($(GCCVER),12)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/src/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ endif

ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
ifeq ($(GCCVER),)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -r "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1)
endif

ifeq ($(GCCVER),12)
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/esp32/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ CHIP_CSRCS += esp32_wlan.c esp32_wifi_utils.c esp32_wifi_adapter.c
EXTRA_LIBS += -lcore -lnet80211 -lpp -lsmartconfig -lespnow -lwpa_supplicant

ifeq ($(GCCVER),)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -r 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
export GCCVER := $(shell $(CC) --version | grep gcc | sed -E 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
endif
ifeq ($(GCCVER),12)
chip/esp32_wifi_adapter.c_CFLAGS += -Wno-maybe-uninitialized
Expand Down
2 changes: 1 addition & 1 deletion libs/libxx/libcxx.defs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ libcxx/src/filesystem/operations.cpp_CXXFLAGS += -Wno-shadow
# | ^~~~~~

ifeq ($(GCCVER),)
export GCCVER = $(shell $(CXX) --version | grep g++ | sed -r 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
export GCCVER = $(shell $(CXX) --version | grep g++ | sed -E 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
endif

ifeq ($(GCCVER),12)
Expand Down

0 comments on commit f5cd9d1

Please sign in to comment.