Update Makefile: recompile if header has changed

This commit is contained in:
Stephen Seo 2024-09-01 12:36:04 +09:00
parent 3cf84b44ec
commit 1811f65a13

View file

@ -9,6 +9,16 @@ else
CFLAGS = ${COMMON_FLAGS} ${DEBUG_FLAGS} CFLAGS = ${COMMON_FLAGS} ${DEBUG_FLAGS}
endif endif
HEADERS = \
src/arg_parse.h \
src/big_endian.h \
src/tcp_socket.h \
src/globals.h \
src/signal_handling.h \
src/constants.h \
src/http.h \
src/config.h
SOURCES = \ SOURCES = \
src/main.c \ src/main.c \
src/arg_parse.c \ src/arg_parse.c \
@ -42,6 +52,6 @@ clean:
rm -f unit_test rm -f unit_test
rm -rf ${OBJECT_DIR} rm -rf ${OBJECT_DIR}
${OBJECT_DIR}/%.c.o: %.c ${OBJECT_DIR}/%.c.o: %.c ${HEADERS}
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
gcc -o $@ -c ${CFLAGS} $< gcc -o $@ -c ${CFLAGS} $<