GNUmakefile 6.89 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
39
40
41
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

42
43
44
45
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

46
ifdef DONT_BLAME_SYNCHRONET
47
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
48
endif
49

50
51
52
53
54
55
56
# JS and NSPR setup stuff...
CFLAGS += -DJAVASCRIPT
ifdef JSINCLUDE
 CFLAGS += -I$(JSINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)js
endif
57
58
59
ifdef NSPRINCLUDE
 CFLAGS += -I$(NSPRINCLUDE)
else
60
61
 # Use local NSPR first...
 CFLAGS += -I/usr/local/include -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)nspr
62
endif
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
77
JS_LDFLAGS	+=	-L/usr/local/lib -L$(NSPRDIR) -lnspr4
78
79
80

CFLAGS	+=	$(JS_CFLAGS)
LDFLAGS	+=	$(JS_LDFLAGS)
81

82
include sbbsdefs.mk
83
MT_CFLAGS	+=	$(SBBSDEFS)
84

85
# Set up LD_RUN_PATH for run-time locating of the .so files
deuce's avatar
deuce committed
86
PWD	:=	$(shell pwd)
87
88
89
90
91
ifdef SBBSDIR
 LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR)
else
 LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR)
endif
92
export LD_RUN_PATH
93

94
CON_LIBS	= -lsbbs -lftpsrvr -lwebsrvr -lmailsrvr -lservices
95
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
96
ifeq ($(os),darwin)
deuce's avatar
deuce committed
97
98
99
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
100
else
deuce's avatar
deuce committed
101
102
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
103
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G
deuce's avatar
deuce committed
104
105
106
107
108
  SHLIBOPTS	:=	
 else
  MKSHLIB		:=	$(CC)
  MKSHPPLIB		:=	$(CXX)
 endif
deuce's avatar
deuce committed
109
endif
110

111
112
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
113

114
115
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
116
	@echo Linking $@
117
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
118
119

# Synchronet BBS library Link Rule
120
$(SBBS): $(OBJS) $(LIBS)
121
	@echo Linking $@
122
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(SHLIBOPTS)
123
124

# FTP Server Link Rule
125
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
126
	@echo Linking $@
127
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
128
129

# Mail Server Link Rule
130
$(MAILSRVR): $(MAIL_OBJS)
131
	@echo Linking $@
132
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
133

deuce's avatar
deuce committed
134
# Web Server Link Rule
135
$(WEBSRVR): $(WEB_OBJS)
136
	@echo Linking $@
137
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
138
139

# Services Link Rule
140
$(SERVICES): $(SERVICE_OBJS)
141
	@echo Linking $@
142
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
143
144

# Synchronet Console Build Rule
145
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
146
	@echo Linking $@
147
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
148
149

# Baja Utility
150
$(BAJA): $(BAJA_OBJS)
151
	@echo Linking $@
152
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
153

154
# UnBaja Utility
deuce's avatar
deuce committed
155
$(UNBAJA): $(OBJODIR) $(EXEODIR) $(UNBAJA_OBJS)
156
	@echo Linking $@
157
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS)
158

159
# Node Utility
160
$(NODE): $(NODE_OBJS)
161
	@echo Linking $@
162
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
163
164

# FIXSMB Utility
165
$(FIXSMB): $(FIXSMB_OBJS)
166
	@echo Linking $@
167
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
168
169

# CHKSMB Utility
170
$(CHKSMB): $(CHKSMB_OBJS)
171
	@echo Linking $@
172
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
173
174

# SMB Utility
175
176
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
177
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
178

179
180
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
181
	@echo Linking $@
182
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
183

rswindell's avatar
rswindell committed
184
# SBBSecho Configuration Program
185
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
186
	@echo Linking $@
187
	$(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
188

rswindell's avatar
rswindell committed
189
# ADDFILES
190
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
191
	@echo Linking $@
192
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
193

194
# FILELIST
195
$(FILELIST): $(FILELIST_OBJS)
196
	@echo Linking $@
197
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
198

199
# MAKEUSER
200
$(MAKEUSER): $(MAKEUSER_OBJS)
201
	@echo Linking $@
202
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
203

rswindell's avatar
rswindell committed
204
# JSEXEC
205
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
206
	@echo Linking $@
207
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
208

209
210
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
211
	@echo Linking $@
212
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
213

214
# ASC2ANS
215
$(ASC2ANS): $(OBJODIR)/asc2ans.o
216
	@echo Linking $@
217
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
218
219
220
221

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
222
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
223
224
225
226
227
228

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

deuce's avatar
deuce committed
229
230
231
232
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
233
234
235
236
237

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
238
239
240
241
242

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
243
244
245
246
247

# DUPEFIND
$(DUPEFIND): $(DUPEFIND_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
248
249
250
251
252

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