GNUmakefile 7.93 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
deuce's avatar
deuce committed
31
 SBBS_LIBS	+=	-lkstat
32
33
endif

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

39
SBBS_LIBS	+=	-lcl
40

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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