This repository has been archived by the owner on May 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (48 loc) · 1.45 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
# Shell path
SHELL = /bin/bash
# Output directory
OUT_DIR = ./build
# Executeable directory
BIN_DIR = ./bin
# Source code directory
SRC_DIR = ./src
# Compiler
CXX = g++
# Compiler flags
CXXFLAGS += -Wall -MMD -MP
# Additional flags
LDFLAGS = -lcurses
# Final executable name
EXEC = bombescape
# Get all source codes
SRC = $(shell find $(SRC_DIR) -name '*.cpp')
# Object codes
OBJ = $(SRC:%.cpp=$(OUT_DIR)/%.o)
# Substitutes ".o" with ".d" for dependency files
DEP = ${OBJ:.o=.d}
all: $(BIN_DIR)/$(EXEC)
# Make the final executable
$(BIN_DIR)/$(EXEC): $(OBJ)
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
# Make all object codes
$(OUT_DIR)/%.o: %.cpp
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $^ -o $@ -c
clean:
rm -rf $(OUT_DIR)
.PHONY: clean all
proto: test/game_prototype.cpp src/time_utils.h
mkdir -p $(OUT_DIR)
$(CXX) $^ -o $(OUT_DIR)/[email protected] -lcurses
maptest: test/map_test.cpp src/entity.cpp src/map_gen.cpp src/playfield.cpp src/player.cpp src/gamestate.cpp src/render.cpp
mkdir -p $(OUT_DIR)
$(CXX) -g $^ -o $(OUT_DIR)/[email protected] -lcurses
mainmenu: src/init_window.cpp src/menu.cpp test/main_menu.cpp
mkdir -p $(OUT_DIR)
$(CXX) -g $^ -o $(OUT_DIR)/[email protected] -lncurses
hudtest: test/hud_test.cpp src/interface.cpp src/init_window.cpp src/entity.cpp src/map_gen.cpp src/playfield.cpp src/player.cpp src/gamestate.cpp src/render.cpp
mkdir -p $(OUT_DIR)
$(CXX) -g $^ -o $(OUT_DIR)/[email protected] -lncurses
# Include all G++-generated makefiles
-include ${DEP}