-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
236 lines (194 loc) · 7.75 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
###########################################################################
## ##
## This is a makefile for a simple OpenGL program. ##
## ##
## Usage: ##
## "make" -> Compiles an optimized version of the executable. ##
## "make debug" -> Compiles a debug version of the executable. ##
## "make clean" -> Removes all temporary & executable files. ##
## ##
## ##
## Chris Wyman (January 29, 2008) ##
###########################################################################
# This sets the name of your compiled program
EXENAME = glFramework
###########################################################################
## ##
## To add additional files to be compiled, add them to the list of files ##
## in the correct directory. If you change the name of the directory, ##
## make sure you change it here! If you move the location of a file, ##
## make sure you change it here. If you add a new directory, make ##
## sure to add information about it here. ##
## ##
###########################################################################
# The directories for various file types
UTILDIR = Utils/
SCNDIR = Scene/
MATLDIR = Materials/
DATADIR = DataTypes/
UIDIR = Interface/
OBJSDIR = Objects/
RNDRDIR = RenderingTechniques/
IMIODIR = Utils/ImageIO/
MDIODIR = Utils/ModelIO/
SMLDIR = Utils/ModelIO/simpleModelLib/
# These should be located in $(UTILDIR)
UTILSRC = drawTextToGLWindow.cpp \
TextParsing.cpp \
Trackball.cpp \
frameGrab.cpp \
frameRate.cpp \
framebufferObject.cpp \
glslProgram.cpp \
searchPathList.cpp
# These should be located in $(IMIODIR)
IMIOSRC = bmp.cpp \
loadHDR.cpp \
ppm.cpp \
readrgb.cpp \
rgbe.cpp
# These should be located in $(MDIODIR)
MDIOSRC = glm.cpp
# These should be located in $(SMLDIR)
SMLSRC = edge.cpp \
edgelist.cpp \
face.cpp \
facelist.cpp \
halfedge.cpp \
heapsort.cpp \
input_hem.cpp \
list.cpp \
loop.cpp \
obj_read.cpp \
output_hem.cpp \
solid.cpp \
vertex.cpp \
vertexlist.cpp \
wrapper.cpp
# These should be located in $(SCNDIR)
SCNSRC = Camera.cpp \
Scene.cpp \
SceneRenderFuncs.cpp \
glLight.cpp
# These should be located in $(MATLDIR)
MATLSRC = GLConstantMaterial.cpp \
GLLambertianMaterial.cpp \
GLLambertianTexMaterial.cpp \
GLMaterial.cpp \
GLSLShaderMaterial.cpp
# These should be located in $(DATADIR)
DATASRC = Matrix4x4.cpp \
RGBColor.cpp \
Vector.cpp \
glTexture.cpp
# These should be located in $(UIDIR)
UISRC = SceneFileDefinedInteraction.cpp \
glKeyAndMouseCallbacks.cpp \
glTrackballInterface.cpp
# These should be located in $(OBJSDIR)
OBJSSRC = Cylinder.cpp \
Group.cpp \
Mesh.cpp \
Object.cpp \
Quad.cpp \
Sphere.cpp \
Triangle.cpp
# These should be located in $(RNDRDIR)
RNDRSRC = initializeRenderingData.cpp \
utilRoutines.cpp
# These should be located in the root directory (with the makefile)
MAINSRC = sceneLoader.cpp \
glInterface.cpp \
reflect.cpp \
silhouette.cpp \
gooch.cpp \
selection.cpp \
extras.cpp
###########################################################################
## ##
## If you just add files to existing directories, you should not need to ##
## modify anything below! ##
## ##
## To add additional (new) directories, you need to do 4 things: ##
## 1) Create a variable, above, to describe the path (e.g., ##
## "COREDIR = Core/") ##
## 2) Create a variable, above, that includes a list of files in that ##
## directory. ##
## 3) Add your directory variable to the list of directories in ##
## "VPATH = ..." below. ##
## 4) Add another line to the SRC variable below of the form: ##
## $(addprefix $(newDirVar), $(newSrcVar)) ##
## ##
###########################################################################
# A color-separated list, e.g., $(UTILDIR):$(COREDIR):$(ANOTHERDIR)
VPATH = $(UTILDIR):$(SCNDIR):$(MATLDIR):$(DATADIR):$(UIDIR):$(OBJSDIR):$(RNDRDIR):$(IMIODIR):$(MDIODIR):$(SMLDIR)
# A list of all the src files from various directories, prepended with
# their relative directory path. If you add additional lines, make
# sure you add a '\' to the end of all lines except the last!
SRC = $(MAINSRC) \
$(addprefix $(UTILDIR),$(UTILSRC)) \
$(addprefix $(SCNDIR),$(SCNSRC)) \
$(addprefix $(MATLDIR),$(MATLSRC)) \
$(addprefix $(DATADIR),$(DATASRC)) \
$(addprefix $(UIDIR),$(UISRC)) \
$(addprefix $(OBJSDIR),$(OBJSSRC)) \
$(addprefix $(RNDRDIR),$(RNDRSRC)) \
$(addprefix $(IMIODIR),$(IMIOSRC)) \
$(addprefix $(MDIODIR),$(MDIOSRC)) \
$(addprefix $(SMLDIR),$(SMLSRC))
###########################################################################
## ##
## You shouldn't need to change anything below, unless you want to ##
## change where compiled files are stored, or you want to change the ##
## name of the name of the executable, or if you want to change the ##
## compilation flags or linked libraries. ##
## ##
###########################################################################
# Is this a debug compile or not?
# This can be set to ON using "make DEBUG=ON"
DEBUG = OFF
# The C++ compiler
CC = g++
# The directory to hold the generated executable
BINDIR = bin/
# The name of the executables (in case of optimized and debug compiles)
OPTEXE = $(EXENAME)
DBGEXE = $(EXENAME).debug
# Directories to search for includes and libraries
INCLUDES = -I. -I /usr/X11R6/include/ -I /group/graphics/include/
# Set the Flags passed to the compiler & linker.
# In the first case, we use optimizations. If debugging is on,
# we do not use optimizations, and we enable the profiler.
ifeq "$(DEBUG)" "OFF"
LDFLAGS = -L /usr/X11R6/lib64/ -L /usr/X11R6/lib/ -L /group/graphics/lib/
CCFLAGS = -O3
EXE = $(OPTEXE)
else
LDFLAGS = -pg -L /usr/X11R6/lib64/ -L /usr/X11R6/lib/ -L /group/graphics/lib/
CCFLAGS = -g -pg -DDEBUG
EXE = $(DBGEXE)
endif
# The linked libraries
LIBS = -lGLEW -lglut -lGL -lGLU -lX11 -lXmu -lXi -lm -lrt
# A list of objects (replace .cpp with .o)
OBJS = $(SRC:.cpp=.o)
# A list of all the objects w/o their relative directory names
BASEOBJ = $(notdir $(OBJS))
# A list of the .o files, which are stored in obj/optimized/ or obj/debug/
ifeq "$(DEBUG)" "OFF"
FINALOBJ = $(addprefix bin/obj/optimized/,$(BASEOBJ))
else
FINALOBJ = $(addprefix bin/obj/debug/,$(BASEOBJ))
endif
# The default make rule
default: $(SRC) $(EXE)
debug:
make DEBUG=ON
$(EXE): $(FINALOBJ)
$(CC) $(LDFLAGS) $(PROFILE) $(FINALOBJ) $(LIBS) -o $(BINDIR)$@
bin/obj/optimized/%.o: %.cpp
$(CC) -c $(CCFLAGS) $(INCLUDES) $< -o $@
bin/obj/debug/%.o: %.cpp
$(CC) -c $(CCFLAGS) $(INCLUDES) $< -o $@
clean:
rm -f $(addprefix bin/obj/optimized/,$(BASEOBJ)) $(addprefix bin/obj/debug/,$(BASEOBJ)) $(BINDIR)$(OPTEXE) $(BINDIR)$(DBGEXE)