-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (21 loc) · 920 Bytes
/
Makefile
File metadata and controls
30 lines (21 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
CC = g++
CFLAGS = -std=c++17 -Wall
TARGET = http_server
BUILD_DIR = build
SRC_DIR = src
SOURCES = main.cpp http_message.cpp http_server.cpp
OBJECTS = $(patsubst %.cpp, $(BUILD_DIR)/%.o, $(SOURCES))
all: $(BUILD_DIR) $(BUILD_DIR)/$(TARGET)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o $(BUILD_DIR)/$(TARGET) $(OBJECTS)
$(BUILD_DIR)/main.o: $(SRC_DIR)/main.cpp $(SRC_DIR)/http_server.h $(SRC_DIR)/http_message.h
$(CC) $(CFLAGS) -c $(SRC_DIR)/main.cpp -o $(BUILD_DIR)/main.o
$(BUILD_DIR)/http_message.o: $(SRC_DIR)/http_message.cpp $(SRC_DIR)/http_message.h
$(CC) $(CFLAGS) -c $(SRC_DIR)/http_message.cpp -o $(BUILD_DIR)/http_message.o
$(BUILD_DIR)/http_server.o: $(SRC_DIR)/http_server.cpp $(SRC_DIR)/http_server.h $(SRC_DIR)/http_message.h
$(CC) $(CFLAGS) -c $(SRC_DIR)/http_server.cpp -o $(BUILD_DIR)/http_server.o
clean:
rm -rf $(BUILD_DIR)
.PHONY: all clean