GNUmakefile 8.16 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$

16
17
PWD	:=	$(shell pwd)
SRC_ROOT	?=	${PWD}/..
18
include $(SRC_ROOT)/build/Common.gmake
19

20
21
UTIL_LDFLAGS	:=	$(LDFLAGS)
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS)
22
UTIL_LIBS	+=	$(SMBLIB_LIBS)
deuce's avatar
deuce committed
23

24
ifndef bcc
deuce's avatar
deuce committed
25
26
27
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
28
29
endif

30
ifeq ($(os),sunos)    # Solaris
deuce's avatar
deuce committed
31
 LDFLAGS += -lnsl -lrt
deuce's avatar
deuce committed
32
 SBBS_LIBS	+=	-lkstat
33
34
endif

35
# So far, only QNX has sem_timedwait()
36
ifeq ($(os),qnx)
37
 LDFLAGS += -lsocket
38
endif
39

40
SBBS_LIBS	+=	-lcl
41

42
43
44
45
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

46
47
48
49
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

50
ifdef DONT_BLAME_SYNCHRONET
51
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
52
endif
53

54
55
56
ifeq ($(os),linux)
 ifeq ($(shell test -f /usr/include/linux/capability.h && echo "yes"),yes)
  CFLAGS += -DUSE_LINUX_CAPS
57
  CON_LIBS += -lcap
58
59
60
 endif
endif

61
# JS and NSPR setup stuff...
62
63
64
65
ifeq ($(shell nspr-config --version > /dev/null 2>&1 && echo YES),YES)
 NSPRDIR ?= $(shell nspr-config --libdir)
 NSPRINCLUDE ?= $(shell nspr-config --includedir)
endif
66
67
68
69
70
71
72
73
74
75
76
77
78
79

ifeq ($(os),sunos)
 ifeq ($(shell test -f /usr/sfw/lib/mozilla/libmozjs.so && echo "yes"),yes)
  JSLIBDIR ?= /usr/sfw/lib/mozilla
  JSLIB ?= mozjs
 endif
 ifeq ($(shell test -f /usr/sfw/lib/mozilla/libnspr4.so && echo "yes"),yes)
  NSPRDIR ?= /usr/sfw/lib/mozilla
  ifeq ($(shell test -d /usr/sfw/include/mozilla/nspr && echo "yes"),yes)
   NSPRINCLUDE ?= /usr/sfw/include/mozilla/nspr
  endif
 endif
endif

80
81
82
83
84
85
CFLAGS += -DJAVASCRIPT
ifdef JSINCLUDE
 CFLAGS += -I$(JSINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)js
endif
86
87
88
ifdef NSPRINCLUDE
 CFLAGS += -I$(NSPRINCLUDE)
else
89
90
 # Use local NSPR first...
 CFLAGS += -I/usr/local/include -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)nspr
91
endif
deuce's avatar
deuce committed
92
93
94
95
96
ifdef CRYPTLIBINCLUDE
 CFLAGS += -I$(CRYPTLIBINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)/../include/cryptlib
endif
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ifndef JSLIBDIR
 JSLIBDIR := $(SRC_ROOT)$(DIRSEP)..$(DIRSEP)lib$(DIRSEP)mozilla$(DIRSEP)js$(DIRSEP)$(machine).$(BUILD)
endif
ifndef JSLIB
 JSLIB	:=	js
endif
ifndef NSPRDIR
 NSPRDIR := $(SRC_ROOT)$(DIRSEP)..$(DIRSEP)lib$(DIRSEP)mozilla$(DIRSEP)nspr$(DIRSEP)$(machine).$(BUILD)
endif
JS_LDFLAGS += -L$(JSLIBDIR) -l$(JSLIB)
#The following is needed for nspr support on Linux
ifeq ($(os),linux)
 JS_LDFLAGS	+=	-ldl
endif
deuce's avatar
deuce committed
111
JS_LDFLAGS	+=	-L/usr/local/lib -L$(NSPRDIR) -lnspr4
112
113
CFLAGS	+=	$(JS_CFLAGS)
LDFLAGS	+=	$(JS_LDFLAGS)
114

deuce's avatar
deuce committed
115
ifndef CRYPTLIBDIR
deuce's avatar
deuce committed
116
 CRYPTLIBDIR := $(SRC_ROOT)/../lib/cryptlib/$(machine).release
deuce's avatar
deuce committed
117
endif
deuce's avatar
deuce committed
118
LDFLAGS	+=	-L$(CRYPTLIBDIR)
deuce's avatar
deuce committed
119

120
include sbbsdefs.mk
121
MT_CFLAGS	+=	$(SBBSDEFS)
122

123
# Set up LD_RUN_PATH for run-time locating of the .so files
124
ifdef SBBSDIR
125
 ifeq ($(os),sunos)
126
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
127
 else
128
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
129
 endif
130
else
131
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
132
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
133
 else
deuce's avatar
deuce committed
134
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
135
 endif
136
endif
137
export LD_RUN_PATH
138

deuce's avatar
deuce committed
139
CON_LIBS	:= -lsbbs -lftpsrvr -lwebsrvr -lmailsrvr -lservices
140
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
141
ifeq ($(os),darwin)
deuce's avatar
deuce committed
142
143
144
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
145
else
deuce's avatar
deuce committed
146
147
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
148
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G
deuce's avatar
deuce committed
149
150
151
152
153
  SHLIBOPTS	:=	
 else
  MKSHLIB		:=	$(CC)
  MKSHPPLIB		:=	$(CXX)
 endif
deuce's avatar
deuce committed
154
endif
155

156
157
CFLAGS	+=	$(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS)
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS)
deuce's avatar
deuce committed
158

159
160
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
161
	@echo Linking $@
162
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
163
164

# Synchronet BBS library Link Rule
165
$(SBBS): $(OBJS) $(LIBS)
166
	@echo Linking $@
167
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(LIBS) $(SHLIBOPTS)
168
169

# FTP Server Link Rule
170
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
171
	@echo Linking $@
172
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
173
174

# Mail Server Link Rule
175
$(MAILSRVR): $(MAIL_OBJS)
176
	@echo Linking $@
177
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
178

deuce's avatar
deuce committed
179
# Web Server Link Rule
180
$(WEBSRVR): $(WEB_OBJS)
181
	@echo Linking $@
182
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
183
184

# Services Link Rule
185
$(SERVICES): $(SERVICE_OBJS)
186
	@echo Linking $@
187
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
188
189

# Synchronet Console Build Rule
190
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
191
	@echo Linking $@
192
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
193
194

# Baja Utility
195
$(BAJA): $(BAJA_OBJS)
196
	@echo Linking $@
197
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
198

199
# UnBaja Utility
deuce's avatar
deuce committed
200
$(UNBAJA): $(OBJODIR) $(EXEODIR) $(UNBAJA_OBJS)
201
	@echo Linking $@
deuce's avatar
deuce committed
202
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
203

204
# Node Utility
205
$(NODE): $(NODE_OBJS)
206
	@echo Linking $@
207
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
208
209

# FIXSMB Utility
210
$(FIXSMB): $(FIXSMB_OBJS)
211
	@echo Linking $@
212
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
213
214

# CHKSMB Utility
215
$(CHKSMB): $(CHKSMB_OBJS)
216
	@echo Linking $@
217
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
218
219

# SMB Utility
220
221
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
222
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
223

224
225
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
226
	@echo Linking $@
227
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
228

rswindell's avatar
rswindell committed
229
# SBBSecho Configuration Program
230
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
231
	@echo Linking $@
232
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(ECHOCFG_OBJS) $(UIFC-MT_LDFLAGS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
rswindell's avatar
rswindell committed
233

rswindell's avatar
rswindell committed
234
# ADDFILES
235
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
236
	@echo Linking $@
237
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
238

239
# FILELIST
240
$(FILELIST): $(FILELIST_OBJS)
241
	@echo Linking $@
242
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
243

244
# MAKEUSER
245
$(MAKEUSER): $(MAKEUSER_OBJS)
246
	@echo Linking $@
247
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
248

rswindell's avatar
rswindell committed
249
# JSEXEC
250
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
251
	@echo Linking $@
252
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
253

254
255
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
256
	@echo Linking $@
257
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
258

259
# ASC2ANS
260
$(ASC2ANS): $(OBJODIR)/asc2ans.o
261
	@echo Linking $@
262
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
263
264
265
266

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
267
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
268
269
270
271
272
273

# QWKNODES
$(QWKNODES): $(QWKNODES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(QWKNODES_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)

deuce's avatar
deuce committed
274
275
276
277
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
278
279
280
281
282

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
283
284
285
286
287

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
288
289
290
291
292

# DUPEFIND
$(DUPEFIND): $(DUPEFIND_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
293
294
295
296
297

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)