GNUmakefile 5.35 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
26
 LDFLAGS	+=	-lm
 ifneq ($(os),sunos)
  LDFLAGS	+=	-lutil
 endif
27
28
endif

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

33
ifeq ($(os),netbsd)
34
35
 LDFLAGS += -L/usr/pkg/lib
 UTIL_LDFLAGS	+=	-lpth -L/usr/pkg/lib
deuce's avatar
deuce committed
36
37
endif

38
# So far, only QNX has sem_timedwait()
39
ifeq ($(os),qnx)
40
 LDFLAGS += -lsocket
41
endif
42

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

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

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

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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
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
JS_LDFLAGS	+=	-L$(NSPRDIR) -lnspr4

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

81
82
include sbbsdefs.mk
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
98
99
100
101
102
103
 ifeq ($(os),sunos)
  MKSHLIB		:=	/usr/ccs/bin/ld -G
  MKSHPPLIB		:=	/usr/ccs/bin/ld -G -L/usr/local/lib -lstdc++
  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) $^ $(SMBLIB_LIBS) $(XPDEV-MT_LIBS)
113
114

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

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

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

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

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

# Synchronet Console Build Rule
140
$(SBBSCON): $(CON_OBJS) $(SBBS) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
141
	@echo Linking $@
142
	$(QUIET)$(CC) $(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 $@ $^ $(SMBLIB_LIBS) $(XPDEV_LIBS)
148
149

# Node Utility
150
$(NODE): $(NODE_OBJS)
151
	@echo Linking $@
152
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(XPDEV_LIBS)
153
154

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

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

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

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

rswindell's avatar
rswindell committed
174
# SBBSecho Configuration Program
175
$(ECHOCFG): $(ECHOCFG_OBJS)
rswindell's avatar
rswindell committed
176
	@echo Linking $@
177
	$(QUIET)$(CC) $(UTIL_LDFLAGS) $(MT_LDFLAGS) -o $@ $^ $(UIFC-MT_LDFLAGS) $(SMBLIB_LIBS) $(UIFC-MT_LIBS) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
rswindell's avatar
rswindell committed
178

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

184
# FILELIST
185
$(FILELIST): $(FILELIST_OBJS)
186
	@echo Linking $@
187
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^ $(XPDEV_LIBS)
188

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

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

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

204
# ASC2ANS
205
$(ASC2ANS): $(OBJODIR)/asc2ans.o
206
	@echo Linking $@
207
	$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $^