-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (52 loc) · 1.66 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CXX := -g++
CXXFLAGS := -Wall -Wextra -pedantic-errors -Werror -Wno-unused-but-set-variable
# All these libraries are places under "C:\VSARM\mingw\lib" in case of being elsewhere, add path with -L
LDFLAGS := -lfreeglut -lopengl32 -lwinmm -lglu32 -lSDL2main -lSDL2 -llibSDL2_mixer -Wl,--subsystem,windows
BUILD := ./build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/apps
TARGET := plataformer
INCLUDE := \
-Ilib \
-Isrc/common/include \
-Isrc/domain/include \
-Isrc/plataformer/include
SRC := \
$(wildcard src/common/*.cpp) \
$(wildcard src/domain/*.cpp) \
$(wildcard src/plataformer/*.cpp) \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
DEPENDENCIES := $(OBJECTS:.o=.d)
all: build $(APP_DIR)/$(TARGET)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -MMD -o $@
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
-include $(DEPENDENCIES)
.PHONY: all build clean debug release info
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
@mkdir -p $(APP_DIR)/music/
@mkdir -p $(APP_DIR)/textures/
@mkdir -p $(APP_DIR)/models/
@mkdir -p $(APP_DIR)/sounds/
@cp ./bin/*.dll $(APP_DIR)
@cp ./music/*.mp3 $(APP_DIR)/music/
@cp ./textures/*.bmp $(APP_DIR)/textures/
@cp ./models/*.obj $(APP_DIR)/models/
@cp ./sounds/*.wav $(APP_DIR)/sounds/
debug: CXXFLAGS += -DDEBUG -g
debug: all
release: CXXFLAGS += -O2
release: all
clean:
-@rm -rvf $(BUILD)/*
info:
@echo "[*] Application dir: ${APP_DIR} "
@echo "[*] Object dir: ${OBJ_DIR} "
@echo "[*] Sources: ${SRC} "
@echo "[*] Objects: ${OBJECTS} "
@echo "[*] Dependencies: ${DEPENDENCIES}"