GNUmakefile 9.53 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
UIFC_SRC =	../uifc/
XPDEV	 =	../xpdev/
deuce's avatar
deuce committed
25
SMBLIB_SRC	=	../smblib/
deuce's avatar
deuce committed
26
NEED_SMBLIB	:=	1
27
SBBS_SRC =	./
28

29
30
NEED_JAVASCRIPT	:= 1
NEED_THREADS	:= 1
31

32
include $(XPDEV)/Common.gmake
33
34
include $(SBBS_SRC)/Common.gmake
include $(UIFC_SRC)/Common.gmake
deuce's avatar
deuce committed
35
36
include $(SMBLIB_SRC)/Common.gmake

deuce's avatar
deuce committed
37
38
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS)

39
40
ifeq ($(os),freebsd)
 BSD	=	1
41
else
42
43
44
 ifeq ($(os),openbsd)
  BSD	=	1
 endif
45
endif
46

47
CFLAGS	+=  $(UIFC_CFLAGS)
48

49
ifndef bcc
deuce's avatar
deuce committed
50
51
52
53
 LDFLAGS	+=	-lm
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
54
55
endif

56
ifeq ($(os),sunos)    # Solaris
57
 LDFLAGS += -lsocket -lnsl -lrt
58
59
endif

60
ifeq ($(os),netbsd)
61
62
 LDFLAGS += -L/usr/pkg/lib
 UTIL_LDFLAGS	+=	-lpth -L/usr/pkg/lib
deuce's avatar
deuce committed
63
64
endif

65
# So far, only QNX has sem_timedwait()
66
ifeq ($(os),qnx)
67
 LDFLAGS += -lsocket
68
endif
69

70
71
72
73
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

74
75
76
77
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

78
ifdef DONT_BLAME_SYNCHRONET
79
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
80
endif
81

82
83
84
85
86
#SBBSLIB	=	$(LIBODIR)$(SLASH)libsbbs.so
SBBSLIB	=	-lsbbs

#dummy rule
$(SBBSLIB) : $(SBBS)
87
	$(QUIET)touch -- '$(SBBSLIB)'
88

deuce's avatar
deuce committed
89
PWD	:=	$(shell pwd)
deuce's avatar
deuce committed
90
LD_RUN_PATH	:=	.:$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR)
91
export LD_RUN_PATH
92

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

rswindell's avatar
rswindell committed
103
104
MONO_OBJS	= $(CON_OBJS) $(FTP_OBJS) $(WEB_OBJS) \
			$(MAIL_OBJS) $(SERVICE_OBJS)
105
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
106
ifeq ($(os),darwin)
deuce's avatar
deuce committed
107
108
109
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
110
else
deuce's avatar
deuce committed
111
112
113
114
115
116
117
118
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G -L/usr/local/lib -lstdc++
  SHLIBOPTS	:=	
 else
  MKSHLIB		:=	$(CC)
  MKSHPPLIB		:=	$(CXX)
 endif
deuce's avatar
deuce committed
119
endif
120
121

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

$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
125
	@echo Linking $@
126
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $^ $(ADD_LIBS)
127
128

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

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

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

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

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

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

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

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

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

$(SERVICES): $(SERVICE_OBJS) $(SBBSLIB)
	@echo Linking $@
161
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@ $(ADD_LIBS)
162
163

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

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

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

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

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

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

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

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

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

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

209
$(BAJA): $(BAJA_OBJS)
210
	@echo Linking $@
211
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
212
213

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

220
$(NODE): $(NODE_OBJS)
221
	@echo Linking $@
222
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
223
224

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

# CHKSMB Utility
239
CHKSMB_OBJS = \
240
	$(LIBODIR)/chksmb.o \
241
	$(LIBODIR)/smbdump.o \
242
243
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
244
	$(LIBODIR)/filewrap.o \
245
	$(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 $@ $^ $(ADD_LIBS)
251
252

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

266
267
# SBBSecho (FidoNet Packet Tosser)
SBBSECHO_OBJS = \
268
269
270
271
272
273
274
275
276
277
278
279
	$(LIBODIR)/sbbsecho.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)/rechocfg.o \
	$(LIBODIR)/conwrap.o \
