From bff4dfd1b1f6f2ee53bd4aae6de5d3b66c172251 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 7 May 2025 22:46:31 -0500 Subject: [PATCH] Added NO_GCC to allow users to explicitly disable GCC-specific flags This is the same as the implicit Clang => NO_GCC behavior introduced by yamt, but with an explicit variable that can be assigned by users using other, non-gcc, compilers: $ NO_GCC=1 make Note, stack measurements are currently GCC specific: $ NO_GCC=1 make stack ... snip ... FileNotFoundError: [Errno 2] No such file or directory: 'lfs.ci' make: *** [Makefile:494: lfs.stack.csv] Error 1 --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1fd856f9..588e095d 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,12 @@ VALGRIND ?= valgrind GDB ?= gdb PERF ?= perf +# guess clang or gcc (clang sometimes masquerades as gcc because of +# course it does) +ifneq ($(shell $(CC) --version | grep clang),) +NO_GCC = 1 +endif + SRC ?= $(filter-out $(wildcard *.t.* *.b.*),$(wildcard *.c)) OBJ := $(SRC:%.c=$(BUILDDIR)/%.o) DEP := $(SRC:%.c=$(BUILDDIR)/%.d) @@ -63,9 +69,9 @@ CFLAGS += -g3 CFLAGS += -I. CFLAGS += -std=c99 -Wall -Wextra -pedantic CFLAGS += -Wmissing-prototypes -ifeq ($(shell $(CC) --version | grep clang),) -CFLAGS += -ftrack-macro-expansion=0 +ifndef NO_GCC CFLAGS += -fcallgraph-info=su +CFLAGS += -ftrack-macro-expansion=0 endif ifdef DEBUG