c_simple_http/Makefile

64 lines
1.4 KiB
Makefile
Raw Normal View History

2024-09-05 07:25:49 +00:00
CC ?= gcc
COMMON_FLAGS = -Wall -Wextra -Wpedantic \
2024-08-31 05:43:53 +00:00
-Ithird_party
DEBUG_FLAGS = -Og -g
2024-08-29 05:19:46 +00:00
RELEASE_FLAGS = -O3 -DNDEBUG
ifdef RELEASE
CFLAGS = ${COMMON_FLAGS} ${RELEASE_FLAGS}
else
CFLAGS = ${COMMON_FLAGS} ${DEBUG_FLAGS}
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 \
src/http_template.h \
src/helpers.h
2024-08-29 05:19:46 +00:00
SOURCES = \
src/main.c \
src/arg_parse.c \
src/big_endian.c \
src/tcp_socket.c \
src/signal_handling.c \
src/globals.c \
src/http.c \
src/config.c \
src/http_template.c \
src/helpers.c \
third_party/SimpleArchiver/src/helpers.c \
third_party/SimpleArchiver/src/data_structures/linked_list.c \
third_party/SimpleArchiver/src/data_structures/hash_map.c \
third_party/SimpleArchiver/src/data_structures/priority_heap.c \
third_party/SimpleArchiver/src/algorithms/linear_congruential_gen.c
2024-08-29 05:19:46 +00:00
OBJECT_DIR = objs
OBJECTS = $(addprefix ${OBJECT_DIR}/,$(patsubst %.c,%.c.o,${SOURCES}))
all: c_simple_http unit_test
2024-08-29 05:19:46 +00:00
c_simple_http: ${OBJECTS}
2024-09-05 07:25:49 +00:00
${CC} -o c_simple_http ${CFLAGS} $^
2024-08-29 05:19:46 +00:00
unit_test: $(filter-out ${OBJECT_DIR}/src/main.c.o,${OBJECTS}) ${OBJECT_DIR}/src/test.c.o
2024-09-05 07:25:49 +00:00
${CC} -o unit_test ${CFLAGS} $^
2024-08-29 05:19:46 +00:00
.PHONY: clean
clean:
rm -f c_simple_http
rm -f unit_test
2024-08-29 05:19:46 +00:00
rm -rf ${OBJECT_DIR}
${OBJECT_DIR}/%.c.o: %.c ${HEADERS}
2024-08-29 05:19:46 +00:00
@mkdir -p $(dir $@)
2024-09-05 07:25:49 +00:00
${CC} -o $@ -c ${CFLAGS} $<