GNUmakefile 7.91 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
SRC_ROOT	=	..
include $(SRC_ROOT)/build/Common.gmake
18

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

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

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

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

38
SBBS_LIBS	+=	-lcl
39

40
41
42
43
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

44
45
46
47
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

48
ifdef DONT_BLAME_SYNCHRONET
49
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
50
endif
51

52
# JS and NSPR setup stuff...
53
54
55
56
57
58
59
60
61
62
63
64
65
66

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

67
68
69
70
71
72
CFLAGS += -DJAVASCRIPT
ifdef JSINCLUDE
 CFLAGS += -I$(JSINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)js
endif
73
74
75
ifdef NSPRINCLUDE
 CFLAGS += -I$(NSPRINCLUDE)
else
76
77
 # Use local NSPR first...
 CFLAGS += -I/usr/local/include -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)nspr
78
endif
deuce's avatar
deuce committed
79
80
81
82
83
ifdef CRYPTLIBINCLUDE
 CFLAGS += -I$(CRYPTLIBINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)/../include/cryptlib
endif
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
98
JS_LDFLAGS	+=	-L/usr/local/lib -L$(NSPRDIR) -lnspr4
99
100
CFLAGS	+=	$(JS_CFLAGS)
LDFLAGS	+=	$(JS_LDFLAGS)
101

deuce's avatar
deuce committed
102
103
104
ifndef CRYPTLIBDIR
 CRYPTLIBDIR := $(SRC_ROOT)/../lib/cryptlib/$(os).release
endif
deuce's avatar
deuce committed
105
LDFLAGS	+=	-L$(CRYPTLIBDIR)
deuce's avatar
deuce committed
106

107
include sbbsdefs.mk
108
MT_CFLAGS	+=	$(SBBSDEFS)
109

110
# Set up LD_RUN_PATH for run-time locating of the .so files
deuce's avatar
deuce committed
111
PWD	:=	$(shell pwd)
112
ifdef SBBSDIR
113
 ifeq ($(os),sunos)
114
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR):$(PWD)/$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
115
 else
116
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR):$(PWD)/$(CRYPTLIBDIR)
117
 endif
118
else
119
 ifeq ($(os),sunos)
120
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR):$(PWD)/$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
121
 else
122
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR):$(PWD)/$(CRYPTLIBDIR)
123
 endif
124
endif
125
export LD_RUN_PATH
126

deuce's avatar
deuce committed
127
CON_LIBS	:= -lsbbs -lftpsrvr -lwebsrvr -lmailsrvr -lservices
128
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
129
ifeq ($(os),darwin)
deuce's avatar
deuce committed
130
131
132
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
133
else
deuce's avatar
deuce committed
134
135
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
136
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G
deuce's avatar
deuce committed
137
138
139
140
141
  SHLIBOPTS	:=	
 else
  MKSHLIB		:=	$(CC)
  MKSHPPLIB		:=	$(CXX)
 endif
deuce's avatar
deuce committed
142
endif
143

144
145
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
146

147
148
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
149
	@echo Linking $@
150
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
151
152

# Synchronet BBS library Link Rule
153
$(SBBS): $(OBJS) $(LIBS)
154
	@echo Linking $@
155
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(LIBS) $(SHLIBOPTS)
156
157

# FTP Server Link Rule
158
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
159
	@echo Linking $@
160
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
161
162

# Mail Server Link Rule
163
$(MAILSRVR): $(MAIL_OBJS)
164
	@echo Linking $@
165
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
166

deuce's avatar
deuce committed
167
# Web Server Link Rule
168
$(WEBSRVR): $(WEB_OBJS)
169
	@echo Linking $@
170
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
171
172

# Services Link Rule
173
$(SERVICES): $(SERVICE_OBJS)
174
	@echo Linking $@
175
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
176
177

# Synchronet Console Build Rule
178
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
179
	@echo Linking $@
180
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
181
182

# Baja Utility
183
$(BAJA): $(BAJA_OBJS)
184
	@echo Linking $@
185
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
186

187
# UnBaja Utility
deuce's avatar
deuce committed
188
$(UNBAJA): $(OBJODIR) $(EXEODIR) $(UNBAJA_OBJS)
189
	@echo Linking $@
deuce's avatar
deuce committed
190
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
191

192
# Node Utility
193
$(NODE): $(NODE_OBJS)
194
	@echo Linking $@
195
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
196
197

# FIXSMB Utility
198
$(FIXSMB): $(FIXSMB_OBJS)
199
	@echo Linking $@
200
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
201
202

# CHKSMB Utility
203
$(CHKSMB): $(CHKSMB_OBJS)
204
	@echo Linking $@
205
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
206
207

# SMB Utility
208
209
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
210
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
211

212
213
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
214
	@echo Linking $@
215
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
216

rswindell's avatar
rswindell committed
217
# SBBSecho Configuration Program
218
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
219
	@echo Linking $@
220
	$(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
221

rswindell's avatar
rswindell committed
222
# ADDFILES
223
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
224
	@echo Linking $@
225
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
226

227
# FILELIST
228
$(FILELIST): $(FILELIST_OBJS)
229
	@echo Linking $@
230
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
231

232
# MAKEUSER
233
$(MAKEUSER): $(MAKEUSER_OBJS)
234
	@echo Linking $@
235
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
236

rswindell's avatar
rswindell committed
237
# JSEXEC
238
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
239
	@echo Linking $@
240
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
241

242
243
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
244
	@echo Linking $@
245
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
246

247
# ASC2ANS
248
$(ASC2ANS): $(OBJODIR)/asc2ans.o
249
	@echo Linking $@
250
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
251
252
253
254

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
255
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
256
257
258
259
260
261

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

deuce's avatar
deuce committed
262
263
264
265
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
266
267
268
269
270

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
271
272
273
274
275

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
276
277
278
279
280

# DUPEFIND
$(DUPEFIND): $(DUPEFIND_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
281
282
283
284
285

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