GNUmakefile 9.41 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

23
24
25
UIFC_SRC =	../uifc/
XPDEV	 =	../xpdev/
SBBS_SRC =	./
26

27
28
NEED_JAVASCRIPT	:= 1
NEED_THREADS	:= 1
29

30
include $(XPDEV)/Common.gmake
31
32
include $(SBBS_SRC)/Common.gmake
include $(UIFC_SRC)/Common.gmake
33

34
35
ifeq ($(os),freebsd)
 BSD	=	1
36
else
37
38
39
 ifeq ($(os),openbsd)
  BSD	=	1
 endif
40
endif
41

42
CFLAGS  +=  -I$(XPDEV)
43
CFLAGS	+=  $(UIFC_CFLAGS)
44

45
ifndef bcc
deuce's avatar
deuce committed
46
47
48
49
 LDFLAGS	+=	-lm
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
50
51
endif

52
ifeq ($(os),sunos)    # Solaris
53
 LDFLAGS += -lsocket -lnsl -lrt
54
55
endif

56
ifeq ($(os),netbsd)
57
58
 LDFLAGS += -L/usr/pkg/lib
 UTIL_LDFLAGS	+=	-lpth -L/usr/pkg/lib
deuce's avatar
deuce committed
59
60
endif

61
# So far, only QNX has sem_timedwait()
62
ifeq ($(os),qnx)
63
 LDFLAGS += -lsocket
64
endif
65

66
67
68
69
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

70
71
72
73
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

74
ifdef DONT_BLAME_SYNCHRONET
75
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
76
endif
77

78
79
80
81
82
#SBBSLIB	=	$(LIBODIR)$(SLASH)libsbbs.so
SBBSLIB	=	-lsbbs

#dummy rule
$(SBBSLIB) : $(SBBS)
83
	$(QUIET)touch -- '$(SBBSLIB)'
84

deuce's avatar
deuce committed
85
ifneq ($(os),darwin)
deuce's avatar
deuce committed
86
ifneq ($(os),sunos)
87
88
89
90
SBBSLDFLAGS	:=	$(LDFLAGS) -rpath-link ./$(LIBODIR) -rpath ./ 
#LDFLAGS		+=	-Wl,-rpath-link,./$(LIBODIR),-rpath,./
LDFLAGS		+=	-Xlinker -rpath
LDFLAGS		+=	-Xlinker .
deuce's avatar
deuce committed
91
ifneq ($(os),openbsd)
92
93
94
95
96
97
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
98
endif
deuce's avatar
deuce committed
99
endif
deuce's avatar
deuce committed
100
endif
101

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

rswindell's avatar
rswindell committed
111
112
MONO_OBJS	= $(CON_OBJS) $(FTP_OBJS) $(WEB_OBJS) \
			$(MAIL_OBJS) $(SERVICE_OBJS)
113
SMBLIB_OBJS = \
114
115
116
	$(LIBODIR)/smblib.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/crc16.o
117

118
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
119
120
121
122
123
124
ifeq ($(os),darwin)
MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
SHLIBOPTS	:=	
else
MKSHLIB		:=	$(CC)
125
MKSHPPLIB		:=	$(CXX)
deuce's avatar
deuce committed
126
endif
127
128

# Monolithic Synchronet executable Build Rule
129
FORCE$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
deuce's avatar
deuce committed
130
131

$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
132
	@echo Linking $@
133
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $^
134
135

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

138
$(SBBS): $(OBJS) $(LIBS)
139
	@echo Linking $@
140
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $^ $(SHLIBOPTS)
141
142

# FTP Server Link Rule
143
FORCE$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
deuce's avatar
deuce committed
144
145

$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
146
	@echo Linking $@
147
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@ 
148
149

# Mail Server Link Rule
150
FORCE$(MAILSRVR): $(MAIL_OBJS) $(LIBODIR)$(SLASH)$(SBBSLIB)
deuce's avatar
deuce committed
151
152

$(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
153
	@echo Linking $@
154
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
155
156
157
158
159
160

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

$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)
	@echo Linking $@
161
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
162
163
164
165
166
167

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

$(SERVICES): $(SERVICE_OBJS) $(SBBSLIB)
	@echo Linking $@
168
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
169
170

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

173
174
$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
	@echo Linking $@
175
	$(QUIET)$(CC) $(CFLAGS) $(LDFLAGS) $(CON_LDFLAGS) -o $@ $(CON_OBJS) $(SBBSLIB)
176
177

# Specifc Compile Rules
deuce's avatar
deuce committed
178
$(LIBODIR)/ftpsrvr.o: ftpsrvr.c ftpsrvr.h $(BUILD_DEPENDS)
179
	@echo $(COMPILE_MSG) $<
180
	$(QUIET)$(CC) $(CFLAGS) -DFTPSRVR_EXPORTS -o $@ -c $<
181

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

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

deuce's avatar
deuce committed
190
$(LIBODIR)/mime.o: mime.c $(BUILD_DEPENDS)
191
	@echo $(COMPILE_MSG) $<
192
	$(QUIET)$(CC) $(CFLAGS) -DMAILSRVR_EXPORTS -o $@ -c $<		
193

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

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

deuce's avatar
deuce committed
202
$(LIBODIR)/services.o: services.c services.h $(BUILD_DEPENDS)
203
	@echo $(COMPILE_MSG) $<
204
	$(QUIET)$(CC) $(CFLAGS) -DSERVICES_EXPORTS -o $@ -c $<
