-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
32 lines (24 loc) · 727 Bytes
/
makefile
File metadata and controls
32 lines (24 loc) · 727 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
31
32
CXX := g++
SRC_DIR := source
BUILD_DIR := build
TARGET := sfml-app
CPP_FILES := $(shell find $(SRC_DIR) -type f -name '*.cpp')
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp, $(BUILD_DIR)/%.o, $(CPP_FILES))
.PHONY: all clean
all: $(BUILD_DIR) $(TARGET)
$(TARGET): $(OBJ_FILES)
@echo "Linking object files into $(TARGET)..."
@$(CXX) $(OBJ_FILES) -o $(TARGET) -lsfml-graphics -lsfml-window -lsfml-system
@echo "All object files:"
@echo $(OBJ_FILES) | xargs
$(BUILD_DIR):
@echo "Creating build directory..."
@mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@echo "Compiling $< -> $@"
@mkdir -p $(dir $@)
@$(CXX) -c $< -o $@
clean:
@echo "Cleaning up build directory..."
@rm -rf $(BUILD_DIR)
@rm -rf sfml-app