-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (33 loc) · 775 Bytes
/
Makefile
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
33
34
35
36
37
38
39
40
41
42
43
44
TARGET = main
SRC = ./src
INC = ./inc
BIN = ./bin
LIB = -lsfml-graphics -lsfml-system -lsfml-window -lpthread
################
# COLORS #
RED = \033[1;31m
GREEN = \033[1;32m
BLUE = \033[1;34m
YELLOW = \033[1;33m
NC = \033[1;0m
################
SOURCE = $(wildcard $(SRC)/*.cpp)
OBJECT = $(patsubst %, $(BIN)/%, $(notdir $(SOURCE:.cpp=.o)))
CC = g++ -c
$(BIN)/$(TARGET): $(OBJECT)
@echo "\n$(RED) Linking...$(NC)"
g++ -o $@ $^ $(LIB)
@echo "Finished!"
$(BIN)/%.o: $(SRC)/%.cpp
@echo "\n$(GREEN) Compiling...$(NC)"
g++ -c $< -o $@ $(LIB)
@echo "Finished!"
.PHONY: help run
run: $(BIN)/$(TARGET)
@echo "\n$(YELLOW) Running...$(NC)"
$(BIN)/$(TARGET)
clean:
rm -f $(OBJECT) $(BIN)/$(TARGET)
help:
@echo "src: $(SOURCE)"
echo "obj: $(OBJECT)"