GNUmakefile 6.87 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
41
42
43
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

44
45
46
47
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

48
ifdef DONT_BLAME_SYNCHRONET
49
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
50
endif
51

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

60
include sbbsdefs.mk
61
MT_CFLAGS	+=	$(SBBSDEFS)
62

63
# Set up LD_RUN_PATH for run-time locating of the .so files
64
ifdef SBBSDIR
65
 ifeq ($(os),sunos)
66
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
67
 else
68
  LD_RUN_PATH	:=	$(SBBSDIR)/exec:$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
69
 endif
70
else
71
 ifeq ($(os),sunos)
deuce's avatar
deuce committed
72
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR):/opt/sfw/gcc-3/lib
73
 else
deuce's avatar
deuce committed
74
  LD_RUN_PATH	:=	$(PWD)/$(LIBODIR):$(JSLIBDIR):$(NSPRDIR):$(CRYPTLIBDIR)
75
 endif
76
endif
77
export LD_RUN_PATH
78

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

deuce's avatar
deuce committed
96
CFLAGS	+=	$(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) $(JS_CFLAGS) $(CRYPT_CFLAGS)
97
98
99
CFLAGS	+=	-I../comio
vpath %.c ../comio
OBJS	+= $(MTOBJODIR)$(DIRSEP)comio_nix$(OFILE)
deuce's avatar
deuce committed
100
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(JS_LDFLAGS) $(CRYPT_LDFLAGS)
deuce's avatar
deuce committed
101

102
103
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
104
	@echo Linking $@
deuce's avatar
deuce committed
105
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SBBS_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS) $(JS_LIBS) $(CRYPT_LIBS)
106
107

# Synchronet BBS library Link Rule
108
$(SBBS): $(JS_DEPS) $(CRYPT_DEPS) $(OBJS) $(LIBS) | $(LIBODIR)
109
	@echo Linking $@
deuce's avatar
deuce committed
110
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(SBBS_LIBS) $(LIBS) $(SHLIBOPTS) $(JS_LIBS) $(CRYPT_LIBS)
111
112

# FTP Server Link Rule
113
$(FTPSRVR): $(MTOBJODIR)/ftpsrvr.o
114
	@echo Linking $@
115
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MTOBJODIR)/ftpsrvr.o $(SHLIBOPTS) -o $@
116
117

# Mail Server Link Rule
118
$(MAILSRVR): $(MAIL_OBJS)
119
	@echo Linking $@
120
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(MAIL_OBJS) $(SHLIBOPTS) -o $@
121

deuce's avatar
deuce committed
122
# Web Server Link Rule
123
$(WEBSRVR): $(WEB_OBJS)
124
	@echo Linking $@
125
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(WEB_OBJS) $(SHLIBOPTS) -o $@
126
127

# Services Link Rule
128
$(SERVICES): $(SERVICE_OBJS)
129
	@echo Linking $@
130
	$(QUIET)$(MKSHLIB) $(LDFLAGS) $(SERVICE_OBJS) $(SHLIBOPTS) -o $@
131
132

# Synchronet Console Build Rule
133
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
134
	@echo Linking $@
deuce's avatar
deuce committed
135
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
136
137

# Baja Utility
138
$(BAJA): $(BAJA_OBJS)
139
	@echo Linking $@
140
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
141

142
# UnBaja Utility
deuce's avatar
deuce committed
143
$(UNBAJA): $(UNBAJA_OBJS) | $(OBJODIR) $(EXEODIR)
144
	@echo Linking $@
deuce's avatar
deuce committed
145
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS) $(UTIL_LIBS)
146

147
# Node Utility
148
$(NODE): $(NODE_OBJS)
149
	@echo Linking $@
150
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
151
152

# FIXSMB Utility
153
$(FIXSMB): $(FIXSMB_OBJS)
154
	@echo Linking $@
155
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
156
157

# CHKSMB Utility
158
$(CHKSMB): $(CHKSMB_OBJS)
159
	@echo Linking $@
160
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(CHKSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
161
162

# SMB Utility
163
164
$(SMBUTIL): $(SMBUTIL_OBJS)
	@echo Linking $@
165
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBUTIL_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
166

167
168
# SBBSecho (FidoNet Packet Tosser)
$(SBBSECHO): $(SBBSECHO_OBJS)
rswindell's avatar
rswindell committed
169
	@echo Linking $@
170
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SBBSECHO_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
171

rswindell's avatar
rswindell committed
172
# SBBSecho Configuration Program
173
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
174
	@echo Linking $@
175
	$(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
176

rswindell's avatar
rswindell committed
177
# ADDFILES
178
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
179
	@echo Linking $@
180
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
181

182
# FILELIST
183
$(FILELIST): $(FILELIST_OBJS)
184
	@echo Linking $@
185
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
186

187
# MAKEUSER
188
$(MAKEUSER): $(MAKEUSER_OBJS)
189
	@echo Linking $@
190
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
191

rswindell's avatar
rswindell committed
192
# JSEXEC
193
$(JSEXEC): $(JSEXEC_OBJS) $(SBBS)
rswindell's avatar
rswindell committed
194
	@echo Linking $@
deuce's avatar
deuce committed
195
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(JSEXEC_OBJS) -lsbbs $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
196

197
198
# ANS2ASC
$(ANS2ASC): $(OBJODIR)/ans2asc.o
199
	@echo Linking $@
200
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/ans2asc.o
deuce's avatar
deuce committed
201

202
# ASC2ANS
203
$(ASC2ANS): $(OBJODIR)/asc2ans.o
204
	@echo Linking $@
205
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(OBJODIR)/asc2ans.o
deuce's avatar
deuce committed
206
207
208
209

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
210
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
211
212
213
214
215
216

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

deuce's avatar
deuce committed
217
218
219
220
# SLOG
$(SLOG): $(SLOG_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SLOG_OBJS) $(XPDEV_LIBS)
221
222
223
224
225

# ALLUSERS
$(ALLUSERS): $(ALLUSERS_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ALLUSERS_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
226
227
228
229
230

# DELFILES
$(DELFILES): $(DELFILES_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DELFILES_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
231
232
233
234
235

# DUPEFIND
$(DUPEFIND): $(DUPEFIND_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DUPEFIND_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
236
237
238
239
240

# SMBACTIV
$(SMBACTIV): $(SMBACTIV_OBJS)
	@echo Linking $@
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
241
242
243
244
245

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