GNUmakefile 7.59 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
 SBBS_LIBS += ${UIFC-MT_LDFLAGS} ${UIFC-MT_LIBS} $(CIOLIB-MT_LDFLAGS) ${CIOLIB-MT_LIBS}
56
57
 OBJS += $(MTOBJODIR)$(DIRSEP)js_uifc$(OFILE) \
			$(MTOBJODIR)$(DIRSEP)js_conio$(OFILE)
58
 EXTRA_SBBS_DEPENDS += $(CIOLIB-MT) $(UIFCLIB-MT)
deuce's avatar
deuce committed
59
60
endif

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

69
include sbbsdefs.mk
70
MT_CFLAGS	+=	$(SBBSDEFS)
71

72
# Set up LD_RUN_PATH for run-time locating of the .so files
73
ifdef SBBSDIR
74
 ifeq ($(os),sunos)
75
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
76
 else
77
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
78
 endif
79
else
80
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
81
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
82
 else
deuce's avatar
deuce committed
83
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
84
 endif
85
endif
86
export LD_RUN_PATH
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)
106
107
108
CFLAGS	+=	-I../comio
vpath %.c ../comio
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
109
JSDOOR_OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
deuce's avatar
deuce committed
110
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS) $(CRYPT_LDFLAGS)
deuce's avatar
deuce committed
111

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

202
203
204
205
206
# JSDOOR
$(JSDOOR): $(JSDOOR_OBJS) $(SBBS)
	@echo Linking $@
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSDOOR_OBJS) $(JS_LIBS) $(CRYPT_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)

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

212
213
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
214
	@echo Linking $@
215
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
216

217
# ASC2ANS
218
$(ASC2ANS): $(OBJODIR)/asc2ans.o
219
	@echo Linking $@
220
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
221
222
223
224

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

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

deuce's avatar
deuce committed
232
233
234
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
235
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
236
237
238
239

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
240
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
241
242
243
244

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
245
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
246
247
248
249

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

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
255
	$(QUIET)$(CC) $(CONSOLE_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
256
257
258
259

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