Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /trunk/Makefile.conf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1936 - (show annotations) (download)
Sat Sep 23 14:34:15 2017 UTC (7 years, 5 months ago) by amb
File size: 3950 byte(s)
Add make options to compile with clang instead of gcc, without
fast-maths or with the gcc (or clang) sanitizer without editing
Makefile.conf.

1 # Configuration Makefile
2 #
3 # Part of the Routino routing software.
4 #
5 # This file Copyright 2013-2015, 2017 Andrew M. Bishop
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
16 #
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 # Automatic operating system detection
22
23 UNAME=$(shell uname)
24
25 HOST=UNIX
26
27 ifneq ($(findstring CYGWIN,$(UNAME)),)
28 HOST=CYGWIN
29 endif
30
31 ifneq ($(findstring MINGW,$(UNAME)),)
32 HOST=MINGW
33 endif
34
35
36 # Simplify handling of executable targets ending in .exe
37
38 ifeq ($(HOST),MINGW)
39 .EXE=.exe
40 else
41 .EXE=
42 endif
43
44
45 # Installation locations (edit if required)
46
47 ifneq ($(HOST),MINGW)
48 prefix=/usr/local
49 bindir=$(prefix)/bin
50 incdir=$(prefix)/include
51 libdir=$(prefix)/lib
52 docdir=$(prefix)/doc/routino
53 datadir=$(prefix)/share/routino
54 else
55 prefix="c:/Program Files/Routino"
56 bindir=$(prefix)/bin
57 incdir=$(prefix)/include
58 libdir=$(prefix)/lib
59 docdir=$(prefix)/doc
60 datadir=$(prefix)/xml
61 endif
62
63
64 # Library version for ABI compatibility
65 SOVERSION=0
66
67 # Full library version (SOVERSION.MINOR[.RELEASE])
68 LIBVERSION=$(SOVERSION).0.0
69
70
71 # Compilation programs
72 CC=gcc
73 LD=gcc
74
75 ifdef CLANG
76 ifeq ($(CLANG),1)
77 CC=clang-5.0
78 LD=clang-5.0
79 endif
80 endif
81
82 # Maths library
83 LDFLAGS=-lm
84
85 # Language dialect selection
86 CFLAGS=-std=c99
87
88 # Warning options
89 CFLAGS+=-Wall -Wmissing-prototypes -Wextra -Wno-unused-parameter -pedantic
90
91 ifdef CLANG
92 ifeq ($(CLANG),1)
93 CFLAGS+=-Wno-missing-field-initializers
94 endif
95 endif
96
97 # Optimisation options
98 CFLAGS+=-O3
99
100 # Fast maths option - makes test cases fail slightly
101 CFLAGS+=-ffast-math
102 ifdef FASTMATHS
103 ifeq ($(FASTMATHS),0)
104 CFLAGS+=-fno-fast-math
105 endif
106 endif
107
108 # Optimisation option (only works if compilation and execution use exactly the same CPU architecture).
109 #CFLAGS+=-march=native
110
111 # Compile with debugging symbols
112 CFLAGS+=-g
113
114 # Option for compiling with sanitizer for debugging memory addresses and undefined behaviour
115 ifdef SANITIZE
116 ifeq ($(SANITIZE),1)
117 CFLAGS+=-fsanitize=address -fsanitize=leak -fsanitize=undefined
118 LDFLAGS+=-fsanitize=address -fsanitize=leak -fsanitize=undefined
119 endif
120 endif
121
122 # Extra flags for compiling libroutino shared library (visibility of symbols, shared)
123 CFLAGS_LIB=-fvisibility=hidden
124 LDFLAGS_LIB=-shared
125
126 ifeq ($(HOST),UNIX)
127 # Extra flags for compiling libroutino shared library (position independent code)
128 CFLAGS_LIB+=-fPIC
129 LDFLAGS_LIB+=-fPIC
130 endif
131
132 ifeq ($(HOST),UNIX)
133 # Extra flags for compiling libroutino shared library (SONAME)
134 LDFLAGS_SONAME=-Wl,-soname=libroutino.so.$(SOVERSION)
135 LDFLAGS_SLIM_SONAME=-Wl,-soname=libroutino-slim.so.$(SOVERSION)
136 endif
137
138 # Put the current directory in the shared library path for the router using libroutino
139 LDFLAGS_LDSO=-Wl,-R.
140
141
142 # Required for multi-threaded support (comment these two lines out if not required)
143 CFLAGS+=-pthread -DUSE_PTHREADS
144 LDFLAGS+=-pthread -lpthread
145
146
147 ifneq ($(HOST),MINGW)
148 # Required for bzip2 support (comment these two lines out if not required)
149 CFLAGS+=-DUSE_BZIP2
150 LDFLAGS+=-lbz2
151 endif
152
153
154 # Required for gzip support (comment these two lines out if not required)
155 CFLAGS+=-DUSE_GZIP
156 LDFLAGS+=-lz
157
158
159 # Required for xz support (uncomment these two lines if required)
160 #CFLAGS+=-DUSE_XZ
161 #LDFLAGS+=-llzma
162
163
164 # Required to use stdio with files > 2GiB on 32-bit system.
165 CFLAGS+=-D_FILE_OFFSET_BITS=64
166
167
168 ifneq ($(HOST),MINGW)
169 # Required to compile on Linux without a warning about pread() and pwrite() functions.
170 CFLAGS+=-D_POSIX_C_SOURCE=200809L
171 endif