mirror of
https://github.com/opus-tango/http-server-in-c.git
synced 2026-03-19 19:52:51 +00:00
43 lines
727 B
Makefile
43 lines
727 B
Makefile
# Compiler and flags
|
|
CC = gcc
|
|
DEBUG_FLAGS = -g -Wall -Wextra
|
|
RELEASE_FLAGS = -Wall -Wextra -DNDEBUG
|
|
LFLAGS = -lpthread
|
|
|
|
# Source files
|
|
SRCS = webserver.c client_handler.c request_handler.c http_stuff.c response_builder.c logging.c
|
|
|
|
# Object files definition
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
TARGET = webserver.out
|
|
|
|
|
|
# BUILD STUFF
|
|
|
|
# Default to debug
|
|
all: debug
|
|
|
|
debug: CFLAGS = $(DEBUG_FLAGS)
|
|
debug: $(TARGET)
|
|
|
|
release: CFLAGS = $(RELEASE_FLAGS)
|
|
release: $(TARGET)
|
|
|
|
# Link object files
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o $(TARGET) $(OBJS) $(LFLAGS)
|
|
|
|
# Compile object files
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
# Object dependencies
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
clean:
|
|
rm -f $(OBJS)
|
|
rm -f $(TARGET)
|
|
|
|
.PHONY: all debug release clean |