Skip to content

Commit 60a1c08

Browse files
committed
* c/gcc.mk (gcc-guess-march): Handle clang -march.
1 parent f7817a0 commit 60a1c08

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

c/gcc.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ ifndef MARCH
2626
endif
2727
ifneq ($(MARCH),none)
2828
MARCH_FLAGS = -march=$(MARCH)
29-
gcc-guess-march = $(strip $(shell $(CC) $(CFLAGS) $(OPT_CFLAGS) $(MARCH_FLAGS) -x c -S -\#\#\# - < /dev/null 2>&1 | \
30-
grep -m 1 -e cc1 | grep -o -e "march=[^'\"]*" | head -n 1 | sed 's,march=,,'))
29+
# GCC prints -march=CPU. Clang prints "-target-cpu" "CPU".
30+
gcc-guess-march = $(strip $(shell $(CC) $(CFLAGS) $(OPT_CFLAGS) $(MARCH_FLAGS) -x c -S -\#\#\# - < /dev/null 2>&1 | \
31+
sed -n '/cc1/{s/.*march=\([^"'"'"' ]*\).*/\1/p;s/.*-target-cpu" "\([^"]*\)".*/\1/p;q;}'))
3132
ifeq ($(gcc-guess-march),)
3233
gcc-guess-march=unknown
3334
endif

0 commit comments

Comments
 (0)