-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
50 lines (38 loc) · 1.61 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
#Compiler: g++
CXX = g++
#Include directories (for headers): standard include dirs in /usr and /usr/local, and our helper directory.
INCLUDEDIR = -I/usr/include/ -I/usr/local/include/ -Isrc/helpers/
#Libraries needed: OpenGL, GLEW and glfw3. glfw3 requires Cocoa, IOKit and CoreVideo.
LIBS = -framework OpenGL -lGLEW -lglfw3 -framework Cocoa -framework IOKit -framework CoreVideo
#Compiler flags: compile, we use the C++11 standard, and display 'all' warnings.
COMPFLAGS = -c -std=c++11 -Wall
#Build directory
BUILDDIR = build
#Source directory
SRCDIR = src
#Paths to the source files
SOURCES = main.cpp Renderer.cpp Framebuffer.cpp ScreenQuad.cpp Weyr.cpp Skybox.cpp Light.cpp camera/Camera.cpp camera/Keyboard.cpp helpers/ProgramUtilities.cpp helpers/MeshUtilities.cpp helpers/lodepng/lodepng.cpp
#Paths to the objects files (generated from the sources)
OBJECTS = $(SOURCES:%.cpp=$(BUILDDIR)/%.o)
#Executable name
EXECNAME = gldragons
#Re-create the build dir if needed, compile and link.
all: dirs $(OBJECTS) $(EXECNAME)
#Linking phase: combine all objects files to generate the executable
$(EXECNAME): $(OBJECTS)
$(CXX) $(OBJECTS) $(LIBS) -o $(BUILDDIR)/$(EXECNAME)
@echo "\nCompilation finished."
#Compiling phase: generate the object files from the source files
$(BUILDDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) $(COMPFLAGS) $(INCLUDEDIR) $< -o $@
#Run the executable
run:
@./$(BUILDDIR)/$(EXECNAME) object.obj object_texture_color.png
#Create the build directory and its subdirectories
dirs:
@mkdir -p $(BUILDDIR)/helpers/lodepng
@mkdir -p $(BUILDDIR)/camera
#Remove the whole build directory
.PHONY: clean
clean :
rm -r $(BUILDDIR)