# Configuration Makefile # # Part of the Routino routing software. # # This file Copyright 2013-2015 Andrew M. Bishop # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # # Automatic operating system detection UNAME=$(shell uname) HOST=UNIX ifneq ($(findstring CYGWIN,$(UNAME)),) HOST=CYGWIN endif ifneq ($(findstring MINGW,$(UNAME)),) HOST=MINGW endif # Simplify handling of executable targets ending in .exe ifeq ($(HOST),MINGW) .EXE=.exe else .EXE= endif # Installation locations (edit if required) ifneq ($(HOST),MINGW) prefix=/usr/local bindir=$(prefix)/bin incdir=$(prefix)/include libdir=$(prefix)/lib docdir=$(prefix)/doc/routino datadir=$(prefix)/share/routino else prefix="c:/Program Files/Routino" bindir=$(prefix)/bin incdir=$(prefix)/include libdir=$(prefix)/lib docdir=$(prefix)/doc datadir=$(prefix)/xml endif # Library version for ABI compatibility SOVERSION=0 # Full library version (SOVERSION.MINOR[.RELEASE]) LIBVERSION=$(SOVERSION).0.0 # Compilation programs CC=gcc LD=gcc # Maths library LDFLAGS=-lm # Language dialect selection CFLAGS=-std=c99 # Warning options CFLAGS+=-Wall -Wmissing-prototypes -Wextra -Wno-unused-parameter -pedantic # Optimisation options CFLAGS+=-O3 CFLAGS+=-ffast-math # Optimisation option (only works if compilation and execution use exactly the same CPU architecture). #CFLAGS+=-march=native # Debugging symbols #CFLAGS+=-g # Sanitizer for debugging memory addresses #CFLAGS+=-fsanitize=address -fsanitize=leak #LDFLAGS+=-fsanitize=address -fsanitize=leak # Sanitizer for debugging undefined behaviour #CFLAGS+=-fsanitize=undefined #LDFLAGS+=-fsanitize=undefined # Extra flags for compiling libroutino shared library (visibility of symbols, shared) CFLAGS_LIB=-fvisibility=hidden LDFLAGS_LIB=-shared ifeq ($(HOST),UNIX) # Extra flags for compiling libroutino shared library (position independent code) CFLAGS_LIB+=-fPIC LDFLAGS_LIB+=-fPIC endif ifeq ($(HOST),UNIX) # Extra flags for compiling libroutino shared library (SONAME) LDFLAGS_SONAME=-Wl,-soname=libroutino.so.$(SOVERSION) LDFLAGS_SLIM_SONAME=-Wl,-soname=libroutino-slim.so.$(SOVERSION) endif # Put the current directory in the shared library path for the router using libroutino LDFLAGS_LDSO=-Wl,-R. # Required for multi-threaded support (comment these two lines out if not required) CFLAGS+=-pthread -DUSE_PTHREADS LDFLAGS+=-pthread -lpthread ifneq ($(HOST),MINGW) # Required for bzip2 support (comment these two lines out if not required) CFLAGS+=-DUSE_BZIP2 LDFLAGS+=-lbz2 endif # Required for gzip support (comment these two lines out if not required) CFLAGS+=-DUSE_GZIP LDFLAGS+=-lz # Required for xz support (uncomment these two lines if required) #CFLAGS+=-DUSE_XZ #LDFLAGS+=-llzma # Required to use stdio with files > 2GiB on 32-bit system. CFLAGS+=-D_FILE_OFFSET_BITS=64 ifneq ($(HOST),MINGW) # Required to compile on Linux without a warning about pread() and pwrite() functions. CFLAGS+=-D_POSIX_C_SOURCE=200809L endif