Update Makefile to create bin directory and adjust object file paths; add initial Dockerfile
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -56,3 +56,4 @@ ssl/*
|
|||||||
# Allow .github/workflows for CI/CD
|
# Allow .github/workflows for CI/CD
|
||||||
.github/*
|
.github/*
|
||||||
!.github/workflows/
|
!.github/workflows/
|
||||||
|
src/bin
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -15,7 +15,8 @@ LIBS = -lssl -lcrypto -lmagic -lnghttp2
|
|||||||
|
|
||||||
# Source files and object files
|
# Source files and object files
|
||||||
SRCS = src/server.c src/config_parser.c src/server_config.c src/websocket.c src/http2.c src/performance.c
|
SRCS = src/server.c src/config_parser.c src/server_config.c src/websocket.c src/http2.c src/performance.c
|
||||||
OBJS = $(SRCS:.c=.o)
|
DEST = src/bin/
|
||||||
|
OBJS = $(patsubst src/%.c,$(DEST)%.o,$(SRCS))
|
||||||
TARGET = server
|
TARGET = server
|
||||||
|
|
||||||
# Header files
|
# Header files
|
||||||
@@ -29,9 +30,13 @@ TOTAL_FILES := $(words $(SRCS))
|
|||||||
CURRENT_FILE = 0
|
CURRENT_FILE = 0
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all: $(TARGET)
|
all: $(DEST) $(TARGET)
|
||||||
@echo "$(GREEN)Build complete! ✓$(NC)"
|
@echo "$(GREEN)Build complete! ✓$(NC)"
|
||||||
|
|
||||||
|
# Create bin directory
|
||||||
|
$(DEST):
|
||||||
|
@mkdir -p $(DEST)
|
||||||
|
|
||||||
# Linking
|
# Linking
|
||||||
$(TARGET): $(OBJS)
|
$(TARGET): $(OBJS)
|
||||||
@echo "$(BLUE)Linking...$(NC)"
|
@echo "$(BLUE)Linking...$(NC)"
|
||||||
@@ -40,7 +45,7 @@ $(TARGET): $(OBJS)
|
|||||||
@echo "$(GREEN)Linking successful ✓$(NC)"
|
@echo "$(GREEN)Linking successful ✓$(NC)"
|
||||||
|
|
||||||
# Compilation with progress
|
# Compilation with progress
|
||||||
%.o: %.c $(HEADERS)
|
$(DEST)%.o: src/%.c $(HEADERS)
|
||||||
@$(eval CURRENT_FILE=$(shell echo $$(($(CURRENT_FILE)+1))))
|
@$(eval CURRENT_FILE=$(shell echo $$(($(CURRENT_FILE)+1))))
|
||||||
@echo "$(YELLOW)Building [$$(( $(CURRENT_FILE) * 100 / $(TOTAL_FILES) ))%] $<$(NC)"
|
@echo "$(YELLOW)Building [$$(( $(CURRENT_FILE) * 100 / $(TOTAL_FILES) ))%] $<$(NC)"
|
||||||
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ \
|
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ \
|
||||||
@@ -50,6 +55,7 @@ $(TARGET): $(OBJS)
|
|||||||
clean:
|
clean:
|
||||||
@echo "$(BLUE)Cleaning build files...$(NC)"
|
@echo "$(BLUE)Cleaning build files...$(NC)"
|
||||||
@rm -f $(OBJS) $(TARGET)
|
@rm -f $(OBJS) $(TARGET)
|
||||||
|
@rm -rf $(DEST)
|
||||||
@echo "$(GREEN)Clean complete ✓$(NC)"
|
@echo "$(GREEN)Clean complete ✓$(NC)"
|
||||||
|
|
||||||
# Install dependencies (for Debian/Ubuntu/Raspberry Pi OS)
|
# Install dependencies (for Debian/Ubuntu/Raspberry Pi OS)
|
||||||
@@ -60,7 +66,9 @@ install-deps:
|
|||||||
libssl-dev \
|
libssl-dev \
|
||||||
libcjson-dev \
|
libcjson-dev \
|
||||||
libmagic-dev \
|
libmagic-dev \
|
||||||
build-essential
|
build-essential \
|
||||||
|
libnghttp2-dev \
|
||||||
|
pkg-config
|
||||||
@echo "$(GREEN)Dependencies installed ✓$(NC)"
|
@echo "$(GREEN)Dependencies installed ✓$(NC)"
|
||||||
|
|
||||||
# Debug build
|
# Debug build
|
||||||
|
|||||||
0
src/Dockerfile
Normal file
0
src/Dockerfile
Normal file
Reference in New Issue
Block a user