GNUmakefile 9 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
#																		#
# Optional build targets: dlls, utils, mono, all (default)				#
#########################################################################

14
15
PWD	:=	$(shell pwd)
SRC_ROOT	?=	${PWD}/..
16
include $(SRC_ROOT)/build/Common.gmake
Deucе's avatar
Deucе committed
17
include extdeps.mk
18

19
UTIL_LDFLAGS	:=	$(LDFLAGS)
20
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS) $(ENCODE_LDFLAGS)
21
CONSOLE_LDFLAGS	+=	$(LDFLAGS) $(SMBLIB_LDFLAGS) $(XPDEV_LDFLAGS)
22
UTIL_LIBS	+=	$(HASH_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
41
42
43
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

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

deuce's avatar
deuce committed
48
49
ifdef BUILD_JSDOCS
 CFLAGS += -DBUILD_JSDOCS
50
 SBBS_LIBS += ${UIFC-MT_LDFLAGS} ${UIFC-MT_LIBS} $(CIOLIB-MT_LDFLAGS) ${CIOLIB-MT_LIBS}
51
52
 OBJS += $(MTOBJODIR)$(DIRSEP)js_uifc$(OFILE) \
			$(MTOBJODIR)$(DIRSEP)js_conio$(OFILE)
53
 EXTRA_SBBS_DEPENDS += $(CIOLIB-MT) $(UIFCLIB-MT)
deuce's avatar
deuce committed
54
55
endif

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

64
include sbbsdefs.mk
65
MT_CFLAGS	+=	$(SBBSDEFS)
66

67
68
69
70
71
72
73
74
ifndef NO_LD_RUN_PATH
 # Set up LD_RUN_PATH for run-time locating of the .so files
 ifdef SBBSDIR
  ifeq ($(os),sunos)
   LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
  else
   LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
  endif
75
 else
76
77
78
79
80
  ifeq ($(os),sunos)
   LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
  else
   LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
  endif
81
 endif
82
83
84
 export LD_RUN_PATH
 ifeq ($(CCPRE),clang)
  LDFLAGS += -rpath $(LD_RUN_PATH)
85
 endif
86
endif
87

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

105
CFLAGS	+=	$(JS_CFLAGS) $(CRYPT_CFLAGS) $(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(ENCODE_CFLAGS) $(HASH_CFLAGS)
106
107
CFLAGS	+=	-I../comio
vpath %.c ../comio
108
109
110
111
ifeq ($(os), win32)
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
else
112
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
113
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
114
endif
115
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(ENCODE_LDFLAGS) $(HASH_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS) $(CRYPT_LDFLAGS)
deuce's avatar
deuce committed
116

117
118
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
119
	@echo Linking $@
deuce's avatar
deuce committed
120
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS) $(JS_LIBS) $(CRYPT_LIBS)
121
122

# Synchronet BBS library Link Rule
123
$(SBBS): $(JS_DEPS) $(CRYPT_DEPS) $(OBJS) $(LIBS) $(EXTRA_SBBS_DEPENDS) $(ENCODE_LIB) $(HASH_LIB) | $(LIBODIR)
124
	@echo Linking $@
125
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(LIBS) $(SHLIBOPTS) $(JS_LIBS) $(CRYPT_LIBS) $(ENCODE_LIBS) $(HASH_LIBS) $(XPDEV-MT_LIBS)
126
127

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

# Mail Server Link Rule
133
$(MAILSRVR): $(MAIL_OBJS)
134
	@echo Linking $@
135
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
136

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

# Services Link Rule
143
$(SERVICES): $(SERVICE_OBJS)
144
	@echo Linking $@
145
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
146
147

# Synchronet Console Build Rule
148
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
149
	@echo Linking $@
deuce's avatar
deuce committed
150
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
151
152

# Baja Utility
153
$(BAJA): $(BAJA_OBJS)
154
	@echo Linking $@
155
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(BAJA_OBJS) $(XPDEV_LIBS) $(HASH_LIBS)
156

157
# UnBaja Utility
deuce's avatar
deuce committed
158
$(UNBAJA): $(UNBAJA_OBJS) | $(OBJODIR) $(EXEODIR)
159
	@echo Linking $@
160
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
161

162
# Node Utility
163
$(NODE): $(NODE_OBJS)
164
	@echo Linking $@
165
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
166
167

# FIXSMB Utility
168
$(FIXSMB): $(FIXSMB_OBJS)
169
	@echo Linking $@
170
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
171
172

# CHKSMB Utility
173
$(CHKSMB): $(CHKSMB_OBJS)
174
	@echo Linking $@
175
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
176
177

# SMB Utility
178
179
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
180
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
181

182
183
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
184
	@echo Linking $@
185
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
rswindell's avatar
rswindell committed
186

rswindell's avatar
rswindell committed
187
# SBBSecho Configuration Program
188
$(ECHOCFG): $(ECHOCFG_OBJS) $(ENCODE_LIB)
rswindell's avatar
rswindell committed
189
	@echo Linking $@
190
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(ECHOCFG_OBJS) $(UIFC-MT_LDFLAGS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS) $(ENCODE_LIBS)
rswindell's avatar
rswindell committed
191

rswindell's avatar
rswindell committed
192
# ADDFILES
193
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
194
	@echo Linking $@
195
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
rswindell's avatar
rswindell committed
196

197
# FILELIST
198
$(FILELIST): $(FILELIST_OBJS) $(ENCODE_LIB)
199
	@echo Linking $@
200
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
201

202
# MAKEUSER
203
$(MAKEUSER): $(MAKEUSER_OBJS)
204
	@echo Linking $@
205
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
206

207
# JSDOOR
208
$(JSDOOR): $(JSDOOR_OBJS) $(SBBS) $(XPDEV_LIB) $(ENCODE_LIB) $(HASH_LIB) | $(EXEODIR)
209
	@echo Linking $@
210
	$(QUIET)$(CXX) $(JS_CFLAGS) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSDOOR_OBJS) $(JS_LIBS) $(CRYPT_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(SMBLIB_LIBS) $(ENCODE_LIBS) $(XPDEV-MT_LIBS) $(HASH_LIBS)
211

rswindell's avatar
rswindell committed
212
# JSEXEC
213
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
214
	@echo Linking $@
215
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(JS_LIBS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
216

217
218
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
219
	@echo Linking $@
220
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
221

222
# ASC2ANS
223
$(ASC2ANS): $(OBJODIR)/asc2ans.o
224
	@echo Linking $@
225
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
226
227
228
229

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
230
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(HASH_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
231
232
233
234

# QWKNODES
$(QWKNODES): $(QWKNODES_OBJS)
	@echo Linking $@
235
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(QWKNODES_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
deuce's avatar
deuce committed
236

deuce's avatar
deuce committed
237
238
239
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
240
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
241
242

# ALLUSERS
243
$(ALLUSERS): $(ALLUSERS_OBJS) $(ENCODE_LIB)
244
	@echo Linking $@
245
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
246
247

# DELFILES
248
$(DELFILES): $(DELFILES_OBJS) $(ENCODE_LIB)
deuce's avatar
deuce committed
249
	@echo Linking $@
250
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
251
252

# DUPEFIND
253
$(DUPEFIND): $(DUPEFIND_OBJS) $(ENCODE_LIB)
deuce's avatar
deuce committed
254
	@echo Linking $@
255
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(HASH_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
256
257
258
259

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
260
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS)
261
262

# DSTSEDIT
263
$(DSTSEDIT): $(DSTSEDIT_OBJS) $(ENCODE_LIB)
264
	@echo Linking $@
265
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DSTSEDIT_OBJS) $(XPDEV_LIBS) $(ENCODE_LIBS)
deuce's avatar
deuce committed
266
267
268
269
270

# READSAUCE
$(READSAUCE): $(READSAUCE_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(READSAUCE_OBJS) $(XPDEV_LIBS)
271
272
273
274
275

# SHOWSTAT
$(SHOWSTAT): $(SHOWSTAT_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SHOWSTAT_OBJS) $(XPDEV_LIBS)
276
277
278
279
280
281
282
283
284
285

# PKTDUMP
$(PKTDUMP): $(PKTDUMP_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(PKTDUMP_OBJS)

# FMSGDUMP
$(FMSGDUMP): $(FMSGDUMP_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FMSGDUMP_OBJS)