205
206

# Baja Utility
207
BAJA_OBJS = \
208
209
210
211
	$(LIBODIR)/baja.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/crc32.o \
	$(LIBODIR)/genwrap.o \
212
	$(LIBODIR)/dirwrap.o \
213
	$(LIBODIR)/filewrap.o
214
FORCE$(BAJA): $(BAJA_OBJS)
deuce's avatar
deuce committed
215

216
$(BAJA): $(BAJA_OBJS)
217
	@echo Linking $@
218
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
219
220

# Node Utility
221
NODE_OBJS = \
222
223
224
	$(LIBODIR)/node.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/filewrap.o
225
FORCE$(NODE): $(NODE_OBJS)
deuce's avatar
deuce committed
226

227
$(NODE): $(NODE_OBJS)
228
	@echo Linking $@
229
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ 
230
231

# FIXSMB Utility
232
FIXSMB_OBJS = \
233
	$(LIBODIR)/fixsmb.o \
234
	$(SMBLIB_OBJS) \
235
	$(LIBODIR)/genwrap.o \
236
	$(LIBODIR)/dirwrap.o \
237
	$(LIBODIR)/str_util.o
238
239
240
FORCE$(FIXSMB): $(FIXSMB_OBJS)
	
$(FIXSMB): $(FIXSMB_OBJS)
241
	@echo Linking $@
242
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
243
244

# CHKSMB Utility
245
CHKSMB_OBJS = \
246
	$(LIBODIR)/chksmb.o \
247
	$(SMBLIB_OBJS) \
248
249
250
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o
251
FORCE$(CHKSMB): $(CHKSMB_OBJS)
deuce's avatar
deuce committed
252

253
$(CHKSMB): $(CHKSMB_OBJS)
254
	@echo Linking $@
255
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
256
257

# SMB Utility
258
SMBUTIL_OBJS = \
259
	$(LIBODIR)/smbutil.o \
260
	$(SMBLIB_OBJS) \
261
262
263
264
265
266
267
268
	$(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
269
270
271
272
FORCE$(SMBUTIL): $(SMBUTIL_OBJS)
	
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
273
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
274

275
276
# SBBSecho (FidoNet Packet Tosser)
SBBSECHO_OBJS = \
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
	$(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 \
292
	$(SMBLIB_OBJS) \
293
294
	$(LIBODIR)/smbtxt.o \
	$(LIBODIR)/lzh.o
295
296
297
298

FORCE$(SBBSECHO): $(SBBSECHO_OBJS)

$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
299
	@echo Linking $@
300
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
rswindell's avatar
rswindell committed
301

rswindell's avatar
rswindell committed
302
# SBBSecho Configuration Program
rswindell's avatar
rswindell committed
303
ECHOCFG_OBJS = \
304
305
	$(LIBODIR)/echocfg.o \
	$(LIBODIR)/rechocfg.o \
deuce's avatar
deuce committed
306
	$(UIFC_OBJS) \
307
	$(LIBODIR)/uifcx.o \
308
309
310
311
312
313
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/crc16.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/dirwrap.o
deuce's avatar
deuce committed
314

315
316
317
FORCE$(ECHOCFG): $(ECHOCFG_OBJS)

$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
318
	@echo Linking $@
319
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(UIFC_LDFLAGS)
rswindell's avatar
rswindell committed
320

rswindell's avatar
rswindell committed
321
# ADDFILES
322
ADDFILES_OBJS = \
323
324
325
326
327
328
329
330
331
332
333
334
	$(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 \
335
336
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
337

338
339
340
FORCE$(ADDFILES): $(ADDFILES_OBJS)

$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
341
	@echo Linking $@
342
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
rswindell's avatar
rswindell committed
343

344
# FILELIST
345
FILELIST_OBJS = \
346
347
348
349
350
351
352
353
354
355
356
	$(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 \
357
358
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
359

360
361
362
FORCE$(FILELIST): $(FILELIST_OBJS)

$(FILELIST): $(FILELIST_OBJS)
363
	@echo Linking $@
364
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
365

366
# MAKEUSER
367
MAKEUSER_OBJS = \
368
369
370
371
372
373
374
375
376
377
378
	$(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 \
379
380
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
381

382
383
384
FORCE$(MAKEUSER): $(MAKEUSER_OBJS)

$(MAKEUSER): $(MAKEUSER_OBJS)
385
	@echo Linking $@
386
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
387

rswindell's avatar
rswindell committed
388
389
# JSEXEC
JSEXEC_OBJS = \
390
	$(LIBODIR)/jsexec.o \
391
	$(SBBSLIB)
rswindell's avatar
rswindell committed
392
393
394

FORCE$(JSEXEC): $(JSEXEC_OBJS)

395
$(JSEXEC): $(JSEXEC_OBJS)
rswindell's avatar
rswindell committed
396
	@echo Linking $@
397
	$(QUIET)$(CXX) $(UTIL_LDFLAGS) -o $@ $^ $(LDFLAGS)
rswindell's avatar
rswindell committed
398
	
399
# ANS2ASC
400
401
FORCE$(ANS2ASC): $(LIBODIR)/ans2asc.o

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

406
# ASC2ANS
407
408
FORCE$(ASC2ANS): $(LIBODIR)/asc2ans.o

409
$(ASC2ANS): $(LIBODIR)/asc2ans.o
410
	@echo Linking $@
411
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
412

deuce's avatar
deuce committed
413
FORCE: