-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
44 lines (38 loc) · 1.44 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
#please use 'make clean' to clean the directory of intermediate build files and the executable
#simply typing 'make' will compile all source code files to object files .o, and then link all
#object files into an executable
#we are using a lot of makefile macros
#changing platform dependant stuff, do not change this
# Linux (default)
LDFLAGS = -lGL -lGLU -lglut
CFLAGS=-g -Wall -std=c++11
CXXFLAGS=-g -Wall -std=c++11
CC=g++
EXEEXT=
RM=rm
# Windows (cygwin)
ifeq "$(OS)" "Windows_NT"
EXEEXT=.exe #on windows applications must have .exe extension
RM=del #rm command for windows powershell
LDFLAGS = -lfreeglut -lglu32 -lopengl32
else
# OS X
OS := $(shell uname)
ifeq ($(OS), Darwin)
LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT
endif
endif
#change the 't1' name to the name you want to call your application
PROGRAM_NAME=Terrain
#run target to compile and build, and then launch the executable
run: $(PROGRAM_NAME)
./$(PROGRAM_NAME)$(EXEEXT) 50 50
#when adding additional source files, such as boilerplateClass.cpp
#or yourFile.cpp, add the filename with an object extension below
#ie. boilerplateClass.o and yourFile.o
#make will automatically know that the objectfile needs to be compiled
#form a cpp source file and find it itself :)
$(PROGRAM_NAME): a4.o mathLib3D.o camera.o light.o material.o PPM.o
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
clean:
$(RM) *.o $(PROGRAM_NAME)$(EXEEXT)