2 # InspIRCd -- Internet Relay Chat Daemon
4 # Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
6 # This file is part of InspIRCd. InspIRCd is free software: you can
7 # redistribute it and/or modify it under the terms of the GNU General Public
8 # License as published by the Free Software Foundation, version 2.
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # InspIRCd Main Makefile
23 # This file is automagically generated by configure, from
24 # make/template/main.mk. Any changes made to the generated
25 # files will go away whenever it is regenerated!
27 # Please do not edit unless you know what you're doing. This
28 # needs to work in both GNU and BSD make; it is mangled for
35 BUILDPATH = @BUILD_DIR@
36 SOCKETENGINE = @SOCKETENGINE@
37 CXXFLAGS = -fPIC -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
38 LDLIBS = -pthread -lstdc++
39 CORELDFLAGS = -rdynamic -L. $(LDFLAGS)
40 PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS)
41 BASE = "$(DESTDIR)@BASE_DIR@"
42 CONPATH = "$(DESTDIR)@CONFIG_DIR@"
43 MODPATH = "$(DESTDIR)@MODULE_DIR@"
44 DATPATH = "$(DESTDIR)@DATA_DIR@"
45 BINPATH = "$(DESTDIR)@BINARY_DIR@"
54 CXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute
60 @IFEQ $(SYSTEM) gnukfreebsd
66 @IFEQ $(SYSTEM) solaris
67 LDLIBS += -lsocket -lnsl -lrt -lresolv
70 @IFEQ $(SYSTEM) darwin
72 CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS)
73 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS)
90 CXXFLAGS += -O0 -g3 -Werror
99 FOOTER = finishmessage
101 @GNU_ONLY MAKEFLAGS += --no-print-directory
103 @GNU_ONLY SOURCEPATH = $(shell /bin/pwd)
104 @BSD_ONLY SOURCEPATH != /bin/pwd
111 @GNU_ONLY MAKEFLAGS += --silent
113 RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CC)
114 RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CC)
118 CXXFLAGS += -DPURE_STATIC
121 @DO_EXPORT RUNCC RUNLD CXXFLAGS LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS
122 @DO_EXPORT SOURCEPATH BUILDPATH PURE_STATIC SPLIT_CC
130 @BSD_ONLY TARGET = modules/${M:S/.so$//}.so
131 @GNU_ONLY TARGET = modules/$(M:.so=).so
141 HEADER = unknown-debug-level
147 $(MAKEENV) perl make/calcdep.pl
148 cd $(BUILDPATH); $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
154 @echo "*************************************"
155 @echo "* BUILDING WITH DEBUG SYMBOLS *"
157 @echo "* This will take a *long* time. *"
158 @echo "* Please be aware that this build *"
159 @echo "* will consume a very large amount *"
160 @echo "* of disk space (~350MB), and may *"
161 @echo "* run slower. Use the debug build *"
162 @echo "* for module development or if you *"
163 @echo "* are experiencing problems. *"
165 @echo "*************************************"
169 @echo 'Cannot build single modules in pure-static build'
172 @echo 'Building single module:'
175 @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)'
176 @echo 'Or, run "make install"'
179 @echo "*************************************"
180 @echo "* BUILDING INSPIRCD *"
182 @echo "* This will take a *long* time. *"
183 @echo "* Why not read our wiki at *"
184 @echo "* http://wiki.inspircd.org *"
185 @echo "* while you wait for make to run? *"
186 @echo "*************************************"
188 finishmessage: target
190 @echo "*************************************"
191 @echo "* BUILD COMPLETE! *"
193 @echo "* To install InspIRCd, type: *"
194 @echo "* make install *"
195 @echo "*************************************"
198 @if [ "$(INSTUID)" = 0 -o "$(INSTUID)" = root ]; then \
200 echo "Error: You must specify a non-root UID for the server"; \
202 echo "If you are making a package, please specify using ./configure --uid"; \
203 echo "Otherwise, rerun using 'make INSTUID=irc install', where 'irc' is the user"; \
204 echo "who will be running the ircd. You will also need to modify the start script."; \
208 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)
209 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/data
210 @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/logs
211 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH)
212 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases
213 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules
214 @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
215 [ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH)
217 [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH)
219 -$(INSTALL) -m $(INSTMODE_BIN) @STARTSCRIPT@ $(BASE) 2>/dev/null
220 -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
221 -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs $(BASE)/.gdbargs 2>/dev/null
222 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
223 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases
224 -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules
226 @echo "*************************************"
227 @echo "* INSTALL COMPLETE! *"
228 @echo "*************************************"
230 @echo ' Base install:' $(BASE)
231 @echo ' Configuration:' $(CONPATH)
232 @echo ' Binaries:' $(BINPATH)
233 @echo ' Modules:' $(MODPATH)
234 @echo ' Data:' $(DATPATH)
235 @echo 'To start the ircd, run:' $(BASE)/inspircd start
236 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
237 @echo 'Examples are available at:' $(CONPATH)/examples/
239 @GNU_ONLY RCS_FILES = $(wildcard .git/index src/version.sh)
240 @BSD_ONLY RCS_FILES = src/version.sh
241 GNUmakefile BSDmakefile: make/template/main.mk configure $(RCS_FILES)
243 @BSD_ONLY .MAKEFILEDEPS: BSDmakefile
247 -rm -f $(BUILDPATH)/bin/inspircd $(BUILDPATH)/include $(BUILDPATH)/real.mk
248 -rm -rf $(BUILDPATH)/obj $(BUILDPATH)/modules
249 @-rmdir $(BUILDPATH)/bin 2>/dev/null
250 @-rmdir $(BUILDPATH) 2>/dev/null
254 -rm -f $(BINPATH)/inspircd
255 -rm -rf $(CONPATH)/examples
256 -rm -f $(MODPATH)/*.so
257 -rm -f $(BASE)/.gdbargs
258 -rm -f $(BASE)/org.inspircd.plist
260 squeakyclean: distclean
266 rm -f include/config.h
268 -rm -f org.inspircd.plist
270 distclean: clean configureclean
271 -rm -rf $(SOURCEPATH)/run
272 find $(SOURCEPATH)/src/modules -type l | xargs rm -f
275 @echo 'InspIRCd Makefile'
277 @echo 'Use: ${MAKE} [flags] [targets]'
280 @echo ' V=1 Show the full command being executed instead of "BUILD: dns.cpp"'
281 @echo ' D=1 Enable debug build, for module development or crash tracing'
282 @echo ' D=2 Enable debug build with optimizations, for detailed backtraces'
283 @echo ' DESTDIR= Specify a destination root directory (for tarball creation)'
284 @echo ' -j <N> Run a parallel build using N jobs'
287 @echo ' all Complete build of InspIRCd, without installing (default)'
288 @echo ' install Build and install InspIRCd to the directory chosen in ./configure'
289 @echo ' Currently installs to ${BASE}'
290 @echo ' debug Compile a debug build. Equivalent to "make D=1 all"'
292 @echo ' M=m_foo Builds a single module (cmd_foo also works here)'
293 @echo ' T=target Builds a user-specified target, such as "inspircd" or "modules"'
294 @echo ' Other targets are specified by their path in the build directory'
295 @echo ' Multiple targets may be separated by a space'
297 @echo ' clean Cleans object files produced by the compile'
298 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
299 @echo ' deinstall Removes the files created by "make install"'
302 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall squeakyclean configureclean help