Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

GNUmakefile 9.4 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)
23
FILE_LIBS	= -larchive
deuce's avatar
deuce committed
24

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

31
ifeq ($(os),sunos)    # Solaris
deuce's avatar
deuce committed
32
 LDFLAGS += -lnsl -lrt
deuce's avatar
deuce committed
33
 SBBS_LIBS	+=	-lkstat
34 35
endif

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

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

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

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

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

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

68 69 70 71 72 73 74 75
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
76
 else
77 78 79 80 81
  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
82
 endif
83 84 85
 export LD_RUN_PATH
 ifeq ($(CCPRE),clang)
  LDFLAGS += -rpath $(LD_RUN_PATH)
86
 endif
87
endif
88

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

106
CFLAGS	+=	$(JS_CFLAGS) $(CRYPT_CFLAGS) $(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(ENCODE_CFLAGS) $(HASH_CFLAGS)
107 108
CFLAGS	+=	-I../comio
vpath %.c ../comio
109 110 111 112
ifeq ($(os), win32)
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_win32$(OFILE)
else
113
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
114
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
115
endif
116
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
117

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rswindell's avatar
rswindell committed
188
# SBBSecho Configuration Program
189
$(ECHOCFG): $(ECHOCFG_OBJS) $(ENCODE_LIB)
rswindell's avatar
rswindell committed
190
	@echo Linking $@
191
	$(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
192

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

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

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

208
# JSDOOR
Deucе's avatar
Deucе committed
209
$(JSDOOR): $(JSDOOR_OBJS) $(XPDEV_LIB) $(ENCODE_LIB) $(HASH_LIB) | $(EXEODIR)
210
	@echo Linking $@
211
	$(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) $(FILE_LIBS)
212

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

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

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

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

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

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

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

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

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

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

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

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

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

# 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)
287 288 289 290

$(UPGRADE_TO_V319): $(UPGRADE_TO_V319_OBJS) $(OBJODIR) $(EXEODIR)
	@echo Linking $@
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(UPGRADE_TO_V319_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS) $(ENCODE_LIBS) $(HASH_LIBS) $(FILE_LIBS)