1 %target BSD_MAKE BSDmakefile
2 %target GNU_MAKE GNUmakefile
4 # InspIRCd -- Internet Relay Chat Daemon
6 # Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
8 # This file is part of InspIRCd. InspIRCd is free software: you can
9 # redistribute it and/or modify it under the terms of the GNU General Public
10 # License as published by the Free Software Foundation, version 2.
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # InspIRCd Main Makefile
25 # This file is automagically generated by configure, from
26 # make/template/main.mk. Any changes made to the generated
27 # files will go away whenever it is regenerated!
29 # Please do not edit unless you know what you're doing. This
30 # needs to work in both GNU and BSD make; it is mangled for
36 COMPILER = @COMPILER_NAME@
37 SYSTEM = @SYSTEM_NAME@
38 BUILDPATH ?= $(PWD)/build
39 SOCKETENGINE = @SOCKETENGINE@
40 CORECXXFLAGS = -fPIC -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
42 CORELDFLAGS = -rdynamic -L. $(LDFLAGS)
43 PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS)
44 BASE = "$(DESTDIR)@BASE_DIR@"
45 CONPATH = "$(DESTDIR)@CONFIG_DIR@"
46 MANPATH = "$(DESTDIR)@MANUAL_DIR@"
47 MODPATH = "$(DESTDIR)@MODULE_DIR@"
48 DATPATH = "$(DESTDIR)@DATA_DIR@"
49 BINPATH = "$(DESTDIR)@BINARY_DIR@"
56 @IFNEQ $(COMPILER) ICC
57 CORECXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute
60 @IFNEQ $(SYSTEM)-$(COMPILER) darwin-GCC
61 CORECXXFLAGS += -fvisibility=hidden
64 @IFNEQ $(SYSTEM) darwin
71 @IFEQ $(SYSTEM) gnukfreebsd
77 @IFEQ $(SYSTEM) solaris
78 LDLIBS += -lsocket -lnsl -lrt -lresolv
81 @IFEQ $(SYSTEM) darwin
83 CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS)
84 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS)
101 CORECXXFLAGS += -O0 -g3 -Werror
102 HEADER = debug-header
106 CORECXXFLAGS += -O2 -g3
107 HEADER = debug-header
110 FOOTER = finishmessage
112 @TARGET GNU_MAKE MAKEFLAGS += --no-print-directory
114 @TARGET GNU_MAKE SOURCEPATH = $(shell /bin/pwd)
115 @TARGET BSD_MAKE SOURCEPATH != /bin/pwd
122 @TARGET GNU_MAKE MAKEFLAGS += --silent
123 @TARGET BSD_MAKE MAKE += -s
124 RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CXX)
125 RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CXX)
129 CORECXXFLAGS += -DPURE_STATIC
132 # Add the users CXXFLAGS to the base ones to allow them to override
133 # things like -Wfatal-errors if they wish to.
134 CORECXXFLAGS += $(CXXFLAGS)
136 @DO_EXPORT RUNCC RUNLD CORECXXFLAGS LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS
137 @DO_EXPORT SOURCEPATH BUILDPATH PURE_STATIC
145 @TARGET BSD_MAKE TARGET = modules/${M:S/.so$//}.so
146 @TARGET GNU_MAKE TARGET = modules/$(M:.so=).so
156 HEADER = unknown-debug-level
162 $(MAKEENV) perl make/calcdep.pl
163 cd $(BUILDPATH); $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
169 @echo "*************************************"
170 @echo "* BUILDING WITH DEBUG SYMBOLS *"
172 @echo "* This will take a *long* time. *"
173 @echo "* Please be aware that this build *"
174 @echo "* will consume a very large amount *"
175 @echo "* of disk space (~350MB), and may *"
176 @echo "* run slower. Use the debug build *"
177 @echo "* for module development or if you *"
178 @echo "* are experiencing problems. *"
180 @echo "*************************************"
184 @echo 'Cannot build single modules in pure-static build'
187 @echo 'Building single module:'
190 @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)'
191 @echo 'Or, run "make install"'
194 @echo "*************************************"
195 @echo "* BUILDING INSPIRCD *"
197 @echo "* This will take a *long* time. *"
198 @echo "* Why not read our wiki at *"
199 @echo "* http://wiki.inspircd.org *"
200 @echo "* while you wait for make to run? *"
201 @echo "*************************************"
203 finishmessage: target
205 @echo "*************************************"
206 @echo "* BUILD COMPLETE! *"
208 @echo "* To install InspIRCd, type: *"
209 @echo "* make install *"
210 @echo "*************************************"
213 @if [ "$(INSTUID)" = 0 -o "$(INSTUID)" = root ]; then \
215 echo "Error: You must specify a non-root UID for the server"; \
217 echo "If you are making a package, please specify using ./configure --uid"; \
218 echo "Otherwise, rerun using 'make INSTUID=irc install', where 'irc' is the user"; \
219 echo "who will be running the ircd. You will also need to modify the start script."; \
223 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)
224 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/data
225 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/logs
226 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH)
227 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases
228 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules
229 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH)
230 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
231 [ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH)
233 [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH)
235 -$(INSTALL) -m $(INSTMODE_BIN) inspircd $(BASE) 2>/dev/null
236 -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null
237 @IFEQ $(SYSTEM) darwin
238 -$(INSTALL) -m $(INSTMODE_BIN) org.inspircd.plist $(BASE) 2>/dev/null
240 @IFEQ $(SYSTEM) linux
241 -$(INSTALL) -m $(INSTMODE_LIB) inspircd.service $(BASE) 2>/dev/null
243 -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(MANPATH) 2>/dev/null
244 -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(MANPATH) 2>/dev/null
245 -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
246 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
247 -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH)
248 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases
249 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules
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:' $(BASE)/inspircd start
261 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
262 @echo 'Examples are available at:' $(CONPATH)/examples/
264 @TARGET BSD_MAKE CONFIGURE_CACHE_FILE = @CONFIGURE_CACHE_FILE@
265 @TARGET GNU_MAKE CONFIGURE_CACHE_FILE = $(wildcard @CONFIGURE_CACHE_FILE@)
267 GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure $(CONFIGURE_CACHE_FILE)
269 @TARGET BSD_MAKE .MAKEFILEDEPS: BSDmakefile
273 -rm -f $(BUILDPATH)/bin/inspircd $(BUILDPATH)/include $(BUILDPATH)/real.mk
274 -rm -rf $(BUILDPATH)/obj $(BUILDPATH)/modules
275 @-rmdir $(BUILDPATH)/bin 2>/dev/null
276 @-rmdir $(BUILDPATH) 2>/dev/null
280 -rm -f $(BINPATH)/inspircd
281 -rm -rf $(CONPATH)/examples
282 -rm -f $(MANPATH)/inspircd.1
283 -rm -f $(MANPATH)/inspircd-genssl.1
284 -rm -f $(MODPATH)/*.so
285 -rm -f $(BASE)/.gdbargs
286 -rm -f $(BASE)/inspircd.service
287 -rm -f $(BASE)/org.inspircd.plist
292 rm -f include/config.h
295 rm -f inspircd-genssl.1
296 -rm -f inspircd.service
297 -rm -f org.inspircd.plist
298 -rm -f @CONFIGURE_CACHE_FILE@
300 distclean: clean configureclean
301 -rm -rf $(SOURCEPATH)/run
302 find $(SOURCEPATH)/src/modules -type l | xargs rm -f
305 @echo 'InspIRCd Makefile'
307 @echo 'Use: ${MAKE} [flags] [targets]'
310 @echo ' V=1 Show the full command being executed instead of "BUILD: dns.cpp"'
311 @echo ' D=1 Enable debug build, for module development or crash tracing'
312 @echo ' D=2 Enable debug build with optimizations, for detailed backtraces'
313 @echo ' DESTDIR= Specify a destination root directory (for tarball creation)'
314 @echo ' -j <N> Run a parallel build using N jobs'
317 @echo ' all Complete build of InspIRCd, without installing (default)'
318 @echo ' install Build and install InspIRCd to the directory chosen in ./configure'
319 @echo ' Currently installs to ${BASE}'
320 @echo ' debug Compile a debug build. Equivalent to "make D=1 all"'
322 @echo ' M=m_foo Builds a single module (cmd_foo also works here)'
323 @echo ' T=target Builds a user-specified target, such as "inspircd" or "modules"'
324 @echo ' Other targets are specified by their path in the build directory'
325 @echo ' Multiple targets may be separated by a space'
327 @echo ' clean Cleans object files produced by the compile'
328 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
329 @echo ' deinstall Removes the files created by "make install"'
332 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help