GNUmakefile 7.06 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
55
56
ifdef BUILD_JSDOCS
 CFLAGS += -DBUILD_JSDOCS
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
# Set up LD_RUN_PATH for run-time locating of the .so files
69
ifdef SBBSDIR
70
 ifeq ($(os),sunos)
71
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
72
 else
73
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
74
 endif
75
else
76
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
77
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
78
 else
deuce's avatar
deuce committed
79
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
80
 endif
81
endif
82
export LD_RUN_PATH
83

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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