-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
35 lines (29 loc) · 853 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
#-----[Makefile]------
#$@ Contains the target file name
#$< Contains the first dependency name
#=====================
#----[Directories]----
oPath = obj
sPath = src
iPath = include
#====================
#---[Compiler and Settings]-----
compiler = g++
compilerFlags = -std=c++11 -O3
paths = -I./$(iPath)
#======================
#----[Variable Names]-------
headers = $(wildcard $(iPath)/*.hpp)
sources = $(wildcard $(sPath)/*.cpp)
objects = $(subst $(sPath)/,$(oPath)/,$(sources:.cpp=.o))
#==========================
#----[Compilation]---------
main:$(objects) $(headers) main.cpp
$(compiler) $(compilerFlags) -o main $(objects) main.cpp $(paths)
$(oPath)/%.o:$(sPath)/%.cpp $(subst $(sPath)/, $(iPath)/,$(<:.cpp=.hpp))
@mkdir -p $(@D)
$(compiler) $(compilerFlags) -o $@ -c $(paths) $<
#-----[Clean up]-------
clean:
rm main
rm -rf $(oPath)/