-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
98 lines (83 loc) · 1.73 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Author: Kristin Wood
# Project Name: 162 Final Project
# Date: 3/14/18
# Makefile based on example provided by TA Harlan James.
#
# Project Name
#
PROJ = FinalProject_Wood_Kristin
#
# Compiler
#
$(CXX) = g++
#
# Source Files
#
SRC = main.cpp
SRC += AbhorsenHouse.cpp
SRC += Belisaere.cpp
SRC += ClayrGlacier.cpp
SRC += Death.cpp
SRC += Game.cpp
SRC += isInt.cpp
SRC += Lirael.cpp
SRC += NorthernBorder.cpp
SRC += Space.cpp
SRC += Wall.cpp
#
# Create an object for each source file
#
OBJ = $(SRC:.cpp=.o)
#
# Output binary
#
BIN = $(PROJ).bin
#
# Compiler Flags
#
CFLAGS = -Wall -pedantic-errors -std=gnu++11
#
# Valgrind Options
#
VOPT = --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes
#
# Names of tags that aren't actually files.
#
.PHONY: default debug clean zip
#
# Default Behavior:
# 1. Remove everything to start from scratch
# 2. Compile the binary
# 3. Run it through valgrind for quicker debugging
#
default: clean $(BIN) debug
#
# Notice the dependency chain.
#
# Order assuming no files exist:
# 1. Each .o file
# 2. Binary
# 3. Valgrind
#
# Special Symbols:
# @ Suppresses the command from being printed to the terminal)
# $@ Name of tag
# $^ Name of dependency
debug: $(BIN)
@valgrind $(VOPT) ./$(BIN)
$(BIN): $(OBJ)
@echo "CC $@"
@$(CXX) $(CFLAGS) $^ -o $@
#
# % is a wildcard. Anything that ends in ".o" will match this tag, and each
# tag depends on the same matching wildcard, but ending in ".cpp"
#
%.o: %.cpp
@echo "CC $^"
@$(CXX) $(CFLAGS) -c $^
zip:
zip $(PROJ).zip *.cpp *.hpp makefile
clean: $(CLEAN)
@echo "RM *.o"
@echo "RM $(BIN)"
@rm -f *.o $(BIN)