GNUmakefile 6.87 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	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS)
UTIL_LIBS	+=	$(SMBLIB_LIBS)
deuce's avatar
deuce committed
21

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

28
ifeq ($(os),sunos)    # Solaris
29
 LDFLAGS += -lsocket -lnsl -lrt
30
31
endif

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

37
38
39
40
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

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

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

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

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

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

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

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

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

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

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

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

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

# Mail Server Link Rule
134
$(WEBSRVR): $(WEB_OBJS)
135
	@echo Linking $@
136
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
137
138

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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