From: Stephen Seo Date: Thu, 5 Sep 2024 07:25:49 +0000 (+0900) Subject: Use ${CC} and "CC ?= gcc" in Makefile X-Git-Tag: 1.0~78 X-Git-Url: https://git.seodisparate.com/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=3f70c52551dd5b835090e662445ca252b16fa18a;p=c_simple_http Use ${CC} and "CC ?= gcc" in Makefile --- diff --git a/Makefile b/Makefile index 30b5891..5300ea1 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +CC ?= gcc + COMMON_FLAGS = -Wall -Wextra -Wpedantic \ -Ithird_party DEBUG_FLAGS = -Og -g @@ -42,10 +44,10 @@ OBJECTS = $(addprefix ${OBJECT_DIR}/,$(patsubst %.c,%.c.o,${SOURCES})) all: c_simple_http unit_test c_simple_http: ${OBJECTS} - gcc -o c_simple_http ${CFLAGS} $^ + ${CC} -o c_simple_http ${CFLAGS} $^ unit_test: $(filter-out ${OBJECT_DIR}/src/main.c.o,${OBJECTS}) ${OBJECT_DIR}/src/test.c.o - gcc -o unit_test ${CFLAGS} $^ + ${CC} -o unit_test ${CFLAGS} $^ .PHONY: clean @@ -56,4 +58,4 @@ clean: ${OBJECT_DIR}/%.c.o: %.c ${HEADERS} @mkdir -p $(dir $@) - gcc -o $@ -c ${CFLAGS} $< + ${CC} -o $@ -c ${CFLAGS} $<