GNUmakefile 9.28 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
14
15
#																		#
# Optional build targets: dlls, utils, mono, all (default)				#
#########################################################################

# $Id$

deuce's avatar
deuce committed
16
#USE_DIALOG =   1       # Dialog vesrion of UIFC
17
#USE_FLTK =     1       # Use Windowed version
18
#USE_CURSES =	1	# Use *nix curses version
19
ifndef NO_CURSES
20
 USE_UIFC32      =       1       # Curses version of UIFC
21
endif
deuce's avatar
deuce committed
22

rswindell's avatar
rswindell committed
23
UIFC	=	../uifc/
24
XPDEV	=	../xpdev/
25

26
27
NEED_JAVASCRIPT	:= 1
NEED_THREADS	:= 1
28

29
include $(XPDEV)/Common.gmake
30

31
32
ifeq ($(os),freebsd)
 BSD	=	1
33
else
34
35
36
 ifeq ($(os),openbsd)
  BSD	=	1
 endif
37
endif
38

39
CFLAGS  +=  -I$(XPDEV)
40

41
42
ifndef bcc
 LDFLAGS	+=	-lm -lutil
43
44
endif

45
ifeq ($(os),sunos)    # Solaris
46
 LDFLAGS += -lsocket -lnsl -lrt
47
48
endif

49
ifeq ($(os),netbsd)
50
51
 LDFLAGS += -L/usr/pkg/lib
 UTIL_LDFLAGS	+=	-lpth -L/usr/pkg/lib
deuce's avatar
deuce committed
52
53
endif

54
# So far, only QNX has sem_timedwait()
55
ifeq ($(os),qnx)
56
 LDFLAGS += -lsocket
57
endif
58

59
60
61
62
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

63
64
65
66
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

67
ifdef DONT_BLAME_SYNCHRONET
68
 LDFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
69
endif
70

71
ifeq ($(XP_SEM),1)
72
 OBJS	+=	$(LIBODIR)$(SLASH)xpsem.$(OFILE)
73
74
endif

75
76
77
78
79
#SBBSLIB	=	$(LIBODIR)$(SLASH)libsbbs.so
SBBSLIB	=	-lsbbs

#dummy rule
$(SBBSLIB) : $(SBBS)
80
	$(QUIET)touch -- '$(SBBSLIB)'
81

deuce's avatar
deuce committed
82
ifneq ($(os),darwin)
83
84
85
86
SBBSLDFLAGS	:=	$(LDFLAGS) -rpath-link ./$(LIBODIR) -rpath ./ 
#LDFLAGS		+=	-Wl,-rpath-link,./$(LIBODIR),-rpath,./
LDFLAGS		+=	-Xlinker -rpath
LDFLAGS		+=	-Xlinker .
deuce's avatar
deuce committed
87
ifneq ($(os),openbsd)
88
89
90
91
92
93
LDFLAGS		+=	-Xlinker -rpath-link
LDFLAGS		+=	-Xlinker ./$(LIBODIR)
LDFLAGS		+=	-Xlinker -rpath-link
LDFLAGS		+=	-Xlinker $(JSLIBDIR)
LDFLAGS		+=	-Xlinker -rpath-link
LDFLAGS		+=	-Xlinker $(NSPRDIR)
deuce's avatar
deuce committed
94
endif
deuce's avatar
deuce committed
95
endif
96

97
98
CON_OBJS	= $(LIBODIR)/sbbscon.o $(LIBODIR)/conwrap.o \
		  $(LIBODIR)/sbbs_ini.o
99
CON_LDFLAGS	= -lftpsrvr -lwebsrvr -lmailsrvr -lservices
100
FTP_OBJS	= $(LIBODIR)/ftpsrvr.o
101
MAIL_OBJS	= $(LIBODIR)/mailsrvr.o $(LIBODIR)/mxlookup.o \
102
 		  $(LIBODIR)/mime.o $(LIBODIR)/base64.o $(LIBODIR)/ini_file.o
