-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.linux
52 lines (41 loc) · 1.78 KB
/
Makefile.linux
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
#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/
#Library directory (just in case)
#You might have to symlink libGLEW in your standard libdir for use at runtime
LIBDIR = -L/usr/local/lib
#Libraries needed: OpenGL, GLEW and glfw3. GLEW requires GLU, glfw3 require X11, Xi, and so on...
LIBS = -lGLEW -lglfw3 -lGL -lGLU -lX11 -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -lm -pthread -ldl
#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) $(LIBDIR) $(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)