280
	$(LIBODIR)/filewrap.o \
281
282
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o \
283
	$(LIBODIR)/msg_id.o \
deuce's avatar
deuce committed
284
	$(SMB_OBJS)
285
286
287
288

FORCE$(SBBSECHO): $(SBBSECHO_OBJS)

$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
289
	@echo Linking $@
290
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
rswindell's avatar
rswindell committed
291

rswindell's avatar
rswindell committed
292
# SBBSecho Configuration Program
rswindell's avatar
rswindell committed
293
ECHOCFG_OBJS = \
294
295
	$(LIBODIR)/echocfg.o \
	$(LIBODIR)/rechocfg.o \
deuce's avatar
deuce committed
296
	$(UIFC_OBJS) \
297
	$(LIBODIR)/uifcx.o \
298
299
300
301
302
303
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/crc16.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/dirwrap.o
deuce's avatar
deuce committed
304

305
306
307
FORCE$(ECHOCFG): $(ECHOCFG_OBJS)

$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
308
	@echo Linking $@
309
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(UIFC_LDFLAGS) $(ADD_LIBS)
rswindell's avatar
rswindell committed
310

rswindell's avatar
rswindell committed
311
# ADDFILES
312
ADDFILES_OBJS = \
313
314
315
316
317
318
319
320
321
322
323
	$(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 \
324
	$(LIBODIR)/filewrap.o \
325
	$(LIBODIR)/dirwrap.o \
326
	$(LIBODIR)/genwrap.o \
deuce's avatar
deuce committed
327

328
329
330
FORCE$(ADDFILES): $(ADDFILES_OBJS)

$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
331
	@echo Linking $@
332
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
rswindell's avatar
rswindell committed
333

334
# FILELIST
335
FILELIST_OBJS = \
336
337
338
339
340
341
342
343
344
345
	$(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 \
346
	$(LIBODIR)/filewrap.o \
347
	$(LIBODIR)/dirwrap.o \
348
	$(LIBODIR)/genwrap.o \
deuce's avatar
deuce committed
349

350
351
352
FORCE$(FILELIST): $(FILELIST_OBJS)

$(FILELIST): $(FILELIST_OBJS)
353
	@echo Linking $@
354
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
355

356
# MAKEUSER
357
MAKEUSER_OBJS = \
358
359
360
361
362
363
364
365
366
367
	$(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 \
368
	$(LIBODIR)/filewrap.o \
369
	$(LIBODIR)/dirwrap.o \
370
	$(LIBODIR)/genwrap.o \
deuce's avatar
deuce committed
371

372
373
374
FORCE$(MAKEUSER): $(MAKEUSER_OBJS)

$(MAKEUSER): $(MAKEUSER_OBJS)
375
	@echo Linking $@
376
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
deuce's avatar
deuce committed
377

rswindell's avatar
rswindell committed
378
379
# JSEXEC
JSEXEC_OBJS = \
380
	$(LIBODIR)/jsexec.o \
381
	$(SBBSLIB)
rswindell's avatar
rswindell committed
382
383
384

FORCE$(JSEXEC): $(JSEXEC_OBJS)

385
$(JSEXEC): $(JSEXEC_OBJS)
rswindell's avatar
rswindell committed
386
	@echo Linking $@
387
	$(QUIET)$(CXX) $(UTIL_LDFLAGS) -o $@ $^ $(LDFLAGS) $(ADD_LIBS)
rswindell's avatar
rswindell committed
388
	
389
# ANS2ASC
390
391
FORCE$(ANS2ASC): $(LIBODIR)/ans2asc.o

392
$(ANS2ASC): $(LIBODIR)/ans2asc.o
393
	@echo Linking $@
394
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
deuce's avatar
deuce committed
395

396
# ASC2ANS
397
398
FORCE$(ASC2ANS): $(LIBODIR)/asc2ans.o

399
$(ASC2ANS): $(LIBODIR)/asc2ans.o
400
	@echo Linking $@
401
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(ADD_LIBS)
deuce's avatar
deuce committed
402

deuce's avatar
deuce committed
403
FORCE:
404
405
406

SMBLIB:	$(SMBLIB_TARGET)