GNUmakefile 7.01 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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