-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathMakefile_linux_shared
More file actions
135 lines (102 loc) · 3.31 KB
/
Makefile_linux_shared
File metadata and controls
135 lines (102 loc) · 3.31 KB
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
# --------------------- INFORMATION --------------------------------
# This the DDS Makefile for Linux and the GNU g++ compiler.
# It creates a dynamically linked (shared) library, libdds.so.
# --------------------- CONFIGURATION ------------------------------
# You can configure the following:
# 1. The threading systems that you want in the library.
# You will always get single-threading. If you have multiple
# threading systems, the default will be the multi-threading one
# with the lowest number (see System.cpp). All that matters is
# CC_THREADING.
# GCD and WINAPI don't work on Windows.
THR_BOOST = -DDDS_THREADS_BOOST
THR_GCD = -DDDS_THREADS_GCD
THR_OPENMP = -DDDS_THREADS_OPENMP
THR_WINAPI = -DDDS_THREADS_WINAPI
THR_STL = -DDDS_THREADS_STL
THREADING = $(THR_BOOST) $(THR_OPENMP) $(THR_STL)
# If you need to add something for a threading system, this is
# the place.
CC_BOOST_LINK = -lboost_system -lboost_thread
THREAD_COMPILE = -fopenmp
THREAD_LINK = -fopenmp $(CC_BOOST_LINK)
# 2. Debugging options. (There are more granular options in debug.h.)
DEBUG_ALL = -DDDS_DEBUG_ALL
TIMING = -DDDS_TIMING
SCHEDULER = -DDDS_SCHEDULER
# All that matters from no. 2 and no. 3 is the following. Here you
# can add $(SMALL_MEMORY) etc.
DDS_BEHAVIOR =
# ----------------------- OFTEN OK ------------------------------
# From here on you you don't have to change anything to CONFIGURE
# the compilation. But you may well have to change something to
# get it to compile.
INCL_SOURCE = Makefiles/sources.txt
INCL_DEPENDS = Makefiles/depends_o.txt
# If your compiler name is not given here, change it.
CC = g++
# We compile with aggressive warnings, but we have to turn off some
# of them as they appear in libraries in great numbers...
WARN_FLAGS = \
-Wshadow \
-Wsign-conversion \
-pedantic -Wall -Wextra \
-Wcast-align -Wcast-qual \
-Wctor-dtor-privacy \
-Wdisabled-optimization \
-Winit-self \
-Wlogical-op \
-Wmissing-declarations \
-Wmissing-include-dirs \
-Wnoexcept \
-Wold-style-cast \
-Woverloaded-virtual \
-Wredundant-decls \
-Wsign-promo \
-Wstrict-null-sentinel \
-Wstrict-overflow=1 \
-Wswitch-default -Wundef \
-Werror \
-Wno-unused \
-Wno-unknown-pragmas \
-Wno-long-long \
-Wno-format
# SANITIZE_FLAGS = \
# -fsanitize=address \
# -fsanitize=bounds \
# -fsanitize=object-size \
# -fno-omit-frame-pointer
SANITIZE_FLAGS =
COMPILE_FLAGS = -fPIC -O3 -flto -fopenmp -mtune=generic -std=c++11 \
$(WARN_FLAGS) \
$(DDS_BEHAVIOR) $(THREAD_COMPILE) $(THREADING) \
$(SANITIZE_FLAGS)
DLLBASE = dds
SHARED_LIB = lib$(DLLBASE).so
include $(INCL_SOURCE)
O_FILES = $(subst .cpp,.o,$(SOURCE_FILES))
LINK_FLAGS = \
-shared \
-Wl,-O2 \
-Wl,--sort-common \
-Wl,--as-needed \
-Wl,-z \
-Wl,relro \
$(THREAD_LINK) \
-fPIC \
$(SANITIZE_FLAGS)
linux: $(O_FILES)
$(CC) \
-o $(SHARED_LIB) $(O_FILES) $(LINK_FLAGS)
%.o: %.cpp
$(CC) $(COMPILE_FLAGS) -c $<
depend:
makedepend -Y -- $(SOURCE_FILES)
clean:
rm -f $(O_FILES) $(SHARED_LIB)
install:
test -d ../test || mkdir ../test
test -d ../examples || mkdir ../examples
cp $(STATIC_LIB) ../test
cp $(STATIC_LIB) ../examples
include $(INCL_DEPENDS)