GNUmakefile 7.19 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
PWD	:=	$(shell pwd)
SRC_ROOT	?=	${PWD}/..
18
include $(SRC_ROOT)/build/Common.gmake
19

20
21
UTIL_LDFLAGS	:=	$(LDFLAGS)
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS)
22
CONSOLE_LDFLAGS	+=	$(LDFLAGS) $(SMBLIB_LDFLAGS) $(XPDEV_LDFLAGS)
23
UTIL_LIBS	+=	$(SMBLIB_LIBS)
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
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

deuce's avatar
deuce committed
53
54
ifdef BUILD_JSDOCS
 CFLAGS += -DBUILD_JSDOCS
55
56
 SBBS_LIBS += ${UIFC-MT_LDFLAGS} ${UIFC-MT_LIBS} $(CIOLIB-MT_LDFLAGS) ${CIOLIB-MT_LIBS}
 OBJS += $(MTOBJODIR)$(DIRSEP)js_uifc$(OFILE)
deuce's avatar
deuce committed
57
58
endif

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

67
include sbbsdefs.mk
68
MT_CFLAGS	+=	$(SBBSDEFS)
69

70
# Set up LD_RUN_PATH for run-time locating of the .so files
71
ifdef SBBSDIR
72
 ifeq ($(os),sunos)
73
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
74
 else
75
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
76
 endif
77
else
78
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
79
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
80
 else
deuce's avatar
deuce committed
81
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
82
 endif
83
endif
84
export LD_RUN_PATH
85

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

deuce's avatar
deuce committed
103
CFLAGS	+=	$(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(JS_CFLAGS) $(CRYPT_CFLAGS)
104
105
106
CFLAGS	+=	-I../comio
vpath %.c ../comio
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
deuce's avatar
deuce committed
107
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS) $(CRYPT_LDFLAGS)
deuce's avatar
deuce committed
108

109
110
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
111
	@echo Linking $@
deuce's avatar
deuce committed
112
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS) $(JS_LIBS) $(CRYPT_LIBS)
113
114

# Synchronet BBS library Link Rule
115
$(SBBS): $(JS_DEPS) $(CRYPT_DEPS) $(OBJS) $(LIBS) | $(LIBODIR)
116
	@echo Linking $@
117
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(LIBS) $(SHLIBOPTS) $(JS_LIBS) $(CRYPT_LIBS) $(XPDEV-MT_LIBS)
118
119

# FTP Server Link Rule
120
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
121
	@echo Linking $@
122
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
123
124

# Mail Server Link Rule
125
$(MAILSRVR): $(MAIL_OBJS)
126
	@echo Linking $@
127
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
128

deuce's avatar
deuce committed
129
# Web Server Link Rule
130
$(WEBSRVR): $(WEB_OBJS)
131
	@echo Linking $@
132
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
133
134

# Services Link Rule
135
$(SERVICES): $(SERVICE_OBJS)
136
	@echo Linking $@
137
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
138
139

# Synchronet Console Build Rule
140
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
141
	@echo Linking $@
deuce's avatar
deuce committed
142
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
143
144

# Baja Utility
145
$(BAJA): $(BAJA_OBJS)
146
	@echo Linking $@
147
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
148

149
# UnBaja Utility
deuce's avatar
deuce committed
150
$(UNBAJA): $(UNBAJA_OBJS) | $(OBJODIR) $(EXEODIR)
151
	@echo Linking $@
152
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
153

154
# Node Utility
155
$(NODE): $(NODE_OBJS)
156
	@echo Linking $@
157
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
158
159

# FIXSMB Utility
160
$(FIXSMB): $(FIXSMB_OBJS)
161
	@echo Linking $@
162
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
163
164

# CHKSMB Utility
165
$(CHKSMB): $(CHKSMB_OBJS)
166
	@echo Linking $@
167
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
168
169

# SMB Utility
170
171
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
172
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
173

174
175
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
176
	@echo Linking $@
177
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
178

rswindell's avatar
rswindell committed
179
# SBBSecho Configuration Program
180
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
181
	@echo Linking $@
182
	$(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
183

rswindell's avatar
rswindell committed
184
# ADDFILES
185
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
186
	@echo Linking $@
187
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
188

189
# FILELIST
190
$(FILELIST): $(FILELIST_OBJS)
191
	@echo Linking $@
192
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
193

194
# MAKEUSER
195
$(MAKEUSER): $(MAKEUSER_OBJS)
196
	@echo Linking $@
197
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
198

rswindell's avatar
rswindell committed
199
# JSEXEC
200
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
201
	@echo Linking $@
deuce's avatar
deuce committed
202
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
203

204
205
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
206
	@echo Linking $@
207
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
208

209
# ASC2ANS
210
$(ASC2ANS): $(OBJODIR)/asc2ans.o
211
	@echo Linking $@
212
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
213
214
215
216

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
217
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
218
219
220
221

# QWKNODES
$(QWKNODES): $(QWKNODES_OBJS)
	@echo Linking $@
222
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(QWKNODES_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
223

deuce's avatar
deuce committed
224
225
226
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
227
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
228
229
230
231

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
232
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
233
234
235
236

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

# DUPEFIND
$(DUPEFIND): $(DUPEFIND_OBJS)
	@echo Linking $@
242
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
243
244
245
246

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
247
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
248
249
250
251

# DSTSEDIT
$(DSTSEDIT): $(DSTSEDIT_OBJS)
	@echo Linking $@
252
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DSTSEDIT_OBJS) $(XPDEV_LIBS)