]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - make/template/main.mk
Remove exception handling from StreamSocket methods calling IOHooks
[user/henk/code/inspircd.git] / make / template / main.mk
1 %target BSD_MAKE BSDmakefile
2 %target GNU_MAKE GNUmakefile
3 #
4 # InspIRCd -- Internet Relay Chat Daemon
5 #
6 #   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
7 #
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.
11 #
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
15 # details.
16 #
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/>.
19 #
20
21
22 #
23 #               InspIRCd Main Makefile
24 #
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!
28 #
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
31 # them by configure.
32 #
33
34
35 CXX = @CXX@
36 COMPILER = @COMPILER_NAME@
37 SYSTEM = @SYSTEM_NAME@
38 BUILDPATH ?= $(PWD)/build
39 SOCKETENGINE = @SOCKETENGINE@
40 CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
41 LDLIBS = -lstdc++
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@"
50 INSTALL = install
51 INSTUID = @UID@
52 INSTMODE_DIR = 0750
53 INSTMODE_BIN = 0750
54 INSTMODE_LIB = 0640
55
56 @IFNEQ $(COMPILER) ICC
57   CORECXXFLAGS += -Woverloaded-virtual -Wshadow
58 @IFNEQ $(SYSTEM) openbsd
59     CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute
60 @ENDIF
61 @ENDIF
62
63 @IFNEQ $(SYSTEM) darwin
64   LDLIBS += -pthread
65 @ENDIF
66
67 @IFEQ $(SYSTEM) linux
68   LDLIBS += -ldl -lrt
69 @ENDIF
70 @IFEQ $(SYSTEM) gnukfreebsd
71   LDLIBS += -ldl -lrt
72 @ENDIF
73 @IFEQ $(SYSTEM) gnu
74   LDLIBS += -ldl -lrt
75 @ENDIF
76 @IFEQ $(SYSTEM) solaris
77   LDLIBS += -lsocket -lnsl -lrt -lresolv
78   INSTALL = ginstall
79 @ENDIF
80 @IFEQ $(SYSTEM) darwin
81   LDLIBS += -ldl
82   CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS)
83   PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS)
84 @ENDIF
85
86 @IFNDEF D
87   D=0
88 @ENDIF
89
90 DBGOK=0
91 @IFEQ $(D) 0
92   CORECXXFLAGS += -fno-rtti -O2
93 @IFEQ $(COMPILER) GCC
94     CORECXXFLAGS += -g1
95 @ENDIF
96   HEADER = std-header
97   DBGOK=1
98 @ENDIF
99 @IFEQ $(D) 1
100   CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI
101   HEADER = debug-header
102   DBGOK=1
103 @ENDIF
104 @IFEQ $(D) 2
105   CORECXXFLAGS += -fno-rtti -O2 -g3
106   HEADER = debug-header
107   DBGOK=1
108 @ENDIF
109 FOOTER = finishmessage
110
111 @TARGET GNU_MAKE MAKEFLAGS += --no-print-directory
112
113 @TARGET GNU_MAKE SOURCEPATH = $(shell /bin/pwd)
114 @TARGET BSD_MAKE SOURCEPATH != /bin/pwd
115
116 @IFDEF V
117   RUNCC = $(CXX)
118   RUNLD = $(CXX)
119   VERBOSE = -v
120 @ELSE
121   @TARGET GNU_MAKE MAKEFLAGS += --silent
122   @TARGET BSD_MAKE MAKE += -s
123   RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CXX)
124   RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CXX)
125 @ENDIF
126
127 @IFDEF PURE_STATIC
128   CORECXXFLAGS += -DPURE_STATIC
129 @ENDIF
130
131 # Add the users CXXFLAGS to the base ones to allow them to override
132 # things like -Wfatal-errors if they wish to.
133 CORECXXFLAGS += $(CXXFLAGS)
134
135 @DO_EXPORT RUNCC RUNLD CORECXXFLAGS LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS
136 @DO_EXPORT SOURCEPATH BUILDPATH PURE_STATIC
137
138 # Default target
139 TARGET = all
140
141 @IFDEF M
142     HEADER = mod-header
143     FOOTER = mod-footer
144     @TARGET BSD_MAKE TARGET = modules/${M:S/.so$//}.so
145     @TARGET GNU_MAKE TARGET = modules/$(M:.so=).so
146 @ENDIF
147
148 @IFDEF T
149     HEADER =
150     FOOTER = target
151     TARGET = $(T)
152 @ENDIF
153
154 @IFEQ $(DBGOK) 0
155   HEADER = unknown-debug-level
156 @ENDIF
157
158 all: $(FOOTER)
159
160 target: $(HEADER)
161         $(MAKEENV) perl make/calcdep.pl
162         cd $(BUILDPATH); $(MAKEENV) $(MAKE) -f real.mk $(TARGET)
163
164 debug:
165         @${MAKE} D=1 all
166
167 debug-header:
168         @echo "*************************************"
169         @echo "*    BUILDING WITH DEBUG SYMBOLS    *"
170         @echo "*                                   *"
171         @echo "*   This will take a *long* time.   *"
172         @echo "*  Please be aware that this build  *"
173         @echo "*  will consume a very large amount *"
174         @echo "*  of disk space (~350MB), and may  *"
175         @echo "*  run slower. Use the debug build  *"
176         @echo "*  for module development or if you *"
177         @echo "*    are experiencing problems.     *"
178         @echo "*                                   *"
179         @echo "*************************************"
180
181 mod-header:
182 @IFDEF PURE_STATIC
183         @echo 'Cannot build single modules in pure-static build'
184         @exit 1
185 @ENDIF
186         @echo 'Building single module:'
187
188 mod-footer: target
189         @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)'
190         @echo 'Or, run "make install"'
191
192 std-header:
193         @echo "*************************************"
194         @echo "*       BUILDING INSPIRCD           *"
195         @echo "*                                   *"
196         @echo "*   This will take a *long* time.   *"
197         @echo "*     Why not read our wiki at      *"
198         @echo "*     http://wiki.inspircd.org      *"
199         @echo "*  while you wait for make to run?  *"
200         @echo "*************************************"
201
202 finishmessage: target
203         @echo ""
204         @echo "*************************************"
205         @echo "*        BUILD COMPLETE!            *"
206         @echo "*                                   *"
207         @echo "*   To install InspIRCd, type:      *"
208         @echo "*         make install              *"
209         @echo "*************************************"
210
211 install: target
212         @if [ "$(INSTUID)" = 0 -o "$(INSTUID)" = root ]; then \
213                 echo ""; \
214                 echo "Error: You must specify a non-root UID for the server"; \
215                 echo ""; \
216                 echo "If you are making a package, please specify using ./configure --uid"; \
217                 echo "Otherwise, rerun using 'make INSTUID=irc install', where 'irc' is the user"; \
218                 echo "who will be running the ircd. You will also need to modify the start script."; \
219                 echo ""; \
220                 exit 1; \
221         fi
222         @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)
223         @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/data
224         @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/logs
225         @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH)
226         @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases
227         @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules
228         @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH)
229         @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
230         [ $(BUILDPATH)/bin/ -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) $(BUILDPATH)/bin/inspircd $(BINPATH)
231 @IFNDEF PURE_STATIC
232         [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH)
233 @ENDIF
234         -$(INSTALL) -m $(INSTMODE_BIN) inspircd $(BASE) 2>/dev/null
235         -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null
236 @IFEQ $(SYSTEM) darwin
237         -$(INSTALL) -m $(INSTMODE_BIN) org.inspircd.plist $(BASE) 2>/dev/null
238 @ENDIF
239 @IFEQ $(SYSTEM) linux
240         -$(INSTALL) -m $(INSTMODE_LIB) inspircd.service $(BASE) 2>/dev/null
241 @ENDIF
242         -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(MANPATH) 2>/dev/null
243         -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(MANPATH) 2>/dev/null
244         -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
245         -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
246         -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH) 2>/dev/null
247         -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases
248         -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules
249         @echo ""
250         @echo "*************************************"
251         @echo "*        INSTALL COMPLETE!          *"
252         @echo "*************************************"
253         @echo 'Paths:'
254         @echo '  Base install:' $(BASE)
255         @echo '  Configuration:' $(CONPATH)
256         @echo '  Binaries:' $(BINPATH)
257         @echo '  Modules:' $(MODPATH)
258         @echo '  Data:' $(DATPATH)
259         @echo 'To start the ircd, run:' $(BASE)/inspircd start
260         @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
261         @echo 'Examples are available at:' $(CONPATH)/examples/
262
263 GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@
264         ./configure --update
265 @TARGET BSD_MAKE .MAKEFILEDEPS: BSDmakefile
266
267 clean:
268         @echo Cleaning...
269         -rm -f $(BUILDPATH)/bin/inspircd $(BUILDPATH)/include $(BUILDPATH)/real.mk
270         -rm -rf $(BUILDPATH)/obj $(BUILDPATH)/modules
271         @-rmdir $(BUILDPATH)/bin 2>/dev/null
272         @-rmdir $(BUILDPATH) 2>/dev/null
273         @echo Completed.
274
275 deinstall:
276         -rm -f $(BINPATH)/inspircd
277         -rm -rf $(CONPATH)/examples
278         -rm -f $(MANPATH)/inspircd.1
279         -rm -f $(MANPATH)/inspircd-genssl.1
280         -rm -f $(MODPATH)/*.so
281         -rm -f $(BASE)/.gdbargs
282         -rm -f $(BASE)/inspircd.service
283         -rm -f $(BASE)/org.inspircd.plist
284
285 configureclean:
286         rm -f BSDmakefile
287         rm -f GNUmakefile
288         rm -f include/config.h
289         rm -f inspircd
290         rm -f inspircd.1
291         rm -f inspircd-genssl.1
292         -rm -f inspircd.service
293         -rm -f org.inspircd.plist
294         -rm -f @CONFIGURE_CACHE_FILE@
295
296 distclean: clean configureclean
297         -rm -rf $(SOURCEPATH)/run
298         find $(SOURCEPATH)/src/modules -type l | xargs rm -f
299
300 help:
301         @echo 'InspIRCd Makefile'
302         @echo ''
303         @echo 'Use: ${MAKE} [flags] [targets]'
304         @echo ''
305         @echo 'Flags:'
306         @echo ' V=1       Show the full command being executed instead of "BUILD: dns.cpp"'
307         @echo ' D=1       Enable debug build, for module development or crash tracing'
308         @echo ' D=2       Enable debug build with optimizations, for detailed backtraces'
309         @echo ' DESTDIR=  Specify a destination root directory (for tarball creation)'
310         @echo ' -j <N>    Run a parallel build using N jobs'
311         @echo ''
312         @echo 'Targets:'
313         @echo ' all       Complete build of InspIRCd, without installing (default)'
314         @echo ' install   Build and install InspIRCd to the directory chosen in ./configure'
315         @echo '           Currently installs to ${BASE}'
316         @echo ' debug     Compile a debug build. Equivalent to "make D=1 all"'
317         @echo ''
318         @echo ' M=m_foo   Builds a single module (cmd_foo also works here)'
319         @echo ' T=target  Builds a user-specified target, such as "inspircd" or "modules"'
320         @echo '           Other targets are specified by their path in the build directory'
321         @echo '           Multiple targets may be separated by a space'
322         @echo ''
323         @echo ' clean     Cleans object files produced by the compile'
324         @echo ' distclean Cleans all generated files (build, configure, run, etc)'
325         @echo ' deinstall Removes the files created by "make install"'
326         @echo
327
328 .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help