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

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

45
CFLAGS  +=  -I$(XPDEV)
46
CFLAGS	+=  $(UIFC_CFLAGS)
47

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

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

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

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

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

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

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

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

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

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

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

rswindell's avatar
rswindell committed
115
116
MONO_OBJS	= $(CON_OBJS) $(FTP_OBJS) $(WEB_OBJS) \
			$(MAIL_OBJS) $(SERVICE_OBJS)
117
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
118
ifeq ($(os),darwin)
deuce's avatar
deuce committed
119
120
121
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
122
else
deuce's avatar
deuce committed
123
124
125
126
127
128
129
130
 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
131
endif
132
133

# Monolithic Synchronet executable Build Rule
134
FORCE$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
deuce's avatar
deuce committed
135
136

$(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
137
	@echo Linking $@
138
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $^
139
140

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

143
$(SBBS): $(OBJS) $(LIBS)
144
	@echo Linking $@
145
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $^ $(SHLIBOPTS)
146
147

# FTP Server Link Rule
148
FORCE$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
deuce's avatar
deuce committed
149
150

$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
151
	@echo Linking $@
152
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@ 
153
154

# Mail Server Link Rule
155
FORCE$(MAILSRVR): $(MAIL_OBJS) $(LIBODIR)$(SLASH)$(SBBSLIB)
deuce's avatar
deuce committed
156
157

$(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
158
	@echo Linking $@
159
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
160
161
162
163
164
165

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

$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)
	@echo Linking $@
166
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
167
168
169
170
171
172

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

$(SERVICES): $(SERVICE_OBJS) $(SBBSLIB)
	@echo Linking $@
173
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $^ $(SHLIBOPTS) -o $@
174
175

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

178
179
$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
	@echo Linking $@
180
	$(QUIET)$(CC) $(CFLAGS) $(LDFLAGS) $(CON_LDFLAGS) -o $@ $(CON_OBJS) $(SBBSLIB)
181
182

# Specifc Compile Rules
deuce's avatar
deuce committed
183
$(LIBODIR)/ftpsrvr.o: ftpsrvr.c ftpsrvr.h $(BUILD_DEPENDS)
184
	@echo $(COMPILE_MSG) $<
185
	$(QUIET)$(CC) $(CFLAGS) -DFTPSRVR_EXPORTS -o $@ -c $<
186

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

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

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

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

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

deuce's avatar
deuce committed
207
$(LIBODIR)/services.o: services.c services.h $(BUILD_DEPENDS)
208
	@echo $(COMPILE_MSG) $<
209
	$(QUIET)$(CC) $(CFLAGS) -DSERVICES_EXPORTS -o $@ -c $<
210
211

# Baja Utility
212
BAJA_OBJS = \
213
214
215
216
	$(LIBODIR)/baja.o \
	$(LIBODIR)/ars.o \
	$(LIBODIR)/crc32.o \
	$(LIBODIR)/genwrap.o \
217
	$(LIBODIR)/dirwrap.o \
218
	$(LIBODIR)/filewrap.o
219
FORCE$(BAJA): $(BAJA_OBJS)
deuce's avatar
deuce committed
220

221
$(BAJA): $(BAJA_OBJS)
222
	@echo Linking $@
223
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
224
225

# Node Utility
226
NODE_OBJS = \
227
228
229
	$(LIBODIR)/node.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/filewrap.o
230
FORCE$(NODE): $(NODE_OBJS)
deuce's avatar
deuce committed
231

232
$(NODE): $(NODE_OBJS)
233
	@echo Linking $@
234
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ 
235
236

# FIXSMB Utility
237
FIXSMB_OBJS = \
238
239
	$(LIBODIR)/fixsmb.o \
	$(LIBODIR)/genwrap.o \
240
	$(LIBODIR)/dirwrap.o \
241
	$(LIBODIR)/str_list.o \
242
	$(LIBODIR)/str_util.o
243
244
245
FORCE$(FIXSMB): $(FIXSMB_OBJS)
	
$(FIXSMB): $(FIXSMB_OBJS)
246
	@echo Linking $@
247
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
248
249

# CHKSMB Utility
250
CHKSMB_OBJS = \
251
	$(LIBODIR)/chksmb.o \
252
	$(LIBODIR)/smbdump.o \
253
254
255
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o
256
FORCE$(CHKSMB): $(CHKSMB_OBJS)
deuce's avatar
deuce committed
257

258
$(CHKSMB): $(CHKSMB_OBJS)
259
	@echo Linking $@
260
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
261
262

# SMB Utility
263
SMBUTIL_OBJS = \
264
265
266
267
268
269
	$(LIBODIR)/smbutil.o \
	$(LIBODIR)/conwrap.o \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o \
	$(LIBODIR)/date_str.o \
	$(LIBODIR)/str_util.o
270
271
272
273
FORCE$(SMBUTIL): $(SMBUTIL_OBJS)
	
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
274
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^
deuce's avatar
deuce committed
275

276
277
# SBBSecho (FidoNet Packet Tosser)
SBBSECHO_OBJS = \
278
279
280
281
282
283
284
285
286
287
288
289
290
291
	$(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 \
	$(LIBODIR)/dirwrap.o \
	$(LIBODIR)/genwrap.o \
deuce's avatar
deuce committed
292
	$(SMB_OBJS)
293
294
295
296

FORCE$(SBBSECHO): $(SBBSECHO_OBJS)

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

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

313
314
315
FORCE$(ECHOCFG): $(ECHOCFG_OBJS)

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

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

335
336
337
FORCE$(ADDFILES): $(ADDFILES_OBJS)

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

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

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

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

362
# MAKEUSER
363
MAKEUSER_OBJS = \
364
365
366
367
368
369
370
371
372
373
374
	$(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 \
375
	$(LIBODIR)/genwrap.o \
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: