3 # InspIRCd -- Internet Relay Chat Daemon
5 # Copyright (C) 2020 Nicole Kleinhoff <ilbelkyr@shalture.org>
6 # Copyright (C) 2018 Puck Meerburg <puck@puckipedia.com>
7 # Copyright (C) 2012-2020 Sadie Powell <sadie@witchery.services>
8 # Copyright (C) 2012, 2015-2016 Attila Molnar <attilamolnar@hush.com>
9 # Copyright (C) 2012 Robby <robby@chatbelgie.be>
10 # Copyright (C) 2012 Christoph Egger <christoph@debian.org>
11 # Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
12 # Copyright (C) 2010 Dennis Friis <peavey@inspircd.org>
13 # Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
14 # Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
15 # Copyright (C) 2005-2007 Craig Edwards <brain@inspircd.org>
16 # Copyright (C) 2005 Craig McLure <craig@frostycoolslug.com>
18 # This file is part of InspIRCd. InspIRCd is free software: you can
19 # redistribute it and/or modify it under the terms of the GNU General Public
20 # License as published by the Free Software Foundation, version 2.
22 # This program is distributed in the hope that it will be useful, but WITHOUT
23 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
24 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
33 # InspIRCd Main Makefile
35 # This file is automagically generated by configure, from
36 # make/template/main.mk. Any changes made to the generated
37 # files will go away whenever it is regenerated!
39 # Please do not edit unless you know what you're doing.
44 COMPILER = @COMPILER_NAME@
45 SYSTEM = @SYSTEM_NAME@
46 BUILDPATH ?= $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/build/@COMPILER_NAME@-@COMPILER_VERSION@
47 SOCKETENGINE = @SOCKETENGINE@
48 CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
50 CORELDFLAGS = -rdynamic -L.
51 PICLDFLAGS = -fPIC -shared -rdynamic
53 DESTDIR := $(if $(DESTDIR),$(DESTDIR),"@DESTDIR|@")
54 BASE = "$(DESTDIR)@BASE_DIR@"
55 BINPATH = "$(DESTDIR)@BINARY_DIR@"
56 CONPATH = "$(DESTDIR)@CONFIG_DIR@"
57 DATPATH = "$(DESTDIR)@DATA_DIR@"
58 EXAPATH = "$(DESTDIR)@EXAMPLE_DIR@"
59 LOGPATH = "$(DESTDIR)@LOG_DIR@"
60 MANPATH = "$(DESTDIR)@MANUAL_DIR@"
61 MODPATH = "$(DESTDIR)@MODULE_DIR@"
62 SCRPATH = "$(DESTDIR)@SCRIPT_DIR@"
70 ifneq ($(COMPILER), ICC)
71 CORECXXFLAGS += -Woverloaded-virtual -Wshadow
72 ifneq ($(SYSTEM), openbsd)
73 CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute -Wno-format-nonliteral
77 ifneq ($(SYSTEM), darwin)
81 ifeq ($(SYSTEM), linux)
84 ifeq ($(SYSTEM), gnukfreebsd)
90 ifeq ($(SYSTEM), solaris)
91 LDLIBS += -lsocket -lnsl -lrt -lresolv
93 ifeq ($(SYSTEM), darwin)
95 CORELDFLAGS = -dynamic -bind_at_load -L.
96 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup
98 ifeq ($(SYSTEM), haiku)
99 LDLIBS = -lnetwork -lstdc++
101 PICLDFLAGS = -fPIC -shared
104 ifndef INSPIRCD_DEBUG
109 ifeq ($(INSPIRCD_DEBUG), 0)
110 CORECXXFLAGS += -fno-rtti -O2
111 ifeq ($(COMPILER), GCC)
117 ifeq ($(INSPIRCD_DEBUG), 1)
118 CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI
119 HEADER = debug-header
122 ifeq ($(INSPIRCD_DEBUG), 2)
123 CORECXXFLAGS += -fno-rtti -O2 -g3
124 HEADER = debug-header
127 ifeq ($(INSPIRCD_DEBUG), 3)
128 CORECXXFLAGS += -fno-rtti -O0 -g0 -Werror
133 MAKEFLAGS += --no-print-directory
135 SOURCEPATH = $(shell pwd)
137 ifndef INSPIRCD_VERBOSE
138 MAKEFLAGS += --silent
141 # Append any flags set in the environment after the base flags so
142 # that they can be overridden if necessary.
143 CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS)
144 CORELDFLAGS += $(LDFLAGS)
145 PICLDFLAGS += $(LDFLAGS)
151 export INSPIRCD_VERBOSE
160 ifdef INSPIRCD_TARGET
162 TARGET = $(INSPIRCD_TARGET)
166 HEADER = unknown-debug-level
172 $(MAKEENV) perl make/calcdep.pl
173 cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
176 @${MAKE} INSPIRCD_DEBUG=1 all
179 @echo "*************************************"
180 @echo "* BUILDING WITH DEBUG SYMBOLS *"
182 @echo "* This will take a *long* time. *"
183 @echo "* Please be aware that this build *"
184 @echo "* will consume a very large amount *"
185 @echo "* of disk space (~350MB), and may *"
186 @echo "* run slower. Use the debug build *"
187 @echo "* for module development or if you *"
188 @echo "* are experiencing problems. *"
190 @echo "*************************************"
193 @echo 'Building specific targets:'
196 @echo "*************************************"
197 @echo "* BUILDING INSPIRCD *"
199 @echo "* This will take a *long* time. *"
200 @echo "* Why not read our docs at *"
201 @echo "* https://docs.inspircd.org *"
202 @echo "* while you wait for Make to run? *"
203 @echo "*************************************"
205 finishmessage: target
207 @echo "*************************************"
208 @echo "* BUILD COMPLETE! *"
210 @echo "* To install InspIRCd, type: *"
211 @echo "* 'make install' *"
212 @echo "*************************************"
215 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BASE)
216 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BINPATH)
217 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(CONPATH)
218 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(DATPATH)
219 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/codepages
220 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/providers
221 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/services
222 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/sql
223 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(LOGPATH)
224 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MANPATH)
225 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MODPATH)
226 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(SCRPATH)
227 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
228 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/modules/"*.so $(MODPATH)
229 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
230 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/apparmor $(SCRPATH) 2>/dev/null
231 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/logrotate $(SCRPATH) 2>/dev/null
232 ifeq ($(SYSTEM), darwin)
233 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
235 ifeq ($(SYSTEM), linux)
236 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
238 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
239 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
240 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-testssl.1 $(MANPATH) 2>/dev/null
241 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
242 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/testssl $(BINPATH)/inspircd-testssl 2>/dev/null
243 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/*.example $(EXAPATH)
244 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/codepages/*.example $(EXAPATH)/codepages
245 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/providers/*.example $(EXAPATH)/providers
246 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/services/*.example $(EXAPATH)/services
247 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/sql/*.sql $(EXAPATH)/sql
248 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/help.txt $(CONPATH)
249 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_PRV) @CONFIGURE_DIRECTORY@/*.pem $(CONPATH) 2>/dev/null
251 @echo "*************************************"
252 @echo "* INSTALL COMPLETE! *"
253 @echo "*************************************"
255 @echo ' Base install:' $(BASE)
256 @echo ' Configuration:' $(CONPATH)
257 @echo ' Binaries:' $(BINPATH)
258 @echo ' Modules:' $(MODPATH)
259 @echo ' Data:' $(DATPATH)
260 @echo 'To start the ircd, run:' $(SCRPATH)/inspircd start
261 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
262 @echo 'Examples are available at:' $(EXAPATH)
264 GNUmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@
269 -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk"
270 -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules"
271 @-rmdir "$(BUILDPATH)/bin" 2>/dev/null
272 @-rmdir "$(BUILDPATH)" 2>/dev/null
276 -rm -f $(BINPATH)/inspircd
278 -rm -f $(MANPATH)/inspircd.1
279 -rm -f $(MANPATH)/inspircd-genssl.1
280 -rm -f $(MODPATH)/m_*.so
281 -rm -f $(MODPATH)/core_*.so
282 -rm -f $(SCRPATH)/inspircd.service
283 -rm -f $(SCRPATH)/org.inspircd.plist
288 rm -f include/config.h
289 rm -rf @CONFIGURE_DIRECTORY@
291 distclean: clean configureclean
292 -rm -rf "$(SOURCEPATH)/run"
293 find "$(SOURCEPATH)/src/modules" -type l | xargs rm -f
296 @echo 'InspIRCd Makefile'
298 @echo 'Use: ${MAKE} [flags] [targets]'
301 @echo ' INSPIRCD_VERBOSE=1 Show the full command being executed instead of "BUILD: dns.cpp"'
302 @echo ' INSPIRCD_DEBUG=1 Enable debug build, for module development or crash tracing'
303 @echo ' INSPIRCD_DEBUG=2 Enable debug build with optimizations, for detailed backtraces'
304 @echo ' INSPIRCD_DEBUG=3 Enable fast build with no optimisations or symbols (only for CI)'
305 @echo ' DESTDIR= Specify a destination root directory (for tarball creation)'
306 @echo ' -j <N> Run a parallel build using N jobs'
309 @echo ' all Complete build of InspIRCd, without installing (default)'
310 @echo ' install Build and install InspIRCd to the directory chosen in ./configure'
311 @echo ' Currently installs to ${BASE}'
312 @echo ' debug Compile a debug build. Equivalent to "make D=1 all"'
314 @echo ' INSPIRCD_TARGET=target Builds a user-specified target, such as "inspircd" or "core_dns"'
315 @echo ' Multiple targets may be separated by a space'
317 @echo ' clean Cleans object files produced by the compile'
318 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
319 @echo ' deinstall Removes the files created by "make install"'
324 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help