summaryrefslogtreecommitdiff
path: root/.Makefile.inc
blob: 99cf6f6e2b4410640b85b4c59344967ad50c945c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#               InspIRCd Main Makefile
#
#       (C) InspIRCd Development Team, 2002-2009
# This file is automagically generated by configure, from
#     .Makefile.inc. Any changes make will go away!
#   Please do not edit unless you know what you're doing.
#

@GNU_ONLY MAKESTYLE = gnu
@GNU_ONLY COMPILE_ROOT ?= $(shell pwd)
@BSD_ONLY MAKESTYLE = bsd
@BSD_ONLY COMPILE_ROOT != pwd

CC = @CC@
SYSTEM = @SYSTEM@
SOCKETENGINE = @SOCKETENGINE@
NICEFLAGS = -pipe -fPIC
LDLIBS = -pthread -lstdc++
SHARED = -shared -rdynamic
CORE_FLAGS = -rdynamic -L.
PICLDFLAGS = -fPIC -DPIC -shared -rdynamic
BASE = "@BASE_DIR@"
CONPATH = "@CONFIG_DIR@"
MODPATH = "@MODULE_DIR@"
BINPATH = "@BINARY_DIR@"
LAUNCHDPATH = "/System/Library/LaunchDaemons"
LIBPATH = "@LIBRARY_DIR@"
INSTMODE = 0755

@IFEQ $(CC) icc
  NICEFLAGS += -Wshadow
  FLAGS = $(NICEFLAGS)
@ELSE
  NICEFLAGS += -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall
  FLAGS = $(NICEFLAGS) -pedantic
@ENDIF


@IFEQ $(SYSTEM) linux
  LDLIBS += -ldl
@ELSIFEQ $(SYSTEM) solaris
  LDLIBS += -lsocket -lnsl -lrt -lresolv
@ELSIFEQ $(SYSTEM) sunos
  LDLIBS += -lsocket -lnsl -lrt -lresolv
@ELSIFEQ $(SYSTEM) darwin
  NICEFLAGS += -DDARWIN -frtti
  LDLIBS += -ldl
  SHARED = -bundle -twolevel_namespace -undefined dynamic_lookup
  CORE_FLAGS = -dynamic -bind_at_load -L.
@ENDIF 

@IFDEF D
    NICEFLAGS += -g3
    HEADER = debug-header
@ELSE
    NICEFLAGS += -g1
    HEADER = std-header
@ENDIF

NICEFLAGS += -I$(COMPILE_ROOT)/include

@GNU_ONLY MAKEFLAGS += --no-print-directory

@IFDEF V
    RUNCC = $(CC)
    VERBOSE = -v
@ELSE
    @GNU_ONLY MAKEFLAGS += --silent
    @BSD_ONLY MAKE += -s
    RUNCC = $(COMPILE_ROOT)/make/run-cc.pl $(CC)
@ENDIF

@DO_EXPORT RUNCC FLAGS NICEFLAGS CC LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORE_FLAGS
@DO_EXPORT BASE CONPATH MODPATH BINPATH LIBPATH

# Default target

