GNUmakefile 9.34 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
46
ifndef bcc
 LDFLAGS	+=	-lm -lutil
47
48
endif

49
ifeq ($(os),sunos)    # Solaris
50
 LDFLAGS += -lsocket -lnsl -lrt
51
52
endif

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

58
# So far, only QNX has sem_timedwait()
59
ifeq ($(os),qnx)
60
 LDFLAGS += -lsocket
61
endif
62

63
64
65
66
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

67
68
69
70
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

71
ifdef DONT_BLAME_SYNCHRONET
72
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
73
endif
74

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
	$(LIBODIR)/uifcx.o \
303
304
305
306
307
308
	$(LIBODIR)/nopen.o \
	$(LIBODIR)/crc16.o \
	$(LIBODIR)/str_util.o \
	$(LIBODIR)/filewrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/dirwrap.o
deuce's avatar
deuce committed
309

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

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

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

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

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

339
# FILELIST
340
FILELIST_OBJS = \
341
342
343
344
345
346
347
348
349
350
351
	$(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 \
352
353
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
354

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

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

361
# MAKEUSER
362
MAKEUSER_OBJS = \
363
364
365
366
367
368
369
370
371
372
373
	$(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 \
374
375
	$(LIBODIR)/genwrap.o \
	$(SMBLIB_OBJS)
deuce's avatar
deuce committed
376

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

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

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

FORCE$(JSEXEC): $(JSEXEC_OBJS)

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

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

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

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

deuce's avatar
deuce committed
408
FORCE: