-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathMakefile
144 lines (118 loc) · 3.78 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
# get the type of OS currently running
OS=$(shell uname -s)
PWD=$(shell pwd)
INC = -I./src -I./include
LIBS = -L./lib -lClothoids
DEFS =
STATIC_EXT = .a
DYNAMIC_EXT = .so
AR = ar rcs
LDCONFIG = sudo ldconfig
WARN=-Wall -Wno-sign-compare
#-Weverything -Wno-global-constructors -Wno-padded -Wno-documentation-unknown-command
# default values
# check if the OS string contains 'Linux'
ifneq (,$(findstring Linux, $(OS)))
LIBS = -static -L./lib -lClothoids
CXXFLAGS = -std=c++11 $(WARN) -O3 -fPIC
AR = ar rcs
LDCONFIG = sudo ldconfig
endif
# check if the OS string contains 'MINGW'
ifneq (,$(findstring MINGW, $(OS)))
LIBS = -static -L./lib -lClothoids
CXXFLAGS = -std=c++11 $(WARN) -O3
AR = ar rcs
LDCONFIG = sudo ldconfig
endif
# check if the OS string contains 'Darwin'
ifneq (,$(findstring Darwin, $(OS)))
WARN = -Wall -Weverything -Wno-sign-compare -Wno-global-constructors -Wno-padded -Wno-documentation-unknown-command
LIBS = -L./lib -lClothoids
CXXFLAGS = $(WARN) -O3 -fPIC
AR = libtool -static -o
LDCONFIG =
DYNAMIC_EXT = .dylib
endif
LIB_CLOTHOID = libClothoids
SRCS = \
src/AABBtree.cc \
src/Biarc.cc \
src/Circle.cc \
src/Clothoid.cc \
src/ClothoidDistance.cc \
src/ClothoidG2.cc \
src/ClothoidList.cc \
src/CubicRootsFlocke.cc \
src/Fresnel.cc \
src/G2lib.cc \
src/Line.cc \
src/Triangle2D.cc \
src/PolyLine.cc
OBJS = $(SRCS:.cc=.o)
DEPS = src/Clothoid.hh src/CubicRootsFlocke.hh
MKDIR = mkdir -p
# prefix for installation, use make PREFIX=/new/prefix install
# to override
PREFIX = /usr/local
FRAMEWORK = Clothoids
all: bin
travis: bin
bin: lib
@$(MKDIR) bin
$(CXX) $(INC) $(CXXFLAGS) -o bin/testBiarc tests-cpp/testBiarc.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testDistance tests-cpp/testDistance.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testG2 tests-cpp/testG2.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testG2plot tests-cpp/testG2plot.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testG2stat tests-cpp/testG2stat.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testG2stat2arc tests-cpp/testG2stat2arc.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testG2statCLC tests-cpp/testG2statCLC.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testIntersect tests-cpp/testIntersect.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testPolyline tests-cpp/testPolyline.cc $(LIBS)
$(CXX) $(INC) $(CXXFLAGS) -o bin/testTriangle2D tests-cpp/testTriangle2D.cc $(LIBS)
lib: lib/$(LIB_CLOTHOID)$(STATIC_EXT) lib/$(LIB_CLOTHOID)$(DYNAMIC_EXT)
include_local:
@rm -rf lib/include
$(MKDIR) lib
$(MKDIR) lib/include
@cp -f src/*.hh lib/include
src/%.o: src/%.cc $(DEPS)
$(CXX) $(INC) $(CXXFLAGS) $(DEFS) -c $< -o $@
src/%.o: src/%.c $(DEPS)
$(CC) $(INC) $(CFLAGS) $(DEFS) -c -o $@ $<
lib/libClothoids.a: $(OBJS) include_local
@$(MKDIR) lib
$(AR) lib/libClothoids.a $(OBJS)
lib/libClothoids.dylib: $(OBJS) include_local
@$(MKDIR) lib
$(CXX) -shared -o lib/libClothoids.dylib $(OBJS)
lib/libClothoids.so: $(OBJS) include_local
@$(MKDIR) lib
$(CXX) -shared -o lib/libClothoids.so $(OBJS)
install: lib
@$(MKDIR) $(PREFIX)/lib
@$(MKDIR) $(PREFIX)/include
cp src/*.hh $(PREFIX)/include
cp lib/$(LIB_CLOTHOID).* $(PREFIX)/lib
@$(LDCONFIG) $(PREFIX)/lib
install_as_framework: lib
@$(MKDIR) $(PREFIX)/lib
@$(MKDIR) $(PREFIX)/include/$(FRAMEWORK)
cp src/*.hh $(PREFIX)/include/$(FRAMEWORK)
cp lib/$(LIB_CLOTHOID) $(PREFIX)/lib
run:
./bin/testBiarc
./bin/testDistance
./bin/testG2
./bin/testG2plot
./bin/testG2stat
./bin/testG2stat2arc
./bin/testG2statCLC
./bin/testIntersect
./bin/testPolyline
./bin/testTriangle2D
doc:
doxygen
clean:
rm -f lib/libClothoids.* lib/libClothoids.* src/*.o
rm -rf bin