From ff2b18f7546c31380734cc3a7acef0bbf5145d82 Mon Sep 17 00:00:00 2001 From: Quentin Quadrat Date: Wed, 9 Nov 2022 03:20:25 +0100 Subject: [PATCH] Fix CXX and CXXFLAGS are for g++ and this is a C project #18 CXX = gcc is not a good idea because: 1/ We cannot override options like: make CC=clang-13 CFLAGS="-O2 -s -Wall -fPIC" -j8 2/ CXX is for g++ and overriding will fail compiling the project. 3/ CC is by default equals to cc (gcc) --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8074a2a..c65d87a 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,7 @@ LIBDIR = lib INCDIR = src OBJDIR = obj -CXX = gcc -CXXFLAGS = -O2 -s -Wall +CFLAGS ?= -O2 -s -Wall DELETER = rm -f COPIER = cp @@ -39,7 +38,7 @@ $(BIN): $(OBJ) $(OBJDIR)/%.o: $(SRCDIR)/%.c mkdir -p $(OBJDIR) - $(CXX) $(CXXFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) -o $@ -c $< clean: