GNUmakefile 6.2 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
SRC_ROOT	=	..
include $(SRC_ROOT)/build/Common.gmake
18

19
20
UTIL_LDFLAGS	+=	$(SMBLIB_LDFLAGS) $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV_LDFLAGS)
UTIL_LIBS	+=	$(SMBLIB_LIBS)
deuce's avatar
deuce committed
21

22
ifndef bcc
deuce's avatar
deuce committed
23
24
25
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
26
27
endif

28
ifeq ($(os),sunos)    # Solaris
29
 LDFLAGS += -lsocket -lnsl -lrt
30
31
endif

32
# So far, only QNX has sem_timedwait()
33
ifeq ($(os),qnx)
34
 LDFLAGS += -lsocket
35
endif
36

37
38
39
40
ifdef PREFIX
 CFLAGS += -DPREFIX=$(PREFIX)
endif

41
42
43
44
ifdef USE_DOSEMU
 CFLAGS += -DUSE_DOSEMU
endif

45
ifdef DONT_BLAME_SYNCHRONET
46
 CFLAGS += -DDONT_BLAME_SYNCHRONET
deuce's avatar
deuce committed
47
endif
48

49
50
51
52
53
54
55
# JS and NSPR setup stuff...
CFLAGS += -DJAVASCRIPT
ifdef JSINCLUDE
 CFLAGS += -I$(JSINCLUDE)
else
 CFLAGS += -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)js
endif
56
57
58
ifdef NSPRINCLUDE
 CFLAGS += -I$(NSPRINCLUDE)
else
59
60
 # Use local NSPR first...
 CFLAGS += -I/usr/local/include -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)nspr
61
endif
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ifndef JSLIBDIR
 JSLIBDIR := $(SRC_ROOT)$(DIRSEP)..$(DIRSEP)lib$(DIRSEP)mozilla$(DIRSEP)js$(DIRSEP)$(machine).$(BUILD)
endif
ifndef JSLIB
 JSLIB	:=	js
endif
ifndef NSPRDIR
 NSPRDIR := $(SRC_ROOT)$(DIRSEP)..$(DIRSEP)lib$(DIRSEP)mozilla$(DIRSEP)nspr$(DIRSEP)$(machine).$(BUILD)
endif
JS_LDFLAGS += -L$(JSLIBDIR) -l$(JSLIB)
#The following is needed for nspr support on Linux
ifeq ($(os),linux)
 JS_LDFLAGS	+=	-ldl
endif
deuce's avatar
deuce committed
76
JS_LDFLAGS	+=	-L/usr/local/lib -L$(NSPRDIR) -lnspr4
77
78
79

CFLAGS	+=	$(JS_CFLAGS)
LDFLAGS	+=	$(JS_LDFLAGS)
80

81
include sbbsdefs.mk
82
MT_CFLAGS	+=	$(SBBSDEFS)
83

84
# Set up LD_RUN_PATH for run-time locating of the .so files
deuce's avatar
deuce committed
85
PWD	:=	$(shell pwd)
deuce's avatar
deuce committed
86
LD_RUN_PATH	:=	.:$(PWD)/$(LIBODIR):$(PWD)/$(JSLIBDIR):$(PWD)/$(NSPRDIR)
87
export LD_RUN_PATH
88

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

106
107
CFLAGS	+=	$(UIFC-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS)
LDFLAGS +=	$(UIFC-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CIOLIB-MT_LDFLAGS)
deuce's avatar
deuce committed
108

109
110
# Monolithic Synchronet executable Build Rule
$(SBBSMONO): $(MONO_OBJS) $(OBJS)
111
	@echo Linking $@
112
	$(QUIET)$(CXX) -o $@ $(LDFLAGS) $(MT_LDFLAGS) $(MONO_OBJS) $(OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
113
114

# Synchronet BBS library Link Rule
115
$(SBBS): $(OBJS) $(LIBS)
116
	@echo Linking $@
117
	$(QUIET)$(MKSHPPLIB) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(SHLIBOPTS)
118
119

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

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

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

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

# Synchronet Console Build Rule
140
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
141
	@echo Linking $@
142
	$(QUIET)$(CXX) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(CON_OBJS) $(CON_LIBS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
143
144

# Baja Utility
145
$(BAJA): $(BAJA_OBJS)
146
	@echo Linking $@
147
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(BAJA_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
148

149
# UnBaja Utility
deuce's avatar
deuce committed
150
$(UNBAJA): $(OBJODIR) $(EXEODIR) $(UNBAJA_OBJS)
151
	@echo Linking $@
152
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(UNBAJA_OBJS) $(XPDEV_LIBS)
153

154
# Node Utility
155
$(NODE): $(NODE_OBJS)
156
	@echo Linking $@
157
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(NODE_OBJS) $(XPDEV_LIBS)
158
159

# FIXSMB Utility
160
$(FIXSMB): $(FIXSMB_OBJS)
161
	@echo Linking $@
162
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FIXSMB_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
163
164

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

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

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

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

rswindell's avatar
rswindell committed
184
# ADDFILES
185
$(ADDFILES): $(ADDFILES_OBJS)
rswindell's avatar
rswindell committed
186
	@echo Linking $@
187
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(ADDFILES_OBJS) $(XPDEV_LIBS)
rswindell's avatar
rswindell committed
188

189
# FILELIST
190
$(FILELIST): $(FILELIST_OBJS)
191
	@echo Linking $@
192
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(FILELIST_OBJS) $(XPDEV_LIBS)
193

194
# MAKEUSER
195
$(MAKEUSER): $(MAKEUSER_OBJS)
196
	@echo Linking $@
197
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(MAKEUSER_OBJS) $(XPDEV_LIBS)
deuce's avatar
deuce committed
198

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

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

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

# SEXYZ
$(SEXYZ): $(SEXYZ_OBJS)
	@echo Linking $@
deuce's avatar
deuce committed
217
	$(QUIET)$(CC) $(LDFLAGS) $(MT_LDFLAGS) -o $@ $(SEXYZ_OBJS) $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
deuce's avatar
deuce committed
218
219
220
221
222
223

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

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