Skip to content

Commit 92ca23f

Browse files
committed
Build binaries in bin folder
1 parent 8ddb736 commit 92ca23f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
obj/
22
logs/
3+
bin/
34

45
*.log
56

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ NAME := webserv
33
OBJ_DIR := obj
44
SRC_DIR := src
55
INC_DIR := include
6+
BIN_DIR := bin
67

78
SRC += main.cpp
89
SRC += global.cpp
@@ -65,9 +66,9 @@ DEPS := $(addprefix $(INC_DIR)/, $(HEADERS))
6566
CXX := c++
6667
CXXFLAGS := -Wall -Wextra -Werror -Wpedantic -std=c++98 -Iinclude -Iinclude/poll -Iinclude/config -Iinclude/http -Iinclude/utils -Iinclude/output
6768

68-
all: $(NAME)
69+
all: $(BIN_DIR)/$(NAME)
6970

70-
$(NAME): $(OBJ)
71+
$(BIN_DIR)/$(NAME): $(OBJ) | $(BIN_DIR)
7172
$(CXX) $(CXXFLAGS) $^ -o $@
7273

7374
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(DEPS) | $(OBJ_DIR)
@@ -80,12 +81,15 @@ $(OBJ_DIR):
8081
mkdir -p $(OBJ_DIR)/utils
8182
mkdir -p $(OBJ_DIR)/output
8283

84+
$(BIN_DIR):
85+
mkdir -p $(BIN_DIR)
86+
8387
clean:
8488
$(RM) -r $(OBJ_DIR)
8589

8690
fclean: clean
8791
rm -f tools/transformer
88-
$(RM) $(NAME)
92+
$(RM) -r $(BIN_DIR)
8993

9094
re: fclean all
9195

@@ -114,8 +118,6 @@ help:
114118
@echo " performance : Build with optimization flags (-O3)"
115119
@echo " debug : Build with debugging symbols (-g)"
116120
@echo " custom : Build with custom CXXFLAGS (e.g., ARG='-DDEBUG')"
117-
@echo " flamegraph : Generate flamegraph profiling SVG"
118-
@echo " jmeter : Download and run Apache JMeter"
119121
@echo " lines : Count lines of code in source files"
120122

121123
.PHONY: all clean fclean re performance debug fsanitize custom flamegraph jmeter lines help

0 commit comments

Comments
 (0)