Commit 9887f6f5 authored by deuce's avatar deuce
Browse files

Now creates shared object equivelent to the Windows versions .dll files.

these are used in the sbbs binary and the jsexec binary.

NOTE!!! You *must* copy the .so files from the gcc.*.lib.* build path into
either the same dir as sbbs will run from or into your LD_LIBRARY_PATH

The old monolithic version is now named sbbsmono

Stay tuned for separate BBS, FTP, WEB, MAIL, and SERVICES programs!
parent 336b74be
......@@ -54,9 +54,10 @@ endif
SLASH = /
OFILE = o
LIBFILE = .a
LIBFILE = .so
UIFC = ../uifc/
XPDEV = ../xpdev/
LIBPREFIX = lib
ifndef os
os := $(shell uname)
......@@ -86,7 +87,8 @@ CFLAGS += -DJAVASCRIPT -I../../include/mozilla/js -I$(XPDEV) -I$(UIFC)
ifdef BSD # BSD
# Math libraries needed and uses pthread
LFLAGS := -lm -pthread -lutil
LFLAGS := -lm -lutil -lc_r
CFLAGS += -pthread
else # Linux / Other UNIX
# Math and pthread libraries needed
ifdef bcc
......@@ -102,12 +104,12 @@ endif
ifeq ($(os),sunos) # Solaris
CFLAGS += -D_REENTRANT -D__solaris__ -DNEEDS_DAEMON -D_POSIX_PTHREAD_SEMANTICS -DNEEDS_FORKPTY
LFLAGS := -lm -lpthread -lsocket -lnsl -lrt
LFLAGS += -lm -lpthread -lsocket -lnsl -lrt
endif
ifeq ($(os),netbsd)
CFLAGS += -D_REENTRANT -D__unix__ -I/usr/pkg/include -DNEEDS_FORKPTY
LFLAGS := -lm -lpthread -L/usr/pkg/lib -L/usr/pkg/pthreads/lib
LFLAGS += -lm -lpthread -L/usr/pkg/lib -L/usr/pkg/pthreads/lib
endif
# So far, only QNX has sem_timedwait()
......@@ -165,11 +167,19 @@ ifeq ($(USE_XP_SEMAPHORES),1)
OBJS += $(LIBODIR)$(SLASH)xpsem.$(OFILE)
endif
SBBSLIB = $(LIBODIR)/sbbs.a
#SBBSLIB = $(LIBODIR)$(SLASH)libsbbs.so
SBBSLIB = -lsbbs
#dummy rule
$(SBBSLIB) : $(SBBS)
vpath %.c $(XPDEV) $(UIFC)
vpath %.cpp $(UIFC)
LFLAGS += -L./$(LIBODIR)
LDFLAGS := $(LFLAGS) -rpath-link ./$(LIBODIR) -rpath ./
LFLAGS += -Wl,-rpath-link,./$(LIBODIR),-rpath,./
# Implicit C Compile Rule for utils
$(EXEODIR)/%.o : %.c $(BUILD_DEPENDS)
ifndef bcc
......@@ -206,11 +216,12 @@ $(EXEODIR):
CON_OBJS = $(EXEODIR)/sbbscon.o $(EXEODIR)/conwrap.o \
$(EXEODIR)/sbbs_ini.o
CON_LDFLAGS = -lftpsrvr -lwebsrvr -lmailsrvr -lservices
FTP_OBJS = $(LIBODIR)/ftpsrvr.o
MAIL_OBJS = $(LIBODIR)/mailsrvr.o $(LIBODIR)/mxlookup.o \
$(LIBODIR)/mime.o $(LIBODIR)/base64.o
WEB_OBJS = $(LIBODIR)/websrvr.o $(LIBODIR)/sockwrap.o $(LIBODIR)/base64.o
SERVICE_OBJS= $(LIBODIR)/services.o
SERVICE_OBJS = $(LIBODIR)/services.o
MONO_OBJS = $(CON_OBJS) $(FTP_OBJS) $(WEB_OBJS) \
$(MAIL_OBJS) $(SERVICE_OBJS)
......@@ -231,25 +242,43 @@ $(SBBSMONO): $(MONO_OBJS) $(OBJS) $(LIBS)
FORCE$(SBBS): $(OBJS) $(LIBS)
$(SBBS): $(OBJS) $(LIBS)
$(LD) $(LFLAGS) -S -o $(SBBS) $^ $(LIBS) -o $@
@echo Linking $@
@$(LD) $(LDFLAGS) -S -o $(SBBS) $^ -shared -o $@
# FTP Server Link Rule
FORCE$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
$(FTPSRVR): $(LIBODIR)/ftpsrvr.o $(SBBSLIB)
$(LD) $(LFLAGS) -S $^ $(LIBS) -o $@
@echo Linking $@
$(LD) $(LDFLAGS) -S $^ $(LIBS) -shared -o $@
# Mail Server Link Rule
FORCE$(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
FORCE$(MAILSRVR): $(MAIL_OBJS) $(LIBODIR)$(SLASH)$(SBBSLIB)
$(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
$(LD) $(LFLAGS) -S $^ $(LIBS) -o $@
@echo Linking $@
@$(LD) $(LDFLAGS) -S $^ $(LIBS) -shared -o $@
# Mail Server Link Rule
FORCE$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)
$(WEBSRVR): $(WEB_OBJS) $(SBBSLIB)
@echo Linking $@
@$(LD) $(LDFLAGS) -S $^ $(LIBS) -shared -o $@
# Services Link Rule
FORCE$(SERVICES): $(WEB_OBJS) $(SBBSLIB)
$(SERVICES): $(SERVICE_OBJS) $(SBBSLIB)
@echo Linking $@
@$(LD) $(LDFLAGS) -S $^ $(LIBS) -shared -o $@
# Synchronet Console Build Rule
FORCE$(SBBSCON): $(CON_OBJS) $(SBBSLIB)
FORCE$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTP_OBJS) $(MAIL_OBJS) $(WEB_OBJS) $(SERVICE_OBJS)
$(SBBSCON): $(CON_OBJS) $(SBBSLIB)
@$(CC) $(CFLAGS) -o $@ $^
$(SBBSCON): $(CON_OBJS) $(SBBSLIB) $(FTPSRVR) $(WEBSRVR) $(MAILSRVR) $(SERVICES)
@echo Linking $@
@$(CC) $(CFLAGS) $(LFLAGS) $(CON_LDFLAGS) -o $@ $(CON_OBJS) $(SBBSLIB)
# Specifc Compile Rules
$(LIBODIR)/ftpsrvr.o: ftpsrvr.c ftpsrvr.h $(BUILD_DEPENDS)
......@@ -465,7 +494,7 @@ $(MAKEUSER): $(MAKEUSER_OBJS)
# JSEXEC
JSEXEC_OBJS = \
$(EXEODIR)/jsexec.o \
$(OBJS)
$(SBBSLIB)
FORCE$(JSEXEC): $(JSEXEC_OBJS)
......
......@@ -6,13 +6,13 @@
# LIBODIR, EXEODIR, SLASH, LIBFILE, EXEFILE, and DELETE must be pre-defined
SBBS = $(LIBODIR)$(SLASH)sbbs$(LIBFILE)
FTPSRVR = $(LIBODIR)$(SLASH)ftpsrvr$(LIBFILE)
WEBSRVR = $(LIBODIR)$(SLASH)websrvr$(LIBFILE)
MAILSRVR = $(LIBODIR)$(SLASH)mailsrvr$(LIBFILE)
SERVICES = $(LIBODIR)$(SLASH)services$(LIBFILE)
SBBSCON = $(EXEODIR)$(SLASH)sbbscon$(EXEFILE)
SBBSMONO = $(EXEODIR)$(SLASH)sbbs$(EXEFILE)
SBBS = $(LIBODIR)$(SLASH)$(LIBPREFIX)sbbs$(LIBFILE)
FTPSRVR = $(LIBODIR)$(SLASH)$(LIBPREFIX)ftpsrvr$(LIBFILE)
WEBSRVR = $(LIBODIR)$(SLASH)$(LIBPREFIX)websrvr$(LIBFILE)
MAILSRVR = $(LIBODIR)$(SLASH)$(LIBPREFIX)mailsrvr$(LIBFILE)
SERVICES = $(LIBODIR)$(SLASH)$(LIBPREFIX)services$(LIBFILE)
SBBSCON = $(EXEODIR)$(SLASH)sbbs$(EXEFILE)
SBBSMONO = $(EXEODIR)$(SLASH)sbbsmono$(EXEFILE)
JSEXEC = $(EXEODIR)$(SLASH)jsexec$(EXEFILE)
NODE = $(EXEODIR)$(SLASH)node$(EXEFILE)
BAJA = $(EXEODIR)$(SLASH)baja$(EXEFILE)
......@@ -34,7 +34,7 @@ UTILS = $(BUILD_DEPENDS)$(FIXSMB) $(BUILD_DEPENDS)$(CHKSMB) \
$(BUILD_DEPENDS)$(ANS2MSG) $(BUILD_DEPENDS)$(MSG2ANS) \
$(BUILD_DEPENDS)$(JSEXEC)
all: $(LIBODIR) $(EXEODIR) $(SBBSMONO) $(UTILS)
all: $(LIBODIR) $(EXEODIR) $(SBBSMONO) $(UTILS) $(SBBSCON)
utils: $(EXEODIR) $(UTILS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment