-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
112 lines (86 loc) · 2.8 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
#-----------------------------------------------------------------------------
# On Linux, this should be 'Linux'
# On Mac OS X, this should be 'MAC_OS_X'
#-----------------------------------------------------------------------------
PLATFORM := $(shell uname -s)
MACHINE := $(shell uname -m)
ifeq ($(PLATFORM),Linux)
ifeq ($(MACHINE),x86_64)
PLATFORM := LINUX64
TARGETLIB = libACD2d.linux64.a
else
PLATFORM := LINUX
TARGETLIB = libACD2d.linux.a
endif
else
ifeq ($(PLATFORM),Darwin)
PLATFORM := MAC_OS_X
TARGETLIB = libACD2d.osx.a
else
PLATFORM := OTHER
TARGETLIB = libACD2d.a
endif
endif
#-----------------------------------------------------------------------------
# Choose a compiler & its options
#--------------------------------------------------------------------------
CXX = g++
LINK = g++
OPTS = -std=c++11 -MMD -W -O3 -Wno-deprecated -Wno-unused-parameter
#--------------------------------------------------------------------
# Xlib and OpenGL
#--------------------------------------------------------------------
ifeq ($(PLATFORM),MAC_OS_X)
GL_LIB = -framework OpenGL -framework GLUT -framework Foundation
else
X_LIB = -Wl,-rpath,/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/local/lib -lXext -lX11 -lXt
GL_LIB = -lglut -lGLU -lGL -lm
endif
#--------------------------------------------------------------------
# Triangulation
#--------------------------------------------------------------------
TRI_DIR = ./libs/FIST
TRI_INCL= -I${TRI_DIR}
TRI_LIB = -L${TRI_DIR}
ifeq ($(PLATFORM),MAC_OS_X)
TRI_LIB += -lFIST.osx
else
ifeq ($(PLATFORM),LINUX64)
TRI_LIB += -lFIST.linux64
else
TRI_LIB += -lFIST.linux
endif
endif
#--------------------------------------------------------------------
# Put all together
#--------------------------------------------------------------------
TARGET = acd2d_gui
SUBDIRS = . src src/mathtool src/hull src/edge_visibility
GUIS = gui gui/GL
INCLUDE = $(addprefix -I,$(SUBDIRS)) $(addprefix -I,$(GUIS)) $(TRI_INCL)
SRCS=$(wildcard $(addsuffix /*.cpp,$(SUBDIRS)))
OBJS=${SRCS:.cpp=.o}
GUI_SRCS=$(wildcard $(addsuffix /*.cpp,$(GUIS)))
GUI_OBJS=${GUI_SRCS:.cpp=.o}
LIB = $(X_LIB) $(GL_LIB) $(TRI_LIB)
CFLAGS = $(OPTS) $(INCLUDE)
CXXFLAGS = $(CFLAGS)
.PHONY: all
all : $(TARGET)
#--------------------------------------------------------------------
#--------------------------------------------------------------------
$(TARGET): $(OBJS) $(GUI_OBJS)
${CXX} ${CXXFLAGS} -o $@ $(OBJS) $(GUI_OBJS) $(LIB)
lib: $(OBJS)
ar rcs $(TARGETLIB) $(OBJS)
clean:
-rm -f $(OBJS) $(GUI_OBJS) $(TARGET) Dependencies $(TARGETLIB)
#--------------------------------------------------------------------
.SUFFIXES: .cpp
.cpp.o:
${CXX} ${CXXFLAGS} -c $< -o $@
cat $*.d >> Dependencies
rm -f $*.d
Dependencies:
touch Dependencies
include Dependencies