webserver.c/Makefile
2024-09-10 12:58:55 -04:00

23 lines
648 B
Makefile

# ----- Variables for customization -----
CC = gcc # Compiler (you can change to clang if desired)
CFLAGS = -g2 -Wall -Wextra #-fsanitize=address # Standard flags + debugging & warnings
LDFLAGS = # Linker flags, if any
# ----- Automatic dependency tracking -----
SRCS := $(wildcard *.c) # Find all .c source files
OBJS := $(SRCS:.c=.o) # Corresponding object files (.o)
HDRS := $(SRCS:.c=.h)
# ----- Targets -----
server: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o server $(LDFLAGS)
# Create object files from source files
%.o: %.c %.h
$(CC) $(CFLAGS) -c $< -o $@
# Phony target for cleaning
.PHONY: clean
clean:
rm -f $(OBJS)