GNUmakefile 5.7 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
# So far, only QNX has sem_timedwait()
34
ifeq ($(os),qnx)
35
 LDFLAGS += -lsocket
36
endif
37

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

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

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

50
51
52
53
54
55
56
# 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
57
58
59
ifdef NSPRINCLUDE
 CFLAGS += -I$(NSPRINCLUDE)
else
60
61
 # Use local NSPR first...
 CFLAGS += -I/usr/local/include -I$(SRC_ROOT)$(DIRSEP)..$(DIRSEP)include$(DIRSEP)mozilla$(DIRSEP)nspr
62
endif
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
77
JS_LDFLAGS	+=	-L/usr/local/lib -L$(NSPRDIR) -lnspr4
78
79
80

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

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

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

90
CON_LIBS	= -lsbbs -lftpsrvr -lwebsrvr -lmailsrvr -lservices
91
SHLIBOPTS	:=	-shared
deuce's avatar
deuce committed
92
ifeq ($(os),darwin)
deuce's avatar
deuce committed
93
94
95
 MKSHLIB		:=	libtool -dynamic -framework System -lcc_dynamic
 MKSHPPLIB		:=	libtool -dynamic -framework System -lcc_dynamic -lstdc++
 SHLIBOPTS	:=	
deuce's avatar
deuce committed
96
else
deuce's avatar
deuce committed
97
98
99
100
101
102
103
104
 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
105
endif
106

107
108
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
109

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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