GNUmakefile 7 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
UTIL_LIBS	+=	$(SMBLIB_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
SBBS_LIBS	+=	-lcl
41

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

46
47
48
49
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

50
ifdef DONT_BLAME_SYNCHRONET
51
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
52
endif
53

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

deuce's avatar
deuce committed
61
62
63
64
65
ifdef CRYPTLIBINCLUDE
 CFLAGS += -I$(CRYPTLIBINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)/../include/cryptlib
endif
66

deuce's avatar
deuce committed
67
ifndef CRYPTLIBDIR
deuce's avatar
deuce committed
68
 CRYPTLIBDIR := $(SRC_ROOT)/../lib/cryptlib/$(machine).release
deuce's avatar
deuce committed
69
endif
deuce's avatar
deuce committed
70
LDFLAGS	+=	-L$(CRYPTLIBDIR)
deuce's avatar
deuce committed
71

72
include sbbsdefs.mk
73
MT_CFLAGS	+=	$(SBBSDEFS)
74

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

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

deuce's avatar
deuce committed
108
CFLAGS	+=	$(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(JS_CFLAGS)
109
110
111
CFLAGS	+=	-I../comio
vpath %.c ../comio
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
deuce's avatar
deuce committed
112
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS)
deuce's avatar
deuce committed
113

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

# Synchronet BBS library Link Rule
120
$(SBBS): $(OBJS) $(LIBS)
121
	@echo Linking $@
122
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(LIBS) $(SHLIBOPTS)
123
124

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

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

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

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

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

# Baja Utility
150
$(BAJA): $(BAJA_OBJS)
151
	@echo Linking $@
152
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
153

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

159
# Node Utility
160
$(NODE): $(NODE_OBJS)
161
	@echo Linking $@
162
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
163
164

# FIXSMB Utility
165
$(FIXSMB): $(FIXSMB_OBJS)
166
	@echo Linking $@
167
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
168
169

# CHKSMB Utility
170
$(CHKSMB): $(CHKSMB_OBJS)
171
	@echo Linking $@
172
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
173
174

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

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

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

rswindell's avatar
rswindell committed
189
# ADDFILES
190
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
191
	@echo Linking $@
192
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
193

194
# FILELIST
195
$(FILELIST): $(FILELIST_OBJS)
196
	@echo Linking $@
197
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
198

199
# MAKEUSER
200
$(MAKEUSER): $(MAKEUSER_OBJS)
201
	@echo Linking $@
202
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
203

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

209
210
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
211
	@echo Linking $@
212
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
213

214
# ASC2ANS
215
$(ASC2ANS): $(OBJODIR)/asc2ans.o
216
	@echo Linking $@
217
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
218
219
220
221

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

# QWKNODES
$(QWKNODES): $(QWKNODES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(QWKNODES_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)

deuce's avatar
deuce committed
229
230
231
232
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
233
234
235
236
237

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
238
239
240
241
242

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
243
244
245
246
247

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

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
253
254
255
256
257

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