3 # InspIRCd -- Internet Relay Chat Daemon
5 # Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
7 # This file is part of InspIRCd. InspIRCd is free software: you can
8 # redistribute it and/or modify it under the terms of the GNU General Public
9 # License as published by the Free Software Foundation, version 2.
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # InspIRCd Main Makefile
24 # This file is automagically generated by configure, from
25 # make/template/main.mk. Any changes made to the generated
26 # files will go away whenever it is regenerated!
28 # Please do not edit unless you know what you're doing.
33 COMPILER = @COMPILER_NAME@
34 SYSTEM = @SYSTEM_NAME@
35 BUILDPATH ?= $(PWD)/build
36 SOCKETENGINE = @SOCKETENGINE@
37 CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
39 CORELDFLAGS = -rdynamic -L. $(LDFLAGS)
40 PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS)
41 BASE = "$(DESTDIR)@BASE_DIR@"
42 CONPATH = "$(DESTDIR)@CONFIG_DIR@"
43 MANPATH = "$(DESTDIR)@MANUAL_DIR@"
44 MODPATH = "$(DESTDIR)@MODULE_DIR@"
45 LOGPATH = "$(DESTDIR)@LOG_DIR@"
46 DATPATH = "$(DESTDIR)@DATA_DIR@"
47 BINPATH = "$(DESTDIR)@BINARY_DIR@"
48 SCRPATH = "$(DESTDIR)@SCRIPT_DIR@"
55 ifneq ($(COMPILER), ICC)
56 CORECXXFLAGS += -Woverloaded-virtual -Wshadow
57 ifneq ($(SYSTEM), openbsd)
58 CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute
62 ifneq ($(SYSTEM), darwin)
66 ifeq ($(SYSTEM), linux)
69 ifeq ($(SYSTEM), gnukfreebsd)
75 ifeq ($(SYSTEM), solaris)
76 LDLIBS += -lsocket -lnsl -lrt -lresolv
79 ifeq ($(SYSTEM), darwin)
81 CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS)
82 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS)
90 ifeq ($(INSPIRCD_DEBUG), 0)
91 CORECXXFLAGS += -fno-rtti -O2
92 ifeq ($(COMPILER), GCC)
98 ifeq ($(INSPIRCD_DEBUG), 1)
99 CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI
100 HEADER = debug-header
103 ifeq ($(INSPIRCD_DEBUG), 2)
104 CORECXXFLAGS += -fno-rtti -O2 -g3
105 HEADER = debug-header
108 FOOTER = finishmessage
110 MAKEFLAGS += --no-print-directory
112 SOURCEPATH = $(shell /bin/pwd)
114 ifndef INSPIRCD_VERBOSE
115 MAKEFLAGS += --silent
118 ifdef INSPIRCD_STATIC
119 CORECXXFLAGS += -DINSPIRCD_STATIC
122 # Add the users CPPFLAGS/CXXFLAGS to the base ones to allow them to
123 # override things like -Wfatal-errors if they wish to.
124 CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS)
130 export INSPIRCD_STATIC
131 export INSPIRCD_VERBOSE
140 ifdef INSPIRCD_MODULE
143 TARGET = modules/$(INSPIRCD_MODULE:.so=).so
146 ifdef INSPIRCD_TARGET
149 TARGET = $(INSPIRCD_TARGET)
153 HEADER = unknown-debug-level
159 $(MAKEENV) perl make/calcdep.pl
160 cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
163 @${MAKE} INSPIRCD_DEBUG=1 all
166 @echo "*************************************"
167 @echo "* BUILDING WITH DEBUG SYMBOLS *"
169 @echo "* This will take a *long* time. *"
170 @echo "* Please be aware that this build *"
171 @echo "* will consume a very large amount *"
172 @echo "* of disk space (~350MB), and may *"
173 @echo "* run slower. Use the debug build *"
174 @echo "* for module development or if you *"
175 @echo "* are experiencing problems. *"
177 @echo "*************************************"
180 ifdef INSPIRCD_STATIC
181 @echo 'Cannot build single modules in pure-static build'
184 @echo 'Building single module:'
187 @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)'
188 @echo 'Or, run "make install"'
191 @echo "*************************************"
192 @echo "* BUILDING INSPIRCD *"
194 @echo "* This will take a *long* time. *"
195 @echo "* Why not read our wiki at *"
196 @echo "* http://wiki.inspircd.org *"
197 @echo "* while you wait for make to run? *"
198 @echo "*************************************"
200 finishmessage: target
202 @echo "*************************************"
203 @echo "* BUILD COMPLETE! *"
205 @echo "* To install InspIRCd, type: *"
206 @echo "* make install *"
207 @echo "*************************************"
210 @if [ "$(INSTUID)" = 0 -o "$(INSTUID)" = root ]; then \
212 echo "Error: You must specify a non-root UID for the server"; \
214 echo "If you are making a package, please specify using ./configure --uid"; \
215 echo "Otherwise, rerun using 'make INSTUID=irc install', where 'irc' is the user"; \
216 echo "who will be running the ircd. You will also need to modify the start script."; \
220 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)
221 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH)
222 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH)
223 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH)
224 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules
225 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/services
226 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH)
227 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
228 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(SCRPATH)
229 [ "$(BUILDPATH)/bin/" -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
230 ifndef INSPIRCD_STATIC
231 [ "$(BUILDPATH)/modules/" -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH)
233 -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
234 -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(SCRPATH)/.gdbargs 2>/dev/null
235 ifeq ($(SYSTEM), darwin)
236 -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
238 ifeq ($(SYSTEM), linux)
239 -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
241 -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
242 -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
243 -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
244 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
245 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules
246 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/services/*.example $(CONPATH)/examples/services
247 -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH) 2>/dev/null
249 @echo "*************************************"
250 @echo "* INSTALL COMPLETE! *"
251 @echo "*************************************"
253 @echo ' Base install:' $(BASE)
254 @echo ' Configuration:' $(CONPATH)
255 @echo ' Binaries:' $(BINPATH)
256 @echo ' Modules:' $(MODPATH)
257 @echo ' Data:' $(DATPATH)
258 @echo 'To start the ircd, run:' $(SCRPATH)/inspircd start
259 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
260 @echo 'Examples are available at:' $(CONPATH)/examples/
262 GNUmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@
267 -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk"
268 -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules"
269 @-rmdir "$(BUILDPATH)/bin" 2>/dev/null
270 @-rmdir "$(BUILDPATH)" 2>/dev/null
274 -rm -f $(BINPATH)/inspircd
275 -rm -rf $(CONPATH)/examples
276 -rm -f $(MANPATH)/inspircd.1
277 -rm -f $(MANPATH)/inspircd-genssl.1
278 -rm -f $(MODPATH)/m_*.so
279 -rm -f $(MODPATH)/core_*.so
280 -rm -f $(SCRPATH)/.gdbargs
281 -rm -f $(SCRPATH)/inspircd.service
282 -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 ' DESTDIR= Specify a destination root directory (for tarball creation)'
305 @echo ' -j <N> Run a parallel build using N jobs'
308 @echo ' all Complete build of InspIRCd, without installing (default)'
309 @echo ' install Build and install InspIRCd to the directory chosen in ./configure'
310 @echo ' Currently installs to ${BASE}'
311 @echo ' debug Compile a debug build. Equivalent to "make D=1 all"'
313 @echo ' INSPIRCD_MODULE=m_foo Builds a single module (core_foo also works here)'
314 @echo ' INSPIRCD_TARGET=target Builds a user-specified target, such as "inspircd" or "modules"'
315 @echo ' Other targets are specified by their path in the build directory'
316 @echo ' Multiple targets may be separated by a space'
318 @echo ' clean Cleans object files produced by the compile'
319 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
320 @echo ' deinstall Removes the files created by "make install"'
325 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help