mosquitto/config.mk

329 lines
8.8 KiB
Makefile
Raw Normal View History

2014-05-07 22:27:00 +00:00
# =============================================================================
# User configuration section.
#
# These options control compilation on all systems apart from Windows and Mac
# OS X. Use CMake to compile on Windows and Mac.
#
2014-05-07 22:27:00 +00:00
# Largely, these are options that are designed to make mosquitto run more
# easily in restrictive environments by removing features.
#
# Modify the variable below to enable/disable features.
#
# Can also be overriden at the command line, e.g.:
#
# make WITH_TLS=no
# =============================================================================
# Uncomment to compile the broker with tcpd/libwrap support.
#WITH_WRAP:=yes
# Comment out to disable SSL/TLS support in the broker and client.
# Disabling this will also mean that passwords must be stored in plain text. It
# is strongly recommended that you only disable WITH_TLS if you are not using
# password authentication at all.
WITH_TLS:=yes
# Comment out to disable TLS/PSK support in the broker and client. Requires
# WITH_TLS=yes.
# This must be disabled if using openssl < 1.0.
WITH_TLS_PSK:=yes
2018-08-14 11:39:36 +00:00
# Comment out to disable client threading support.
2014-05-07 22:27:00 +00:00
WITH_THREADING:=yes
# Comment out to remove bridge support from the broker. This allow the broker
# to connect to other brokers and subscribe/publish to topics. You probably
# want to leave this included unless you want to save a very small amount of
# memory size and CPU time.
WITH_BRIDGE:=yes
# Comment out to remove persistent database support from the broker. This
# allows the broker to store retained messages and durable subscriptions to a
# file periodically and on shutdown. This is usually desirable (and is
# suggested by the MQTT spec), but it can be disabled if required.
WITH_PERSISTENCE:=yes
# Comment out to remove memory tracking support from the broker. If disabled,
# mosquitto won't track heap memory usage nor export '$SYS/broker/heap/current
# size', but will use slightly less memory and CPU time.
WITH_MEMORY_TRACKING:=yes
# Compile with database upgrading support? If disabled, mosquitto won't
# automatically upgrade old database versions.
# Not currently supported.
#WITH_DB_UPGRADE:=yes
# Comment out to remove publishing of the $SYS topic hierarchy containing
# information about the broker state.
WITH_SYS_TREE:=yes
# Build with systemd support. If enabled, mosquitto will notify systemd after
# initialization. See README in service/systemd/ for more information.
WITH_SYSTEMD:=no
2014-05-07 22:27:00 +00:00
# Build with SRV lookup support.
WITH_SRV:=no
2014-05-07 22:27:00 +00:00
# Build with websockets support on the broker.
2014-05-26 17:05:17 +00:00
WITH_WEBSOCKETS:=no
# Use elliptic keys in broker
WITH_EC:=yes
# Build man page documentation by default.
WITH_DOCS:=yes
# Build with client support for SOCK5 proxy.
WITH_SOCKS:=yes
2016-06-13 20:36:41 +00:00
# Strip executables and shared libraries on install.
WITH_STRIP:=no
# Build static libraries
WITH_STATIC_LIBRARIES:=no
# Use this variable to add extra library dependencies when building the clients
# with the static libmosquitto library. This may be required on some systems
# where e.g. -lz or -latomic are needed for openssl.
CLIENT_STATIC_LDADD:=
2018-10-06 23:56:42 +00:00
# Build shared libraries
WITH_SHARED_LIBRARIES:=yes
# Build with async dns lookup support for bridges (temporary). Requires glibc.
#WITH_ADNS:=yes
# Build with epoll support.
2017-08-09 08:37:52 +00:00
WITH_EPOLL:=yes
# Build with bundled uthash.h
WITH_BUNDLED_DEPS:=yes
# Build with coverage options
WITH_COVERAGE:=no
2014-05-07 22:27:00 +00:00
# =============================================================================
# End of user configuration
# =============================================================================
2015-02-18 01:34:43 +00:00
# Also bump lib/mosquitto.h, CMakeLists.txt,
2015-09-22 12:48:36 +00:00
# installer/mosquitto.nsi, installer/mosquitto64.nsi
2020-08-19 13:46:44 +00:00
VERSION=1.6.12
2014-05-07 22:27:00 +00:00
# Client library SO version. Bump if incompatible API/ABI changes are made.
SOVERSION=1
# Man page generation requires xsltproc and docbook-xsl
XSLTPROC=xsltproc --nonet
2014-05-07 22:27:00 +00:00
# For html generation
DB_HTML_XSL=man/html.xsl
#MANCOUNTRIES=en_GB
UNAME:=$(shell uname -s)
2014-05-07 22:27:00 +00:00
ifeq ($(UNAME),SunOS)
ifeq ($(CC),cc)
CFLAGS?=-O
else
CFLAGS?=-Wall -ggdb -O2
endif
else
CFLAGS?=-Wall -ggdb -O2
endif
STATIC_LIB_DEPS:=
2014-05-07 22:27:00 +00:00
LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../lib
ifeq ($(WITH_BUNDLED_DEPS),yes)
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -I../src/deps
endif
LIB_CFLAGS:=$(CFLAGS)
LIB_CXXFLAGS:=$(CXXFLAGS)
LIB_LDFLAGS:=$(LDFLAGS)
LIB_LIBADD:=$(LIBADD)
BROKER_CPPFLAGS:=$(LIB_CPPFLAGS)
BROKER_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER
BROKER_LDFLAGS:=${LDFLAGS}
BROKER_LDADD:=
CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../lib
CLIENT_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\""
CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib
CLIENT_LDADD:=
PASSWD_LDADD:=
2014-05-07 22:27:00 +00:00
ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),)
BROKER_LDADD:=$(BROKER_LDADD) -lm
SEDINPLACE:=-i ""
2014-05-07 22:27:00 +00:00
else
BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm
SEDINPLACE:=-i
2014-05-07 22:27:00 +00:00
endif
ifeq ($(UNAME),Linux)
BROKER_LDADD:=$(BROKER_LDADD) -lrt
BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms
LIB_LIBADD:=$(LIB_LIBADD) -lrt
2014-05-07 22:27:00 +00:00
endif
2018-10-06 23:56:42 +00:00
ifeq ($(WITH_SHARED_LIBRARIES),yes)
CLIENT_LDADD:=${CLIENT_LDADD} ../lib/libmosquitto.so.${SOVERSION}
2018-10-06 23:56:42 +00:00
endif
2014-05-07 22:27:00 +00:00
ifeq ($(UNAME),SunOS)
ifeq ($(CC),cc)
LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC
else
LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
endif
ifeq ($(CXX),CC)
LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -KPIC
else
LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC
endif
else
LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC
endif
ifneq ($(UNAME),SunOS)
LIB_LDFLAGS:=$(LIB_LDFLAGS) -Wl,--version-script=linker.version -Wl,-soname,libmosquitto.so.$(SOVERSION)
endif
ifeq ($(UNAME),QNX)
BROKER_LDADD:=$(BROKER_LDADD) -lsocket
LIB_LIBADD:=$(LIB_LIBADD) -lsocket
2014-05-07 22:27:00 +00:00
endif
2017-02-06 22:39:39 +00:00
2014-05-07 22:27:00 +00:00
ifeq ($(WITH_WRAP),yes)
BROKER_LDADD:=$(BROKER_LDADD) -lwrap
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WRAP
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_TLS),yes)
BROKER_LDADD:=$(BROKER_LDADD) -lssl -lcrypto
LIB_LIBADD:=$(LIB_LIBADD) -lssl -lcrypto
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS
PASSWD_LDADD:=$(PASSWD_LDADD) -lcrypto
CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lssl -lcrypto
2014-05-07 22:27:00 +00:00
ifeq ($(WITH_TLS_PSK),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS_PSK
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS_PSK
CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS_PSK
2014-05-07 22:27:00 +00:00
endif
endif
ifeq ($(WITH_THREADING),yes)
LIB_LIBADD:=$(LIB_LIBADD) -lpthread
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_THREADING
CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_THREADING
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lpthread
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_SOCKS),yes)
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SOCKS
CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SOCKS
endif
2014-05-07 22:27:00 +00:00
ifeq ($(WITH_BRIDGE),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_BRIDGE
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_PERSISTENCE),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_PERSISTENCE
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_MEMORY_TRACKING),yes)
ifneq ($(UNAME),SunOS)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_MEMORY_TRACKING
2014-05-07 22:27:00 +00:00
endif
endif
ifeq ($(WITH_SYS_TREE),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYS_TREE
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_SYSTEMD),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYSTEMD
BROKER_LDADD:=$(BROKER_LDADD) -lsystemd
endif
2014-05-07 22:27:00 +00:00
ifeq ($(WITH_SRV),yes)
LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SRV
LIB_LIBADD:=$(LIB_LIBADD) -lcares
CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SRV
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lcares
2014-05-07 22:27:00 +00:00
endif
ifeq ($(UNAME),SunOS)
BROKER_LDADD:=$(BROKER_LDADD) -lsocket -lnsl
LIB_LIBADD:=$(LIB_LIBADD) -lsocket -lnsl
2014-05-07 22:27:00 +00:00
endif
ifeq ($(WITH_EC),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EC
endif
2014-05-07 22:27:00 +00:00
ifeq ($(WITH_ADNS),yes)
BROKER_LDADD:=$(BROKER_LDADD) -lanl
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS
endif
MAKE_ALL:=mosquitto
ifeq ($(WITH_DOCS),yes)
MAKE_ALL:=$(MAKE_ALL) docs
endif
2018-05-18 21:25:09 +00:00
ifeq ($(WITH_WEBSOCKETS),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS
BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets
2018-05-18 21:25:09 +00:00
endif
ifeq ($(WITH_WEBSOCKETS),static)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS
BROKER_LDADD:=$(BROKER_LDADD) -static -lwebsockets
2018-05-18 21:25:09 +00:00
endif
2014-05-07 22:27:00 +00:00
INSTALL?=install
prefix?=/usr/local
incdir?=${prefix}/include
libdir?=${prefix}/lib${LIB_SUFFIX}
localedir?=${prefix}/share/locale
mandir?=${prefix}/share/man
2014-07-13 23:19:21 +00:00
STRIP?=strip
2016-06-13 20:36:41 +00:00
ifeq ($(WITH_STRIP),yes)
STRIP_OPTS?=-s --strip-program=${CROSS_COMPILE}${STRIP}
2016-06-13 20:36:41 +00:00
endif
ifeq ($(WITH_EPOLL),yes)
ifeq ($(UNAME),Linux)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EPOLL
endif
endif
ifeq ($(WITH_BUNDLED_DEPS),yes)
BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -Ideps
endif
ifeq ($(WITH_COVERAGE),yes)
BROKER_CFLAGS:=$(BROKER_CFLAGS) -coverage
BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -coverage
LIB_CFLAGS:=$(LIB_CFLAGS) -coverage
LIB_LDFLAGS:=$(LIB_LDFLAGS) -coverage
CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -coverage
CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) -coverage
endif
BROKER_LDADD:=${BROKER_LDADD} ${LDADD}
CLIENT_LDADD:=${CLIENT_LDADD} ${LDADD}
PASSWD_LDADD:=${PASSWD_LDADD} ${LDADD}