-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
135 lines (121 loc) · 4.25 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
#makefile for Jenn3d
####### switch this to whatever is appropriate for your platform ##############
#COMPILE_TYPE = mac
#COMPILE_TYPE = mac_debug
#Note: CYGWIN now is synonim for MinGW
#COMPILE_TYPE = cygwin
COMPILE_TYPE = linux
#COMPILE_TYPE = debug
#COMPILE_TYPE = profile
#COMPILE_TYPE = devel
#### if you have libpng installed, uncomment this:
#HAVE_PNG = false
HAVE_PNG = true
######## leave everything else the same #######################################
#OPT = -O3 -funroll-loops -pipe
OPT = -O3 -ffast-math -fomit-frame-pointer -funroll-loops -pipe -s
#OPT = -O3 -m32 -march=prescott -malign-double -mfpmath=sse -ffast-math -fomit-frame-pointer -funroll-loops -fprefetch-loop-arrays -ftree-vectorize -fno-exceptions -fno-check-new -pipe
WARNINGS = -Wall -Wextra -Werror -Wno-unused
#opengl stuff
GL_LINUX = -lglut -lGLU -lGL
GL_MAC = -framework OpenGL -framework Glut
GL_CYGWIN = -lglut32 -lglu32 -lopengl32
#png stuff
ifdef HAVE_PNG
PNG_LINUX = -lpng
PNG_MAC = -L/sw/lib -L/usr/X11/lib -lpng -lz
PNG_CYGWIN = -L/usr/lib -lpng -lz
USR_CAPT = -DCAPTURE=4
DEV_CAPT = -DCAPTURE=24
else
PNG_LINUX =
PNG_MAC =
PNG_CYGWIN =
USER_CAPT =
DEVEL_CAPT =
endif
#compiler flags
ifeq ($(COMPILE_TYPE), mac)
CC = clang++
CXX = clang++
CPPFLAGS = -I/sw/include -I/usr/X11/include -DDEBUG_LEVEL=0 -DMAC_HACKS $(USR_CAPT)
CXXFLAGS = $(OPT) -I/sw/include -I/usr/X11/include -stdlib=libc++
LDFLAGS = $(OPT) -L/sw/libs -L/usr/X11/lib -stdlib=libc++ -static
LIBS = $(GL_MAC) $(PNG_MAC)
endif
ifeq ($(COMPILE_TYPE), mac_debug)
CC = clang++
CXX = clang++
CPPFLAGS = -I/sw/include -I/usr/X11/include -DDEBUG_LEVEL=2 -DMAC_HACKS $(USR_CAPT)
CXXFLAGS = -I/sw/include -I/usr/X11/include -stdlib=libc++ -ggdb
LDFLAGS = -L/sw/lib -L/usr/X11/lib -stdlib=libc++ -rdynamic -ggdb
LIBS = $(GL_MAC) $(PNG_MAC)
endif
ifeq ($(COMPILE_TYPE), cygwin)
CC = g++
CXX = g++
CPPFLAGS = -I/usr/include -DDEBUG_LEVEL=0 -DCYGWIN_HACKS $(USR_CAPT)
CXXFLAGS = $(OPT) -I/usr/include
LDFLAGS = $(OPT) -L/usr/lib
LIBS = $(GL_CYGWIN) $(PNG_CYGWIN)
endif
ifeq ($(COMPILE_TYPE), linux)
CC = g++
CXX = g++
CPPFLAGS = -DDEBUG_LEVEL=0 $(USR_CAPT)
CXXFLAGS = $(OPT)
LDFLAGS = $(OPT)
LIBS = $(GL_LINUX) $(PNG_LINUX)
endif
ifeq ($(COMPILE_TYPE), debug)
CC = g++
CXX = g++
CPPFLAGS = -DDEBUG_LEVEL=2 $(DEV_CAPT)
CXXFLAGS = $(WARNINGS) -ggdb
LDFLAGS = -rdynamic -ggdb
LIBS = $(GL_LINUX) $(PNG_LINUX)
endif
ifeq ($(COMPILE_TYPE), profile)
CC = g++
CXX = g++
CPPFLAGS = -DDEBUG_LEVEL=0 $(DEV_CAPT)
CXXFLAGS = -O2 -pg -ftest-coverage -fprofile-arcs
LDFLAGS = -O2 -pg -ftest-coverage -fprofile-arcs
LIBS = $(GL_LINUX) $(PNG_LINUX)
endif
ifeq ($(COMPILE_TYPE), devel)
CC = g++
CXX = g++
CPPFLAGS = -DDEBUG_LEVEL=0 $(DEV_CAPT)
CXXFLAGS = $(OPT)
LDFLAGS = $(OPT)
LIBS = $(GL_LINUX) $(PNG_LINUX)
endif
#default target
all: jenn
#modules
definitions.o: definitions.C definitions.h
linalg.o: linalg.C linalg.h definitions.h
todd_coxeter.o: todd_coxeter.C todd_coxeter.h linalg.h definitions.h
go_game.o: go_game.C go_game.h linalg.h todd_coxeter.h definitions.h
drawing.o: drawing.C drawing.h linalg.h go_game.h aligned_vect.h definitions.h
trail.o: trail.C trail.h linalg.h aligned_vect.h definitions.h
animation.o: animation.C animation.h linalg.h definitions.h
projection.o: projection.C projection.h animation.h drawing.h trail.h linalg.h definitions.h
polytopes.o: polytopes.C polytopes.h projection.h animation.h drawing.h definitions.h
menus.o: menus.C menus.h main.h polytopes.h projection.h animation.h drawing.h definitions.h
aligned_alloc.o: aligned_alloc.C aligned_alloc.h
#final product
MAIN_O = main.o linalg.o menus.o todd_coxeter.o go_game.o polytopes.o animation.o projection.o drawing.o trail.o aligned_alloc.o definitions.o
main.o: main.C main.h linalg.h menus.h go_game.h trail.h polytopes.h drawing.h animation.h projection.h definitions.h
jenn: $(MAIN_O)
$(CC) $(CXXFLAGS) -o jenn $(MAIN_O) $(LIBS)
profile: jenn
./jenn -c 5 2 2 3 2 3 -v 3 -e 0 1 2 -f 02 03 12 13
gcov drawing.C
gprof -l -b jenn > jenn.prof
gvim jenn.prof &
test: test.C
$(CC) -o test test.C $(LIBS)
clean:
rm -f core *.o jenn temp.* *.prof *.gcov *.da *.bb *.bbg gmon.out jenn_capture.png jenn_export.stl