1 # =============================================================================
2 # User configuration section.
4 # Largely, these are options that are designed to make mosquitto run more
5 # easily in restrictive environments by removing features.
7 # Modify the variable below to enable/disable features.
9 # Can also be overriden at the command line, e.g.:
12 # =============================================================================
14 # Uncomment to compile the broker with tcpd/libwrap support.
17 # Comment out to disable SSL/TLS support in the broker and client.
18 # Disabling this will also mean that passwords must be stored in plain text. It
19 # is strongly recommended that you only disable WITH_TLS if you are not using
20 # password authentication at all.
23 # Comment out to disable TLS/PSK support in the broker and client. Requires
25 # This must be disabled if using openssl < 1.0.
28 # Comment out to disable client client threading support.
31 # Uncomment to compile the broker with strict protocol support. This means that
32 # both the client library and the broker will be very strict about protocol
33 # compliance on incoming data. Neither of them will return an error on
34 # incorrect "remaining length" values if this is commented out. The old
35 # behaviour (prior to 0.12) is equivalent to compiling with
36 # WITH_STRICT_PROTOCOL defined and means that clients will be immediately
37 # disconnected from the broker on non-compliance.
38 #WITH_STRICT_PROTOCOL:=yes
40 # Comment out to remove bridge support from the broker. This allow the broker
41 # to connect to other brokers and subscribe/publish to topics. You probably
42 # want to leave this included unless you want to save a very small amount of
43 # memory size and CPU time.
46 # Comment out to remove persistent database support from the broker. This
47 # allows the broker to store retained messages and durable subscriptions to a
48 # file periodically and on shutdown. This is usually desirable (and is
49 # suggested by the MQTT spec), but it can be disabled if required.
52 # Comment out to remove memory tracking support from the broker. If disabled,
53 # mosquitto won't track heap memory usage nor export '$SYS/broker/heap/current
54 # size', but will use slightly less memory and CPU time.
55 WITH_MEMORY_TRACKING:=yes
57 # Compile with database upgrading support? If disabled, mosquitto won't
58 # automatically upgrade old database versions.
59 # Not currently supported.
62 # Comment out to remove publishing of the $SYS topic hierarchy containing
63 # information about the broker state.
66 # Build with Python module. Comment out if Python is not installed, or required
67 # Python modules are not available.
70 # Build with SRV lookup support.
73 # =============================================================================
74 # End of user configuration
75 # =============================================================================
78 # Also bump lib/mosquitto.h, lib/python/setup.py, CMakeLists.txt,
79 # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi
81 TIMESTAMP:=$(shell date "+%F %T%z")
83 # Client library SO version. Bump if incompatible API/ABI changes are made.
86 # Man page generation requires xsltproc and docbook-xsl
89 DB_HTML_XSL=man/html.xsl
93 UNAME:=$(shell uname -s)
98 CFLAGS?=-Wall -ggdb -O2
101 CFLAGS?=-Wall -ggdb -O2
104 LIB_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I. -I.. -I./lib
105 LIB_CXXFLAGS:=$(LIB_CFLAGS) ${CPPFLAGS}
106 LIB_LDFLAGS:=${LDFLAGS}
108 BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DTIMESTAMP="\"${TIMESTAMP}\"" -DWITH_BROKER
109 CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I./lib -DVERSION="\"${VERSION}\""
111 ifeq ($(UNAME),FreeBSD)
114 BROKER_LIBS:=-ldl -lm
119 ifeq ($(UNAME),Linux)
120 BROKER_LIBS:=$(BROKER_LIBS) -lrt
121 LIB_LIBS:=$(LIB_LIBS) -lrt
124 CLIENT_LDFLAGS:=$(LDFLAGS) -L./lib ./lib/libmosquitto.so.${SOVERSION}
126 ifeq ($(UNAME),SunOS)
128 LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC
130 LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
134 LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -KPIC
136 LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC
139 LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
140 LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC
143 ifneq ($(UNAME),SunOS)
144 LIB_LDFLAGS:=$(LIB_LDFLAGS) -Wl,-soname,libmosquitto.so.$(SOVERSION)
148 BROKER_LIBS:=$(BROKER_LIBS) -lsocket
149 LIB_LIBS:=$(LIB_LIBS) -lsocket
152 ifeq ($(WITH_WRAP),yes)
153 BROKER_LIBS:=$(BROKER_LIBS) -lwrap
154 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_WRAP
157 ifeq ($(WITH_TLS),yes)
158 BROKER_LIBS:=$(BROKER_LIBS) -lssl -lcrypto
159 LIB_LIBS:=$(LIB_LIBS) -lssl -lcrypto
160 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_TLS
161 LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_TLS
162 PASSWD_LIBS:=-lcrypto
163 CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_TLS
165 ifeq ($(WITH_TLS_PSK),yes)
166 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_TLS_PSK
167 LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_TLS_PSK
168 CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_TLS_PSK
172 ifeq ($(WITH_THREADING),yes)
173 LIB_LIBS:=$(LIB_LIBS) -lpthread
174 LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_THREADING
177 ifeq ($(WITH_STRICT_PROTOCOL),yes)
178 LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_STRICT_PROTOCOL
179 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_STRICT_PROTOCOL
182 ifeq ($(WITH_BRIDGE),yes)
183 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_BRIDGE
186 ifeq ($(WITH_PERSISTENCE),yes)
187 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_PERSISTENCE
190 ifeq ($(WITH_MEMORY_TRACKING),yes)
191 ifneq ($(UNAME),SunOS)
192 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_MEMORY_TRACKING
196 #ifeq ($(WITH_DB_UPGRADE),yes)
197 # BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_DB_UPGRADE
200 ifeq ($(WITH_SYS_TREE),yes)
201 BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_SYS_TREE
204 ifeq ($(WITH_SRV),yes)
205 LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_SRV
206 LIB_LIBS:=$(LIB_LIBS) -lcares
209 ifeq ($(UNAME),SunOS)
210 BROKER_LIBS:=$(BROKER_LIBS) -lsocket -lnsl
211 LIB_LIBS:=$(LIB_LIBS) -lsocket -lnsl
217 mandir=${prefix}/share/man
218 localedir=${prefix}/share/locale