39 lines
774 B
Makefile
39 lines
774 B
Makefile
# Compiler and linker settings
|
|
CXX = gcc
|
|
LDFLAGS = `curl-config --libs` -lssl -lcrypto
|
|
CXXFLAGS = -pedantic -std=c23 -I include `curl-config --cflags`
|
|
|
|
# Source and object files
|
|
SRC = $(wildcard src/*.c)
|
|
OBJ = $(addprefix build/, $(notdir $(SRC:.c=.o)))
|
|
|
|
# Target executable
|
|
TARGET = build/x86_64/main.x86_64
|
|
|
|
# Default target
|
|
all: clean dirs $(TARGET)
|
|
|
|
# development target with debugging
|
|
dev: CXXFLAGS += -g
|
|
dev: all
|
|
|
|
# Release target
|
|
release: CXXFLAGS += -O3
|
|
release: all
|
|
|
|
# Create build directory if it doesn't exist
|
|
dirs:
|
|
@mkdir -p build/x86_64
|
|
|
|
# Build target
|
|
$(TARGET): $(OBJ)
|
|
$(CXX) -o $@ $^ $(LDFLAGS)
|
|
|
|
# Build object files
|
|
build/%.o: src/%.c
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
|
|
|
# Clean up build files
|
|
clean:
|
|
@rm -f $(OBJ) $(TARGET)
|
|
@echo "Cleaned up build files."
|