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.
40 PICLDFLAGS = -fPIC -shared -rdynamic
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@"
54 ifneq ($(COMPILER), ICC)
55 CORECXXFLAGS += -Woverloaded-virtual -Wshadow
56 ifneq ($(SYSTEM), openbsd)
57 CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute -Wno-format-nonliteral
61 ifneq ($(SYSTEM), darwin)
65 ifeq ($(SYSTEM), linux)
68 ifeq ($(SYSTEM), gnukfreebsd)
74 ifeq ($(SYSTEM), solaris)
75 LDLIBS += -lsocket -lnsl -lrt -lresolv
78 ifeq ($(SYSTEM), darwin)
80 CORELDFLAGS = -dynamic -bind_at_load -L.
81 PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup
83 ifeq ($(SYSTEM), haiku)
84 LDLIBS = -lnetwork -lstdc++
86 PICLDFLAGS = -fPIC -shared
94 ifeq ($(INSPIRCD_DEBUG), 0)
95 CORECXXFLAGS += -fno-rtti -O2
96 ifeq ($(COMPILER), GCC)
102 ifeq ($(INSPIRCD_DEBUG), 1)
103 CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI
104 HEADER = debug-header
107 ifeq ($(INSPIRCD_DEBUG), 2)
108 CORECXXFLAGS += -fno-rtti -O2 -g3
109 HEADER = debug-header
112 FOOTER = finishmessage
114 MAKEFLAGS += --no-print-directory
116 SOURCEPATH = $(shell pwd)
118 ifndef INSPIRCD_VERBOSE
119 MAKEFLAGS += --silent
122 # Append any flags set in the environment after the base flags so
123 # that they can be overridden if necessary.
124 CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS)
125 CORELDFLAGS += $(LDFLAGS)
126 PICLDFLAGS += $(LDFLAGS)
132 export INSPIRCD_VERBOSE
141 ifdef INSPIRCD_TARGET
144 TARGET = $(INSPIRCD_TARGET)
148 HEADER = unknown-debug-level
154 $(MAKEENV) perl make/calcdep.pl
155 cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
158 @${MAKE} INSPIRCD_DEBUG=1 all
161 @echo "*************************************"
162 @echo "* BUILDING WITH DEBUG SYMBOLS *"
164 @echo "* This will take a *long* time. *"
165 @echo "* Please be aware that this build *"
166 @echo "* will consume a very large amount *"
167 @echo "* of disk space (~350MB), and may *"
168 @echo "* run slower. Use the debug build *"
169 @echo "* for module development or if you *"
170 @echo "* are experiencing problems. *"
172 @echo "*************************************"
175 @echo 'Building specific targets:'
178 @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)'
179 @echo 'Or, run "make install"'
182 @echo "*************************************"
183 @echo "* BUILDING INSPIRCD *"
185 @echo "* This will take a *long* time. *"
186 @echo "* Why not read our wiki at *"
187 @echo "* https://wiki.inspircd.org *"
188 @echo "* while you wait for Make to run? *"
189 @echo "*************************************"
191 finishmessage: target
193 @echo "*************************************"
194 @echo "* BUILD COMPLETE! *"
196 @echo "* To install InspIRCd, type: *"
197 @echo "* 'make install' *"
198 @echo "*************************************"
201 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BASE)
202 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(DATPATH)
203 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(LOGPATH)
204 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(BINPATH)
205 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(CONPATH)/examples/services
206 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(CONPATH)/examples/sql
207 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MANPATH)
208 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(MODPATH)
209 @-$(INSTALL) -d -g @GID@ -o @UID@ -m $(INSTMODE_DIR) $(SCRPATH)
210 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
211 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH)
212 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
213 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) .gdbargs $(SCRPATH)/.gdbargs 2>/dev/null
214 ifeq ($(SYSTEM), darwin)
215 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
217 ifeq ($(SYSTEM), linux)
218 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
220 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
221 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
222 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
223 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
224 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) docs/conf/services/*.example $(CONPATH)/examples/services
225 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) docs/sql/*.sql $(CONPATH)/examples/sql
226 -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_LIB) *.pem $(CONPATH) 2>/dev/null
228 @echo "*************************************"
229 @echo "* INSTALL COMPLETE! *"
230 @echo "*************************************"
232 @echo ' Base install:' $(BASE)
233 @echo ' Configuration:' $(CONPATH)
234 @echo ' Binaries:' $(BINPATH)
235 @echo ' Modules:' $(MODPATH)
236 @echo ' Data:' $(DATPATH)
237 @echo 'To start the ircd, run:' $(SCRPATH)/inspircd start
238 @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
239 @echo 'Examples are available at:' $(CONPATH)/examples/
241 GNUmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@
246 -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk"
247 -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules"
248 @-rmdir "$(BUILDPATH)/bin" 2>/dev/null
249 @-rmdir "$(BUILDPATH)" 2>/dev/null
253 -rm -f $(BINPATH)/inspircd
254 -rm -rf $(CONPATH)/examples
255 -rm -f $(MANPATH)/inspircd.1
256 -rm -f $(MANPATH)/inspircd-genssl.1
257 -rm -f $(MODPATH)/m_*.so
258 -rm -f $(MODPATH)/core_*.so
259 -rm -f $(SCRPATH)/.gdbargs
260 -rm -f $(SCRPATH)/inspircd.service
261 -rm -f $(SCRPATH)/org.inspircd.plist
267 rm -f include/config.h
268 rm -rf @CONFIGURE_DIRECTORY@
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 ' INSPIRCD_VERBOSE=1 Show the full command being executed instead of "BUILD: dns.cpp"'
281 @echo ' INSPIRCD_DEBUG=1 Enable debug build, for module development or crash tracing'
282 @echo ' INSPIRCD_DEBUG=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 ' INSPIRCD_TARGET=target Builds a user-specified target, such as "inspircd" or "core_dns"'
293 @echo ' Multiple targets may be separated by a space'
295 @echo ' clean Cleans object files produced by the compile'
296 @echo ' distclean Cleans all generated files (build, configure, run, etc)'
297 @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 configureclean help