-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
44 lines (31 loc) · 888 Bytes
/
makefile
File metadata and controls
44 lines (31 loc) · 888 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
33
34
35
36
37
38
39
40
41
42
43
44
# Project Name
PROJECT := king
# Source, Objects and Binaries folder
SRC_DIR := src
OBJ_DIR := obj
BIN_DIR := bin
SRC := $(wildcard $(SRC_DIR)/*.cpp)
OBJ := $(SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
# Compiler
CC := g++
# Flags
CPPFLAGS := -Iinclude -O2
CFLAGS := -Wall
LDFLAGS := -Llib
LDLIBS := -lm -lsfml-graphics -lsfml-window -lsfml-system
.PHONY: all clean build
all: build $(PROJECT)
$(PROJECT): $(OBJ)
@ $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
@ echo '============================ Finished building ============================'
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(BIN_DIR) $(OBJ_DIR):
@ mkdir -p $@
build:
@ echo '=============== Started building project using g++ compiler ==============='
@ $(RM) $(OBJ_DIR)/main.o
clean:
@ $(RM) -r $(OBJ_DIR) $(PROJECT) $(BIN_DIR)
rebuild: clean all
-include $(OBJ:.o=.d)