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 1934 - (show annotations) (download)
Wed Sep 20 18:37:11 2017 UTC (7 years, 7 months ago) by amb
File size: 3754 byte(s)
Make it easier to compile with clang instead of gcc (use CLANG=1 option to 'make').
Suppress compiler warnings from clang 5.0.

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
78 LD=clang
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 CFLAGS+=-ffast-math
100
101 # Optimisation option (only works if compilation and execution use exactly the same CPU architecture).
102 #CFLAGS+=-march=native
103
104 # Debugging symbols
105 #CFLAGS+=-g
106
107 # Sanitizer for debugging memory addresses
108 #CFLAGS+=-fsanitize=address -fsanitize=leak
109 #LDFLAGS+=-fsanitize=address -fsanitize=leak
110
111 # Sanitizer for debugging undefined behaviour
112 #CFLAGS+=-fsanitize=undefined
113 #LDFLAGS+=-fsanitize=undefined
114
115
116 # Extra flags for compiling libroutino shared library (visibility of symbols, shared)
117 CFLAGS_LIB=-fvisibility=hidden
118 LDFLAGS_LIB=-shared
119
120 ifeq ($(HOST),UNIX)
121 # Extra flags for compiling libroutino shared library (position independent code)
122 CFLAGS_LIB+=-fPIC
123 LDFLAGS_LIB+=-fPIC
124 endif
125
126 ifeq ($(HOST),UNIX)
127 # Extra flags for compiling libroutino shared library (SONAME)
128 LDFLAGS_SONAME=-Wl,-soname=libroutino.so.$(SOVERSION)
129 LDFLAGS_SLIM_SONAME=-Wl,-soname=libroutino-slim.so.$(SOVERSION)
130 endif
131
132 # Put the current directory in the shared library path for the router using libroutino
133 LDFLAGS_LDSO=-Wl,-R.
134
135
136 # Required for multi-threaded support (comment these two lines out if not required)
137 CFLAGS+=-pthread -DUSE_PTHREADS
138 LDFLAGS+=-pthread -lpthread
139
140
141 ifneq ($(HOST),MINGW)
142 # Required for bzip2 support (comment these two lines out if not required)
143 CFLAGS+=-DUSE_BZIP2
144 LDFLAGS+=-lbz2
145 endif
146
147
148 # Required for gzip support (comment these two lines out if not required)
149 CFLAGS+=-DUSE_GZIP
150 LDFLAGS+=-lz
151
152
153 # Required for xz support (uncomment these two lines if required)
154 #CFLAGS+=-DUSE_XZ
155 #LDFLAGS+=-llzma
156
157
158 # Required to use stdio with files > 2GiB on 32-bit system.
159 CFLAGS+=-D_FILE_OFFSET_BITS=64
160
161
162 ifneq ($(HOST),MINGW)
163 # Required to compile on Linux without a warning about pread() and pwrite() functions.
164 CFLAGS+=-D_POSIX_C_SOURCE=200809L
165 endif