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 BINPATH = "$(DESTDIR)@BINARY_DIR@"
55 CONPATH = "$(DESTDIR)@CONFIG_DIR@"
56 DATPATH = "$(DESTDIR)@DATA_DIR@"
57 EXAPATH = "$(DESTDIR)@EXAMPLE_DIR@"
58 LOGPATH = "$(DESTDIR)@LOG_DIR@"
59 MANPATH = "$(DESTDIR)@MANUAL_DIR@"
60 MODPATH = "$(DESTDIR)@MODULE_DIR@"
61 SCRPATH = "$(DESTDIR)@SCRIPT_DIR@"
69 ifneq ($(COMPILER), ICC)
70 CORECXXFLAGS += -Woverloaded-virtual -Wshadow
71 ifneq ($(SYSTEM), openbsd)
72 CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute -Wno-format-nonliteral
76 ifneq ($(SYSTEM), darwin)
80 ifeq ($(SYSTEM), linux)
83 ifeq ($(SYSTEM), gnukfreebsd)
89 ifeq ($(SYSTEM), solaris)
90 LDLIBS += -lsocket -lnsl -lrt -lresolv
92 ifeq ($(SYSTEM), darwin)
94 CORELDFLAGS = -dynamic -bind_at_load -L.
95 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup
97 ifeq ($(SYSTEM), haiku)
98 LDLIBS = -lnetwork -lstdc++
100 PICLDFLAGS = -fPIC -shared
103 ifndef INSPIRCD_DEBUG
108 ifeq ($(INSPIRCD_DEBUG), 0)
109 CORECXXFLAGS += -fno-rtti -O2
110 ifeq ($(COMPILER), GCC)
116 ifeq ($(INSPIRCD_DEBUG), 1)
117 CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI
118 HEADER = debug-header
121 ifeq ($(INSPIRCD_DEBUG), 2)
122 CORECXXFLAGS += -fno-rtti -O2 -g3
123 HEADER = debug-header
126 ifeq ($(INSPIRCD_DEBUG), 3)
127 CORECXXFLAGS += -fno-rtti -O0 -g0 -Werror
132 MAKEFLAGS += --no-print-directory
134 SOURCEPATH = $(shell pwd)
136 ifndef INSPIRCD_VERBOSE
137 MAKEFLAGS += --silent
140 # Append any flags set in the environment after the base flags so
141 # that they can be overridden if necessary.
142 CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS)
143 CORELDFLAGS += $(LDFLAGS)
144 PICLDFLAGS += $(LDFLAGS)
150 export INSPIRCD_VERBOSE
159 ifdef INSPIRCD_TARGET
161 TARGET = $(INSPIRCD_TARGET)
165 HEADER = unknown-debug-level
171 $(MAKEENV) perl make/calcdep.pl
172 cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
175 @${MAKE} INSPIRCD_DEBUG=1 all
178 @echo "*************************************"
179 @echo "* BUILDING WITH DEBUG SYMBOLS *"
181 @echo "* This will take a *long* time. *"
182 @echo "* Please be aware that this build *"
183 @echo "* will consume a very large amount *"
184 @echo "* of disk space (~350MB), and may *"
185 @echo "* run slower. Use the debug build *"
186 @echo "* for module development or if you *"
187 @echo "* are experiencing problems. *"
189 @echo "*************************************"
192 @echo 'Building specific targets:'
195 @echo "*************************************"
196 @echo "* BUILDING INSPIRCD *"
198 @echo "* This will take a *long* time. *"
199 @echo "* Why not read our docs at *"
200 @echo "* https://docs.inspircd.org *"
201 @echo "* while you wait for Make to run? *"
202 @echo "*************************************"
204 finishmessage: target
206 @echo "*************************************"
207 @echo "* BUILD COMPLETE! *"
209 @echo "* To install InspIRCd, type: *"
210 @echo "* 'make install' *"
211 @echo "*************************************"
214 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BINPATH)
215 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(CONPATH)
216 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(DATPATH)
217 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/codepages
218 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/providers
219 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/services
220 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(EXAPATH)/sql
221 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(LOGPATH)
222 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MANPATH)
223 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MODPATH)
224 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(SCRPATH)
225 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
226 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/modules/"*.so $(MODPATH)
227 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
228 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/apparmor $(SCRPATH) 2>/dev/null
229 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/logrotate $(SCRPATH) 2>/dev/null
230 ifeq ($(SYSTEM), darwin)
231 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
233 ifeq ($(SYSTEM), linux)
234 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
236 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
237 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
238 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd-testssl.1 $(MANPATH) 2>/dev/null
239 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
240 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/testssl $(BINPATH)/inspircd-testssl 2>/dev/null
241 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/*.example $(EXAPATH)
242 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/codepages/*.example $(EXAPATH)/codepages
243 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/providers/*.example $(EXAPATH)/providers
244 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/services/*.example $(EXAPATH)/services
245 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/sql/*.sql $(EXAPATH)/sql
246 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/help.txt $(CONPATH)
247 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_PRV) @CONFIGURE_DIRECTORY@/*.pem $(CONPATH) 2>/dev/null
249 @echo "*************************************"
250 @echo "* INSTALL COMPLETE! *"
251 @echo "*************************************"
253 @echo ' Configuration:' $(CONPATH)
254 @echo ' Binaries:' $(BINPATH)
255 @echo ' Modules:' $(MODPATH)
256 @echo ' Data:' $(DATPATH)
257 @echo 'To start the ircd, run:' $(SCRPATH)/inspircd start
258 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
259 @echo 'Examples are available at:' $(EXAPATH)
261 GNUmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@
266 -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk"
267 -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules"
268 @-rmdir "$(BUILDPATH)/bin" 2>/dev/null
269 @-rmdir "$(BUILDPATH)" 2>/dev/null
273 -rm -f $(BINPATH)/inspircd
275 -rm -f $(MANPATH)/inspircd.1
276 -rm -f $(MANPATH)/inspircd-genssl.1
277 -rm -f $(MODPATH)/m_*.so
278 -rm -f $(MODPATH)/core_*.so
279 -rm -f $(SCRPATH)/inspircd.service
280 -rm -f $(SCRPATH)/org.inspircd.plist
285 rm -f include/config.h
286 rm -rf @CONFIGURE_DIRECTORY@
288 distclean: clean configureclean
289 -rm -rf "$(SOURCEPATH)/run"
290 find "$(SOURCEPATH)/src/modules" -type l | xargs rm -f
293 @echo 'InspIRCd Makefile'
295 @echo 'Use: ${MAKE} [flags] [targets]'
298 @echo ' INSPIRCD_VERBOSE=1 Show the full command being executed instead of "BUILD: dns.cpp"'
299 @echo ' INSPIRCD_DEBUG=1 Enable debug build, for module development or crash tracing'
300 @echo ' INSPIRCD_DEBUG=2 Enable debug build with optimizations, for detailed backtraces'
301 @echo ' INSPIRCD_DEBUG=3 Enable fast build with no optimisations or symbols (only for CI)'
302 @echo ' DESTDIR= Specify a destination root directory (for tarball creation)'
303 @echo ' -j <N> Run a parallel build using N jobs'
306 @echo ' all Complete build of InspIRCd, without installing (default)'
307 @echo ' install Build and install InspIRCd to the directory chosen in ./configure'
308 @echo ' debug Compile a debug build. Equivalent to "make D=1 all"'
310 @echo ' INSPIRCD_TARGET=target Builds a user-specified target, such as "inspircd" or "core_dns"'
311 @echo ' Multiple targets may be separated by a space'
313 @echo ' clean Cleans object files produced by the compile'
314 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
315 @echo ' deinstall Removes the files created by "make install"'
320 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help