GNUmakefile 7.02 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
 SBBS_LIBS += -lutil
56
 ifeq ($(shell test -f /usr/include/sys/capability.h && echo "yes"),yes)
57
  CFLAGS += -DUSE_LINUX_CAPS
58
  CON_LIBS += -lcap
59
60
61
 endif
endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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