deuce's avatar
deuce committed
103
WEB_OBJS	= $(LIBODIR)/websrvr.o $(LIBODIR)/sockwrap.o $(LIBODIR)/base64.o
104
SERVICE_OBJS	= $(LIBODIR)/services.o $(LIBODIR)/ini_file.o
105

rswindell's avatar
rswindell committed
106
107
MONO_OBJS	= $(CON_OBJS) $(FTP_OBJS) $(WEB_OBJS) \
			$(MAIL_OBJS) $(SERVICE_OBJS)
108
SMBLIB_OBJS = \
109
110
111
	$(LIBODIR)/smblib.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/crc16.o
112

113
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
114
115
116
117
118
119
ifeq ($(os),darwin)
MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
SHLIBOPTS	:=	
else
MKSHLIB		:=	$(CC)
120
MKSHPPLIB		:=	$(CXX)
deuce's avatar
deuce committed
121
endif
122
123

# Monolithic Synchronet executable Build Rule
124
FORCE$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
deuce's avatar
deuce committed
125
126

$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
127
	@echo Linking $@
128
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $^
129
130

# Synchronet BBS library Link Rule
131
FORCE$(SBBS): $(OBJS) $(LIBS)
deuce's avatar
deuce committed
132

133
$(SBBS): $(OBJS) $(LIBS)
134
	@echo Linking $@
135
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $^ $(SHLIBOPTS)
136
137

# FTP Server Link Rule
138
FORCE$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
deuce's avatar
deuce committed
139
140

$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
141
	@echo Linking $@
142
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@ 
143
144

# Mail Server Link Rule
145
FORCE$(MAILSRVR): $(MAIL_OBJS) $(LIBODIR)$(SLASH)$(SBBSLIB)
deuce's avatar
deuce committed
146
147

$(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
148
	@echo Linking $@
149
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
150
151
152
153
154
155

# Mail Server Link Rule
FORCE$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)

$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)
	@echo Linking $@
156
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
157
158
159
160
161
162

# Services Link Rule
FORCE$(SERVICES): $(WEB_OBJS) $(SBBSLIB)

$(SERVICES): $(SERVICE_OBJS) $(SBBSLIB)
	@echo Linking $@
163
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
164
165

# Synchronet Console Build Rule
166
FORCE$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTP_OBJS) $(MAIL_OBJS) $(WEB_OBJS) $(SERVICE_OBJS)
deuce's avatar
deuce committed
167

168
169
$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
	@echo Linking $@
170
	$(QUIET)$(CC) $(CFLAGS) $(LDFLAGS) $(CON_LDFLAGS) -o $@ $(CON_OBJS) $(SBBSLIB)
171
172

# Specifc Compile Rules
deuce's avatar
deuce committed
173
$(LIBODIR)/ftpsrvr.o: ftpsrvr.c ftpsrvr.h $(BUILD_DEPENDS)
174
	@echo $(COMPILE_MSG) $<
175
	$(QUIET)$(CC) $(CFLAGS) -DFTPSRVR_EXPORTS -o $@ -c $<
176

deuce's avatar
deuce committed
177
$(LIBODIR)/mailsrvr.o: mailsrvr.c mailsrvr.h $(BUILD_DEPENDS)
178
	@echo $(COMPILE_MSG) $<
179
	$(QUIET)$(CC) $(CFLAGS) -DMAILSRVR_EXPORTS -o $@ -c $<
180

deuce's avatar
deuce committed
181
$(LIBODIR)/mxlookup.o: mxlookup.c $(BUILD_DEPENDS)
182
	@echo $(COMPILE_MSG) $<
183
	$(QUIET)$(CC) $(CFLAGS) -DMAILSRVR_EXPORTS -o $@ -c $<
184

deuce's avatar
deuce committed
185
$(LIBODIR)/mime.o: mime.c $(BUILD_DEPENDS)
186
	@echo $(COMPILE_MSG) $<
187
	$(QUIET)$(CC) $(CFLAGS) -DMAILSRVR_EXPORTS -o $@ -c $<		
188

deuce's avatar
deuce committed
189
$(LIBODIR)/websrvr.o: websrvr.c websrvr.h $(BUILD_DEPENDS)
190
	@echo $(COMPILE_MSG) $<
191
	$(QUIET)$(CC) $(CFLAGS) -DWEBSRVR_EXPORTS -o $@ -c $<
deuce's avatar
deuce committed
192

deuce's avatar
deuce committed
193
$(LIBODIR)/base64.o: base64.c base64.h $(BUILD_DEPENDS)
194
	@echo $(COMPILE_MSG) $<
195
	$(QUIET)$(CC) $(CFLAGS) -DWEBSRVR_EXPORTS -o $@ -c $<
rswindell's avatar
rswindell committed
196

deuce's avatar
deuce committed
197
$(LIBODIR)/services.o: services.c services.h $(BUILD_DEPENDS)
198
	@echo $(COMPILE_MSG) $<
199
	$(QUIET)$(CC) $(CFLAGS) -DSERVICES_EXPORTS -o $@ -c $<
200
201

# Baja Utility
202
BAJA_OBJS = \
203
204
205
206
	$(LIBODIR)/baja.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/crc32.o \
	$(LIBODIR)/genwrap.o \
207
	$(LIBODIR)/dirwrap.o \
208
	$(LIBODIR)/filewrap.o
209
FORCE$(BAJA): $(BAJA_OBJS)
deuce's avatar
deuce committed
210

211
$(BAJA): $(BAJA_OBJS)
212
	@echo Linking $@
213
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
214
215

# Node Utility
216
NODE_OBJS = \
217
218
219
	$(LIBODIR)/node.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/filewrap.o
220
FORCE$(NODE): $(NODE_OBJS)
deuce's avatar
deuce committed
221

222
$(NODE): $(NODE_OBJS)
223
	@echo Linking $@
224
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ 
225
226

# FIXSMB Utility
227
FIXSMB_OBJS = \
228
	$(LIBODIR)/fixsmb.o \
229
	$(SMBLIB_OBJS) \
230
	$(LIBODIR)/genwrap.o \
231
	$(LIBODIR)/dirwrap.o \
232
	$(LIBODIR)/str_util.o
233
234
235
FORCE$(FIXSMB): $(FIXSMB_OBJS)
	
$(FIXSMB): $(FIXSMB_OBJS)
236
	@echo Linking $@
237
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
238
239

# CHKSMB Utility
240
CHKSMB_OBJS = \
241
	$(LIBODIR)/chksmb.o \
242
	$(SMBLIB_OBJS) \
243
244
245
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o
246
FORCE$(CHKSMB): $(CHKSMB_OBJS)
deuce's avatar
deuce committed
247

248
$(CHKSMB): $(CHKSMB_OBJS)
249
	@echo Linking $@
250
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
251
252

# SMB Utility
253
SMBUTIL_OBJS = \
254
	$(LIBODIR)/smbutil.o \
255
	$(SMBLIB_OBJS) \
256
257
258
259
260
261
262
263
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/smbtxt.o \
	$(LIBODIR)/crc32.o \
	$(LIBODIR)/lzh.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/str_util.o
264
265
266
267
FORCE$(SMBUTIL): $(SMBUTIL_OBJS)
	
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
268
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
269

270
271
# SBBSecho (FidoNet Packet Tosser)
SBBSECHO_OBJS = \
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
	$(LIBODIR)/sbbsecho.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/crc32.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/load_cfg.o \
	$(LIBODIR)/scfglib1.o \
	$(LIBODIR)/scfglib2.o \
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/dat_rec.o \
	$(LIBODIR)/userdat.o \
	$(LIBODIR)/rechocfg.o \
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o \
287
	$(SMBLIB_OBJS) \
288
289
	$(LIBODIR)/smbtxt.o \
	$(LIBODIR)/lzh.o
290
291
292
293

