Files

30 lines
683 B
Makefile
Raw Permalink Normal View History

2026-05-25 23:13:27 -07:00
# If set to 1, the autograder
2026-05-27 06:24:36 -07:00
#BAD_ERROR_REPORTING_FOR_AUTOGRADER=1
2026-05-25 23:13:27 -07:00
CC=clang
CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c23 -D_POSIX_C_SOURCE=200809L -pthread -O2
2026-06-01 17:18:38 -07:00
#CFLAGS+=-Og -g -fsanitize=address,undefined
2026-05-25 17:25:50 -07:00
SRCS=main.c threadpool.c util.c server.c http.c
2026-05-24 23:24:25 -07:00
OBJS=$(SRCS:%.c=bin/%.o)
2026-05-25 23:13:27 -07:00
ifeq ($(BAD_ERROR_REPORTING_FOR_AUTOGRADER),1)
CFLAGS+=-DBAD_ERROR_REPORTING_FOR_AUTOGRADER=1
endif
2026-05-24 23:24:25 -07:00
all: httpserver
httpserver: $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
2026-05-25 17:25:50 -07:00
# Auto-rebuild if Makefile changes
2026-05-25 21:59:56 -07:00
bin/%.o: %.c Makefile
2026-05-24 23:24:25 -07:00
@mkdir -p bin/deps/
2026-05-25 21:59:56 -07:00
$(CC) $(CFLAGS) -MD -MF $(patsubst %.c,bin/deps/%.d,$<) -c -o $@ $<
2026-05-24 23:24:25 -07:00
include $(SRCS:%.c/bin/deps/%.d)
clean:
rm -rf bin/ httpserver
.PHONY: all clean