From 2c74ed2b0cc7611d2c5ff684e17d0a14af158402 Mon Sep 17 00:00:00 2001 From: Azreyo <58790873+Azreyo@users.noreply.github.com> Date: Mon, 3 Nov 2025 11:34:58 +0100 Subject: [PATCH] Update Makefile to create bin directory and adjust object file paths; add initial Dockerfile --- .gitignore | 3 ++- Makefile | 16 ++++++++++++---- src/Dockerfile | 0 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 src/Dockerfile diff --git a/.gitignore b/.gitignore index e41bc4b..56cdd03 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,5 @@ server ssl/* # Allow .github/workflows for CI/CD .github/* -!.github/workflows/ \ No newline at end of file +!.github/workflows/ +src/bin diff --git a/Makefile b/Makefile index c870371..544bc00 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ LIBS = -lssl -lcrypto -lmagic -lnghttp2 # 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 -OBJS = $(SRCS:.c=.o) +DEST = src/bin/ +OBJS = $(patsubst src/%.c,$(DEST)%.o,$(SRCS)) TARGET = server # Header files @@ -29,9 +30,13 @@ TOTAL_FILES := $(words $(SRCS)) CURRENT_FILE = 0 # Default target -all: $(TARGET) +all: $(DEST) $(TARGET) @echo "$(GREEN)Build complete! ✓$(NC)" +# Create bin directory +$(DEST): + @mkdir -p $(DEST) + # Linking $(TARGET): $(OBJS) @echo "$(BLUE)Linking...$(NC)" @@ -40,7 +45,7 @@ $(TARGET): $(OBJS) @echo "$(GREEN)Linking successful ✓$(NC)" # Compilation with progress -%.o: %.c $(HEADERS) +$(DEST)%.o: src/%.c $(HEADERS) @$(eval CURRENT_FILE=$(shell echo $$(($(CURRENT_FILE)+1)))) @echo "$(YELLOW)Building [$$(( $(CURRENT_FILE) * 100 / $(TOTAL_FILES) ))%] $<$(NC)" @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ \ @@ -50,6 +55,7 @@ $(TARGET): $(OBJS) clean: @echo "$(BLUE)Cleaning build files...$(NC)" @rm -f $(OBJS) $(TARGET) + @rm -rf $(DEST) @echo "$(GREEN)Clean complete ✓$(NC)" # Install dependencies (for Debian/Ubuntu/Raspberry Pi OS) @@ -60,7 +66,9 @@ install-deps: libssl-dev \ libcjson-dev \ libmagic-dev \ - build-essential + build-essential \ + libnghttp2-dev \ + pkg-config @echo "$(GREEN)Dependencies installed ✓$(NC)" # Debug build diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 0000000..e69de29