2024-08-30 02:58:11 +00:00
|
|
|
COMMON_FLAGS = -Wall -Wextra -Wpedantic \
|
2024-08-30 05:08:31 +00:00
|
|
|
-Ithird_party/SimpleArchiver/src \
|
2024-08-30 02:58:11 +00:00
|
|
|
-Ithird_party/SimpleArchiver/src/data_structures \
|
|
|
|
-Ithird_party/SimpleArchiver/src/algorithms
|
2024-08-29 06:18:34 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
SOURCES = \
|
2024-08-29 06:38:44 +00:00
|
|
|
src/main.c \
|
|
|
|
src/arg_parse.c \
|
|
|
|
src/big_endian.c \
|
|
|
|
src/tcp_socket.c \
|
|
|
|
src/signal_handling.c \
|
2024-08-30 02:58:11 +00:00
|
|
|
src/globals.c \
|
2024-08-30 05:08:31 +00:00
|
|
|
src/http.c \
|
|
|
|
third_party/SimpleArchiver/src/helpers.c \
|
2024-08-30 02:58:11 +00:00
|
|
|
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 06:38:44 +00:00
|
|
|
|
2024-08-29 05:19:46 +00:00
|
|
|
OBJECT_DIR = objs
|
|
|
|
OBJECTS = $(addprefix ${OBJECT_DIR}/,$(patsubst %.c,%.c.o,${SOURCES}))
|
|
|
|
|
2024-08-30 09:11:03 +00:00
|
|
|
all: c_simple_http unit_test
|
2024-08-29 05:19:46 +00:00
|
|
|
|
|
|
|
c_simple_http: ${OBJECTS}
|
|
|
|
gcc -o c_simple_http ${CFLAGS} $^
|
|
|
|
|
2024-08-30 09:11:03 +00:00
|
|
|
unit_test: $(filter-out ${OBJECT_DIR}/src/main.c.o,${OBJECTS}) ${OBJECT_DIR}/src/test.c.o
|
|
|
|
gcc -o unit_test ${CFLAGS} $^
|
|
|
|
|
2024-08-29 05:19:46 +00:00
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f c_simple_http
|
2024-08-30 09:11:03 +00:00
|
|
|
rm -f unit_test
|
2024-08-29 05:19:46 +00:00
|
|
|
rm -rf ${OBJECT_DIR}
|
|
|
|
|
|
|
|
${OBJECT_DIR}/%.c.o: %.c
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
gcc -o $@ -c ${CFLAGS} $<
|