@IFDEF M
    _all: module
    @BSD_ONLY MODNAME = ${M:S/.so$//}
    @GNU_ONLY MODNAME = $(M:.so=)
@ENDIF

all: finishmessage

alldep:
	@$(MAKEENV) $(MAKE) -C src -f ../make/$(MAKESTYLE)-dep.mk alldep

allreal: $(HEADER) alldep
	@$(MAKEENV) $(MAKE) -C src -f ../make/$(MAKESTYLE)-real.mk all

module:
	cd src; if [ -d modules/$(MODNAME) ]; then ../make/calcdep.pl modules/$(MODNAME) modules/$(MODNAME)/*.cpp; else ../make/calcdep.pl modules/$(MODNAME).cpp; fi
	$(MAKEENV) $(MAKE) -C src -f ../make/$(MAKESTYLE)-real.mk modules/$(MODNAME).so

debug:
	@${MAKE} D=1 all

debug-header:
	@echo "*************************************"
	@echo "*    BUILDING WITH DEBUG SYMBOLS    *"
	@echo "*                                   *"
	@echo "*   This will take a *long* time.   *"
	@echo "*  Please be aware that this build  *"
	@echo "*  will consume a very large amount *"
	@echo "*  of disk space (150MB+), and can  *"
	@echo "*  run slower. Use the debug build  *"
	@echo "*  for module development or if you *"
	@echo "*    are experiencing problems.     *"
	@echo "*                                   *"
	@echo "*************************************"

std-header:
	@echo "*************************************"
	@echo "*       BUILDING INSPIRCD           *"
	@echo "*                                   *"
	@echo "*   This will take a *long* time.   *"
	@echo "*     Why not read our wiki at      *"
	@echo "*     http://wiki.inspircd.org      *"
	@echo "*  while you wait for make to run?  *"
	@echo "*************************************"

finishmessage: allreal
	@echo ""
	@echo "*************************************"
	@echo "*        BUILD COMPLETE!            *"
	@echo "*                                   *"
	@echo "*   To install InspIRCd, type:      *"
	@echo "*         make install              *"
	@echo "*************************************"

install: allreal@EXTRA_DIR@
	@-install -d -m $(INSTMODE) $(BASE)
	@-install -d -m $(INSTMODE) $(LIBPATH)
	@-install -d -m $(INSTMODE) $(BINPATH)
	@-install -d -m $(INSTMODE) $(CONPATH)
	@-install -d -m $(INSTMODE) $(MODPATH)
	-install -m $(INSTMODE) src/commands/*.so $(LIBPATH)
	-install -m $(INSTMODE) src/modules/*.so $(MODPATH)
	-install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null
	-install -m $(INSTMODE) src/inspircd $(BINPATH)
	@$(MAKEENV) make/install-extras.pl install
	@echo ""
	@echo "*************************************"
	@echo "*        INSTALL COMPLETE!          *"
	@echo "*                                   *"
	@echo "* It is safe to ignore any messages *"
	@echo "* related to copying of conf files. *"
	@echo "*                                   *"
	@echo "* REMEMBER TO EDIT YOUR CONFIG FILE *"
	@echo "*************************************"

clean:
	@echo Cleaning...
	@rm -f src/inspircd src/modes/modeclasses.a
	@rm -f src/*.so src/modules/*.so src/commands/*.so src/modules/*/*.so
	@rm -f src/*.o src/*/*.o src/modules/*/*.o
	@rm -f src/.*.d src/*/.*.d src/modules/*/.*.d
	@echo Completed.

modclean:
	rm -f src/modules/*.so
	rm -f src/modules/*.o
	rm -f src/modules/*/*.so
	rm -f src/modules/*/*.o

deinstall:
	-rm $(BINPATH)/inspircd
	-rm $(LIBPATH)/*.so
	-rm $(MODPATH)/*.so
	@make/install-extras.pl deinstall

squeakyclean: distclean

launchd_dir:
	@-install -d -m $(INSTMODE) ${LAUNCHDPATH}

configureclean:
	rm -f .config.cache
	rm -f src/modules/Makefile
	rm -f src/commands/Makefile
	rm -f src/Makefile
	-rm -f Makefile
	rm -f BSDmakefile
	rm -f GNUmakefile
	rm -f include/inspircd_config.h
	rm -f include/inspircd_se_config.h

distclean: modclean clean configureclean

help:
	@echo 'InspIRCd Makefile'
	@echo ''
	@echo 'Use: ${MAKE} [flags] [targets]'
	@echo ''
	@echo 'Flags:'
	@echo ' V=1       Show the full command being executed instead of "BUILD: dns.cpp"'
	@echo ' D=1       Enable debug build, for module development or crash tracing'
	@echo ' -j <N>    Run a parallel build using N jobs'
	@echo ''
	@echo 'User targets:'
	@echo ' all       Complete build of InspIRCd, without installing'
	@echo ' install   Build and install InspIRCd to the directory chosen in ./configure'
	@echo '           Currently installs to ${BASE}'
	@echo ' debug     Compile a debug build. Equivalent to "make D=1 all"'
	@echo ' module    Builds a single module, which is specified by "M=m_modname"'
	@echo '           The command "make M=m_modname" is a shortcut for this target'
	@echo ''
	@echo ' clean     Cleans object files produced by the compile'
	@echo ' distclean Cleans all files produced by compile and ./configure'
	@echo ' deinstall Removes the files created by "make install"'
	@echo

.PHONY: all help debug debug-header std-header ircd mods finishmessage install module clean modclean deinstall squeakyclean launchd_dir configureclean