1 #/************************************************************************
2 #* IRC - Internet Relay Chat, Makefile
3 #* Copyright (C) 1990, Jarkko Oikarinen
5 #* This program is free software; you can redistribute it and/or modify
6 #* it under the terms of the GNU General Public License as published by
7 #* the Free Software Foundation; either version 1, or (at your option)
10 #* This program is distributed in the hope that it will be useful,
11 #* but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #* GNU General Public License for more details.
15 #* You should have received a copy of the GNU General Public License
16 #* along with this program; if not, write to the Free Software
17 #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 FROMDOS=/home/cmunk/bin/4dos
29 # Change XCFLAGS if you don't like what Config puts there. Same with
32 # If you are configuring by hand, try "-O -g" for XCFLAGS, and leave
33 # IRCDLIBS blank. If that fails, try recomendations below.
36 #XCFLAGS=-O -g -export-dynamic
37 IRCDLIBS=@IRCDLIBS@ @TRE_LIBS@ @CARES_LIBS@
41 XCFLAGS=@TRE_CFLAGS@ @CARES_CFLAGS@ @CFLAGS@
43 # use the following on MIPS:
44 #CFLAGS= -systype bsd43 -DSYSTYPE_BSD43 -I$(INCLUDEDIR)
45 # For Irix 4.x (SGI), use the following:
46 #CFLAGS= -g -cckr -I$(INCLUDEDIR)
49 #CFLAGS=-bsd -I$(INCLUDEDIR)
50 #on NeXT other than 2.0:
54 #CFLAGS=-D_BSD -Hxa -I$(INCLUDEDIR)
58 #CFLAGS= -I$(INCLUDEDIR) -O -Xo
59 #IRCDLIBS= -lsocket -linet -lnsl -lseq
62 #IRCDLIBS= -lsocket -linet -lnsl -lseq
64 #use the following on SUN OS without nameserver libraries inside libc
68 #IRCDLIBS=-lsocket -lnsl -lresolv -L/usr/ucblib -R/usr/ucblib -lgen
71 #CFLAGS=-O -I$(INCLUDEDIR) -I/usr/ucbinclude
72 #IRCDLIBS=-L/usr/ucblib -L/usr/lib -lsocket -lucb -lns -lnsl
74 # LDFLAGS - flags to send the loader (ld). SunOS users may want to add
81 #CFLAGS= -I$(INCLUDEDIR) -O2
82 #IRCDLIBS=-lsocket -lnsl -lucb
85 # IRCDMODE is the mode you want the binary to be.
86 # The 4 at the front is important (allows for setuidness)
88 # WARNING: if you are making ircd SUID or SGID, check config.h to make sure
89 # you are not defining CMDLINE_CONFIG
93 # IRCDDIR must be the same as DPATH in include/config.h
101 # If you get a link-time error dealing with strtoul, comment out
107 # If you get crashes around a specific number of clients, and that
108 # client load comes close or a little over the system-defined value of
109 # FD_SETSIZE, override it here and see what happens. You may override
110 # the system FD_SETSIZE by setting the FD_SETSIZE Makefile variable to
111 # -DFD_SETSIZE=<some number>.
112 FD_SETSIZE=@FD_SETSIZE@
114 # Where is your openssl binary
115 OPENSSLPATH=@OPENSSLPATH@
117 CFLAGS=-I$(INCLUDEDIR) $(XCFLAGS) @LDFLAGS@ $(FD_SETSIZE)
129 MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'IRCDLIBS=${IRCDLIBS}' \
130 'LDFLAGS=${LDFLAGS}' 'IRCDMODE=${IRCDMODE}' \
131 'RES=${RES}' 'BINDIR=${BINDIR}' 'INSTALL=${INSTALL}' \
132 'INCLUDEDIR=${INCLUDEDIR}' 'IRCDDIR=${IRCDDIR}' \
133 'RM=${RM}' 'CP=${CP}' 'TOUCH=${TOUCH}' \
134 'SHELL=${SHELL}' 'STRTOUL=${STRTOUL}' \
135 'CRYPTOLIB=${CRYPTOLIB}' \
136 'CRYPTOINCLUDES=${CRYPTOINCLUDES}' \
140 @if test -z "${MODULEFILE}"; then echo "Please set MODULEFILE when calling \`\`make custommodule''. For example, \`\`make custommodule MODULEFILE=callerid''." >&2; exit 1; fi
141 cd src; ${MAKE} ${MAKEARGS} MODULEFILE=${MODULEFILE} 'EXLIBS=${EXLIBS}' custommodule
145 -@if [ ! -f include/setup.h ] ; then \
146 echo "Hmm...doesn't look like you've run Config..."; \
147 echo "Doing so now."; \
150 @for i in $(SUBDIRS); do \
151 echo "Building $$i";\
152 ( cd $$i; ${MAKE} ${MAKEARGS} build; ) \
154 @echo ' __________________________________________________ '
155 @echo '| Compile is now complete. |'
156 @echo '| You should now read the documentation and learn |'
157 @echo '| how to configure your IRCd. |'
159 @echo '| If you really like UnrealIRCd, and would like to |'
160 @echo '| make a donation, please read the Donation file in|'
161 @echo '| this archive. :) |'
163 @echo '| Thanks for using Unreal IRCd! If you are in need |'
164 @echo '| for any kind of help regarding the IRCd please |'
165 @echo '| read the Unreal.nfo file. |'
166 @echo '|__________________________________________________|'
169 $(RM) -f *~ \#* core *.orig include/*.orig
170 @for i in $(SUBDIRS); do \
171 echo "Cleaning $$i";\
172 ( cd $$i; ${MAKE} ${MAKEARGS} clean; ) \
174 -@if [ -f include/setup.h ] ; then \
175 echo "To really restart installation, remove include/setup.h" ; \
179 rm -rf include/networks.h include/setup.h Makefile Settings
182 chmod +x Config newnet ircd ircdcron/ircdchk killircd
183 chmod +x rehash ircdreg
188 $(FROMDOS) -dv include/*
190 $(FROMDOS) -dv crypt/*
191 $(FROMDOS) -dv ircdcron/*
196 echo "/* Auto created release stamping */" > include/stamp.h
197 echo "#define RELEASEID2 \"`date +%s`\"" >> include/stamp.h
198 echo "#define RELEASESTUFF \"`hostname`\"" >> include/stamp.h
199 echo "" >> include/stamp.h
202 @for i in $(SUBDIRS); do \
203 echo "Making dependencies in $$i";\
204 ( cd $$i; ${MAKE} ${MAKEARGS} depend; ) \
208 $(INSTALL) -m 0700 -d $(IRCDDIR)
209 $(INSTALL) -m 0700 src/ircd $(BINDIR) 2>/dev/null || { $(INSTALL) -m 0700 -d "$$(dirname '$(BINDIR)')"; $(INSTALL) -m 0700 src/ircd $(BINDIR); }
210 $(INSTALL) -m 0700 -d $(IRCDDIR)/networks
211 $(INSTALL) -m 0600 networks/*.network $(IRCDDIR)/networks
212 $(INSTALL) -m 0700 networks/makenet $(IRCDDIR)/networks
213 $(INSTALL) -m 0600 networks/networks.ndx $(IRCDDIR)/networks
214 $(INSTALL) -m 0700 -d $(IRCDDIR)/doc
215 $(INSTALL) -m 0600 doc/Authors doc/example.conf doc/coding-guidelines doc/tao.of.irc doc/unreal32docs.html $(IRCDDIR)/doc
216 $(INSTALL) -m 0700 -d $(IRCDDIR)/aliases
217 $(INSTALL) -m 0600 aliases/*.conf $(IRCDDIR)/aliases
218 $(TOUCH) $(IRCDDIR)/unrealircd.conf
219 chmod 0600 $(IRCDDIR)/unrealircd.conf
220 $(INSTALL) -m 0600 spamfilter.conf dccallow.conf $(IRCDDIR)
221 $(INSTALL) -m 0600 badwords.*.conf help.conf LICENSE Donation $(IRCDDIR)
222 $(INSTALL) -m 0700 unreal $(IRCDDIR)
223 $(INSTALL) -m 0700 -d $(IRCDDIR)/modules
224 $(INSTALL) -m 0700 src/modules/*.so $(IRCDDIR)/modules
225 $(INSTALL) -m 0700 -d $(IRCDDIR)/ircdcron
226 $(INSTALL) -m 0600 ircdcron/ircd.cron $(IRCDDIR)/ircdcron
227 $(INSTALL) -m 0700 ircdcron/ircdchk $(IRCDDIR)/ircdcron
228 -@if [ ! -f "$(IRCDDIR)/curl-ca-bundle.crt" ] ; then \
229 $(INSTALL) -m 0700 curl-ca-bundle.crt $(IRCDDIR) ; \
233 @echo "Generating certificate request .. "
234 $(OPENSSLPATH) req -new \
235 -config src/ssl.cnf -out server.req.pem \
236 -keyout server.key.pem -nodes
237 @echo "Generating self-signed certificate .. "
238 $(OPENSSLPATH) req -x509 -days 365 -in server.req.pem \
239 -key server.key.pem -out server.cert.pem
240 @echo "Generating fingerprint .."
241 $(OPENSSLPATH) x509 -subject -dates -fingerprint -noout \
243 @echo "Setting o-rwx & g-rwx for files... "
244 chmod o-rwx server.req.pem server.key.pem server.cert.pem
245 chmod g-rwx server.req.pem server.key.pem server.cert.pem
246 @echo "Done!. If you want to encrypt the private key, run"
249 encpem: server.key.pem
250 @echo "Encrypting server key .."
251 $(OPENSSLPATH) rsa -in server.key.pem -out server.key.c.pem -des3
252 -@if [ -f server.key.c.pem ] ; then \
253 echo "Replacing unencrypted with encrypted .." ; \
254 cp server.key.c.pem server.key.pem ; \
255 rm -f server.key.c.pem ; \