Use ${CC} and "CC ?= gcc" in Makefile
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2s
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 2s
This commit is contained in:
parent
dd5934351e
commit
3f70c52551
1 changed files with 5 additions and 3 deletions
8
Makefile
8
Makefile
|
@ -1,3 +1,5 @@
|
||||||
|
CC ?= gcc
|
||||||
|
|
||||||
COMMON_FLAGS = -Wall -Wextra -Wpedantic \
|
COMMON_FLAGS = -Wall -Wextra -Wpedantic \
|
||||||
-Ithird_party
|
-Ithird_party
|
||||||
DEBUG_FLAGS = -Og -g
|
DEBUG_FLAGS = -Og -g
|
||||||
|
@ -42,10 +44,10 @@ OBJECTS = $(addprefix ${OBJECT_DIR}/,$(patsubst %.c,%.c.o,${SOURCES}))
|
||||||
all: c_simple_http unit_test
|
all: c_simple_http unit_test
|
||||||
|
|
||||||
c_simple_http: ${OBJECTS}
|
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
|
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
|
.PHONY: clean
|
||||||
|
|
||||||
|
@ -56,4 +58,4 @@ clean:
|
||||||
|
|
||||||
${OBJECT_DIR}/%.c.o: %.c ${HEADERS}
|
${OBJECT_DIR}/%.c.o: %.c ${HEADERS}
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
gcc -o $@ -c ${CFLAGS} $<
|
${CC} -o $@ -c ${CFLAGS} $<
|
||||||
|
|
Loading…
Reference in a new issue