-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
110 lines (90 loc) · 3.01 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
#
# 'make' build executable file
# 'make clean' removes all .o and executable files
#
# Executables to build
#SDLEXEC += viewer
#SDLEXEC += subgraph
#SDLEXEC += mass_spring
#SDLEXEC += shallow_water_ext
#SDLEXEC += test_nodes
#SDLEXEC += test_edges
#SDLEXEC += test
#SDLEXEC += viewer
#SDLEXEC += subgraph
#SDLEXEC += shortest_path
#SDLEXEC += mass_spring
#SDLEXEC += poisson
#SDLEXEC += shallow_water
SDLEXEC += combine
#SDLEXEC += testMlpack
#SDLEXEC += testMlpack2
SDLEXEC += testMlpack3
SDLEXEC += combine
#SDLEXEC += testOpenMP
#SDLEXEC += OPENMPshallow
#SDLEXEC += OPENMPshallow2
#SDLEXEC += openmp_mass_spring
# Get the shell name to determine the OS
UNAME := $(shell uname)
# Define the C++ compiler to use
CXX := $(shell which g++) -std=gnu++0x
ifeq ($(UNAME), Darwin)
CC := $(shell which gcc) -O3
SDLOBJS := CS207/SDLMain.o
endif
# Dependency directory and flags
DEPSDIR := $(shell mkdir -p .deps; echo .deps)
# MD: Dependency as side-effect of compilation
# MF: File for output
# MP: Include phony targets
DEPSFILE = $(DEPSDIR)/$(notdir $*.d)
DEPSFLAGS = -MD -MF $(DEPSFILE) #-MP
# Define any directories containing header files
# To include directories use -Ipath/to/files
#INCLUDES += -I.
INCLUDES += -I.-I/usr/include -I/usr/include/libxml2 #added
#INCLUDES += -I ./mlpack-1.0.8/build/include #added
INCLUDES += -I./mlpack-1.0.8/include #added
INCLUDES += -I./home/mingzhu/CS207Final/Mesh_final/mlpack-1.0.8/include
# Define CXX compile flags
CXXFLAGS += -fopenmp -funroll-loops -O3 -W -Wall -Wextra #-Wfatal-errors
# Define any directories containing libraries
# To include directories use -Lpath/to/files
LDFLAGS += -L./mlpack-1.0.8/build/lib
LDFLAGS += -L./mlpack-1.0.8/lib
LDFLAGS += -L./home/mingzhu/CS207Final/Mesh_final/mlpack-1.0.8/lib
# Define any libraries to link into executable
# To link in libraries (libXXX.so or libXXX.a) use -lXXX
ifeq ($(UNAME), Linux)
LDLIBS += -lSDL -lGL -lGLU -lmlpack
endif
ifeq ($(UNAME), Darwin)
LDLIBS += -framework SDL -framework OpenGL -framework Cocoa -lmlpack
endif
##################
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
##################
# 'make' - default rule
all: $(EXEC) $(SDLEXEC)
# Default rule for creating an exec of $(EXEC) from a .o file
$(EXEC): % : %.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
# Default rule for creating an exec of $(EXEC) from a .o file
$(SDLEXEC): % : %.o $(SDLOBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
# Default rule for creating a .o file from a .cpp file
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEPSFLAGS) -c -o $@ $<
# Extra dependencies for executables
# Nothing here
# 'make clean' - deletes all .o files, exec, and dependency files
clean:
-$(RM) *.o $(EXEC) $(SDLEXEC) $(SDLOBJS)
$(RM) -r $(DEPSDIR)
# Define rules that do not actually generate the corresponding file
.PHONY: clean all
# Include the dependency files
-include $(wildcard $(DEPSDIR)/*.d)