FORCE$(SBBSECHO): $(SBBSECHO_OBJS)

$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
294
	@echo Linking $@
295
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
rswindell's avatar
rswindell committed
296

rswindell's avatar
rswindell committed
297
# SBBSecho Configuration Program
rswindell's avatar
rswindell committed
298
ECHOCFG_OBJS = \
299
300
	$(LIBODIR)/echocfg.o \
	$(LIBODIR)/rechocfg.o \
deuce's avatar
deuce committed
301
	$(UIFC_OBJS) \
302
303
304
305
306
307
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/crc16.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/dirwrap.o
deuce's avatar
deuce committed
308

309
310
311
FORCE$(ECHOCFG): $(ECHOCFG_OBJS)

$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
312
	@echo Linking $@
313
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(UIFC_LDFLAGS)
rswindell's avatar
rswindell committed
314

rswindell's avatar
rswindell committed
315
# ADDFILES
316
ADDFILES_OBJS = \
317
318
319
320
321
322
323
324
325
326
327
328
	$(LIBODIR)/addfiles.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/load_cfg.o \
	$(LIBODIR)/scfglib1.o \
	$(LIBODIR)/scfglib2.o \
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/dat_rec.o \
	$(LIBODIR)/userdat.o \
	$(LIBODIR)/filedat.o \
	$(LIBODIR)/dirwrap.o \
329
330
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
331

332
333
334
FORCE$(ADDFILES): $(ADDFILES_OBJS)

$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
335
	@echo Linking $@
336
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
rswindell's avatar
rswindell committed
337

338
# FILELIST
339
FILELIST_OBJS = \
340
341
342
343
344
345
346
347
348
349
350
	$(LIBODIR)/filelist.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/load_cfg.o \
	$(LIBODIR)/scfglib1.o \
	$(LIBODIR)/scfglib2.o \
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/dat_rec.o \
	$(LIBODIR)/filedat.o \
	$(LIBODIR)/dirwrap.o \
351
352
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
353

354
355
356
FORCE$(FILELIST): $(FILELIST_OBJS)

$(FILELIST): $(FILELIST_OBJS)
357
	@echo Linking $@
358
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
359

360
# MAKEUSER
361
MAKEUSER_OBJS = \
362
363
364
365
366
367
368
369
370
371
372
	$(LIBODIR)/makeuser.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/load_cfg.o \
	$(LIBODIR)/scfglib1.o \
	$(LIBODIR)/scfglib2.o \
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/dat_rec.o \
	$(LIBODIR)/userdat.o \
	$(LIBODIR)/dirwrap.o \
373
374
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
375

376
377
378
FORCE$(MAKEUSER): $(MAKEUSER_OBJS)

$(MAKEUSER): $(MAKEUSER_OBJS)
379
	@echo Linking $@
380
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
381

rswindell's avatar
rswindell committed
382
383
# JSEXEC
JSEXEC_OBJS = \
384
	$(LIBODIR)/jsexec.o \
385
	$(SBBSLIB)
rswindell's avatar
rswindell committed
386
387
388

FORCE$(JSEXEC): $(JSEXEC_OBJS)

389
$(JSEXEC): $(JSEXEC_OBJS)
rswindell's avatar
rswindell committed
390
	@echo Linking $@
391
	$(QUIET)$(CXX) $(UTIL_LDFLAGS) -o $@ $^ $(LDFLAGS)
rswindell's avatar
rswindell committed
392
	
393
# ANS2ASC
394
395
FORCE$(ANS2ASC): $(LIBODIR)/ans2asc.o

396
$(ANS2ASC): $(LIBODIR)/ans2asc.o
397
	@echo Linking $@
398
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
399

400
# ASC2ANS
401
402
FORCE$(ASC2ANS): $(LIBODIR)/asc2ans.o

403
$(ASC2ANS): $(LIBODIR)/asc2ans.o
404
	@echo Linking $@
405
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
406

deuce's avatar
deuce committed
407
FORCE: