GNUmakefile 8.95 KB
Newer Older
1
# GNUmakefile
2
3

#########################################################################
4
# Makefile for Synchronet BBS for Unix									#
5
# For use with GNU make and GNU C Compiler or Borland Kylix C++			#
6
7
# @format.tab-size 4, @format.use-tabs true								#
#																		#
8
9
# gcc: gmake															#
# Borland (still in testing/debuging stage): gmake bcc=1				#
10
11
12
13
#																		#
# Optional build targets: dlls, utils, mono, all (default)				#
#########################################################################

14
15
PWD	:=	$(shell pwd)
SRC_ROOT	?=	${PWD}/..
16
include $(SRC_ROOT)/build/Common.gmake
Deucе's avatar
Deucе committed
17
include extdeps.mk
18

19
UTIL_LDFLAGS	:=	$(LDFLAGS)
20
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS) $(ENCODE_LDFLAGS)
21
CONSOLE_LDFLAGS	+=	$(LDFLAGS) $(SMBLIB_LDFLAGS) $(XPDEV_LDFLAGS)
22
UTIL_LIBS	+=	$(HASH_LIBS)
deuce's avatar
deuce committed
23

24
ifndef bcc
deuce's avatar
deuce committed
25
26
27
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
28
29
endif

30
ifeq ($(os),sunos)    # Solaris
deuce's avatar
deuce committed
31
 LDFLAGS += -lnsl -lrt
deuce's avatar
deuce committed
32
 SBBS_LIBS	+=	-lkstat
33
34
endif

35
# So far, only QNX has sem_timedwait()
36
ifeq ($(os),qnx)
37
 LDFLAGS += -lsocket
38
endif
39

40
41
42
43
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

44
ifdef DONT_BLAME_SYNCHRONET
45
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
46
endif
47

deuce's avatar
deuce committed
48
49
ifdef BUILD_JSDOCS
 CFLAGS += -DBUILD_JSDOCS
50
 SBBS_LIBS += ${UIFC-MT_LDFLAGS} ${UIFC-MT_LIBS} $(CIOLIB-MT_LDFLAGS) ${CIOLIB-MT_LIBS}
51
52
 OBJS += $(MTOBJODIR)$(DIRSEP)js_uifc$(OFILE) \
			$(MTOBJODIR)$(DIRSEP)js_conio$(OFILE)
53
 EXTRA_SBBS_DEPENDS += $(CIOLIB-MT) $(UIFCLIB-MT)
deuce's avatar
deuce committed
54
55
endif

56
ifeq ($(os),linux)
57
 SBBS_LIBS += -lutil
58
 ifeq ($(shell test -f /usr/include/sys/capability.h && echo "yes"),yes)
59
  CFLAGS += -DUSE_LINUX_CAPS
60
  CON_LIBS += -lcap
61
62
63
 endif
endif

64
include sbbsdefs.mk
65
MT_CFLAGS	+=	$(SBBSDEFS)
66

67
# Set up LD_RUN_PATH for run-time locating of the .so files
68
ifdef SBBSDIR
69
 ifeq ($(os),sunos)
70
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
71
 else
72
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
73
 endif
74
else
75
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
76
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
77
 else
deuce's avatar
deuce committed
78
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
79
 endif
80
endif
81
export LD_RUN_PATH
deuce's avatar
deuce committed
82
83
84
ifeq ($(CCPRE),clang)
 LDFLAGS += -rpath $(LD_RUN_PATH)
endif
85

86
CON_LIBS	+= -lsbbs -lftpsrvr -lwebsrvr -lmailsrvr -lservices
87
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
88
ifeq ($(os),darwin)
deuce's avatar
deuce committed
89
90
91
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
92
else
deuce's avatar
deuce committed
93
94
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
95
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G
deuce's avatar
deuce committed
96
97
98
99
100
  SHLIBOPTS	:=	
 else
  MKSHLIB		:=	$(CC)
  MKSHPPLIB		:=	$(CXX)
 endif
deuce's avatar
deuce committed
101
endif
102

103
CFLAGS	+=	$(JS_CFLAGS) $(CRYPT_CFLAGS) $(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(ENCODE_CFLAGS) $(HASH_CFLAGS)
104
105
CFLAGS	+=	-I../comio
vpath %.c ../comio
106
107
108
109
ifeq ($(os), win32)
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
else
110
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
111
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
112
endif
113
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(ENCODE_LDFLAGS) $(HASH_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS) $(CRYPT_LDFLAGS)
deuce's avatar
deuce committed
114

115
116
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
117
	@echo Linking $@
deuce's avatar
deuce committed
118
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS) $(JS_LIBS) $(CRYPT_LIBS)
119
120

# Synchronet BBS library Link Rule
121
$(SBBS): $(JS_DEPS) $(CRYPT_DEPS) $(OBJS) $(LIBS) $(EXTRA_SBBS_DEPENDS) $(ENCODE_LIB) $(HASH_LIB) | $(LIBODIR)
122
	@echo Linking $@
123
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(LIBS) $(SHLIBOPTS) $(JS_LIBS) $(CRYPT_LIBS) $(ENCODE_LIBS) $(HASH_LIBS) $(XPDEV-MT_LIBS)
124
125

# FTP Server Link Rule
126
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
127
	@echo Linking $@
128
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
129
130

# Mail Server Link Rule
131
$(MAILSRVR): $(MAIL_OBJS)
132
	@echo Linking $@
133
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
134

deuce's avatar
deuce committed
135
# Web Server Link Rule
136
$(WEBSRVR): $(WEB_OBJS)
137
	@echo Linking $@
138
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
139
140

# Services Link Rule
141
$(SERVICES): $(SERVICE_OBJS)
142
	@echo Linking $@
143
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
144
145

# Synchronet Console Build Rule
146
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
147
	@echo Linking $@
deuce's avatar
deuce committed
148
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
149
150

# Baja Utility
151
$(BAJA): $(BAJA_OBJS)
152
	@echo Linking $@
153
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(BAJA_OBJS) $(XPDEV_LIBS) $(HASH_LIBS)
154

155
# UnBaja Utility
deuce's avatar
deuce committed
156
$(UNBAJA): $(UNBAJA_OBJS) | $(OBJODIR) $(EXEODIR)
157
	@echo Linking $@
158
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
159

160
# Node Utility
161
$(NODE): $(NODE_OBJS)
162
	@echo Linking $@
163
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
164
165

# FIXSMB Utility
166
$(FIXSMB): $(FIXSMB_OBJS)
167
	@echo Linking $@
168
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
169
170

# CHKSMB Utility
171
$(CHKSMB): $(CHKSMB_OBJS)
172
	@echo Linking $@
173
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
174
175

# SMB Utility
176
177
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
178
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
179

180
181
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
182
	@echo Linking $@
183
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
rswindell's avatar
rswindell committed
184

rswindell's avatar
rswindell committed
185
# SBBSecho Configuration Program
186
$(ECHOCFG): $(ECHOCFG_OBJS) $(ENCODE_LIB)
rswindell's avatar
rswindell committed
187
	@echo Linking $@
188
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(ECHOCFG_OBJS) $(UIFC-MT_LDFLAGS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS) $(ENCODE_LIBS)
rswindell's avatar
rswindell committed
189

rswindell's avatar
rswindell committed
190
# ADDFILES
191
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
192
	@echo Linking $@
193
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
rswindell's avatar
rswindell committed
194

195
# FILELIST
196
$(FILELIST): $(FILELIST_OBJS) $(ENCODE_LIB)
197
	@echo Linking $@
198
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
199

200
# MAKEUSER
201
$(MAKEUSER): $(MAKEUSER_OBJS)
202
	@echo Linking $@
203
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
204

205
# JSDOOR
206
$(JSDOOR): $(JSDOOR_OBJS) $(SBBS) $(XPDEV_LIB) $(ENCODE_LIB) $(HASH_LIB) | $(EXEODIR)
207
	@echo Linking $@
208
	$(QUIET)$(CXX) $(JS_CFLAGS) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSDOOR_OBJS) $(JS_LIBS) $(CRYPT_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(XPDEV-MT_LIBS) $(HASH_LIBS)
209

rswindell's avatar
rswindell committed
210
# JSEXEC
211
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
212
	@echo Linking $@
213
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(JS_LIBS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
214

215
216
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
217
	@echo Linking $@
218
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
219

220
# ASC2ANS
221
$(ASC2ANS): $(OBJODIR)/asc2ans.o
222
	@echo Linking $@
223
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
224
225
226
227

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
228
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(HASH_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
229
230
231
232

# QWKNODES
$(QWKNODES): $(QWKNODES_OBJS)
	@echo Linking $@
233
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(QWKNODES_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
234

deuce's avatar
deuce committed
235
236
237
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
238
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
239
240

# ALLUSERS
241
$(ALLUSERS): $(ALLUSERS_OBJS) $(ENCODE_LIB)
242
	@echo Linking $@
243
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
244
245

# DELFILES
246
$(DELFILES): $(DELFILES_OBJS) $(ENCODE_LIB)
deuce's avatar
deuce committed
247
	@echo Linking $@
248
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
249
250

# DUPEFIND
251
$(DUPEFIND): $(DUPEFIND_OBJS) $(ENCODE_LIB)
deuce's avatar
deuce committed
252
	@echo Linking $@
253
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(HASH_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
254
255
256
257

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
258
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
259
260

# DSTSEDIT
261
$(DSTSEDIT): $(DSTSEDIT_OBJS) $(ENCODE_LIB)
262
	@echo Linking $@
263
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DSTSEDIT_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
264
265
266
267
268

# READSAUCE
$(READSAUCE): $(READSAUCE_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(READSAUCE_OBJS) $(XPDEV_LIBS)
269
270
271
272
273

# SHOWSTAT
$(SHOWSTAT): $(SHOWSTAT_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SHOWSTAT_OBJS) $(XPDEV_LIBS)
274
275
276
277
278
279
280
281
282
283

# PKTDUMP
$(PKTDUMP): $(PKTDUMP_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(PKTDUMP_OBJS)

# FMSGDUMP
$(FMSGDUMP): $(FMSGDUMP_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FMSGDUMP_OBJS)