mux2.4/game/bin/
mux2.4/game/data/
mux2.4/src/tools/
# Makefile for TinyMUX 2.4
#
# Search for the text 'CONFIGURATION SECTION' and make any changes needed
# there.

SHELL=/bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
BIN = ../game/bin
CC = @CC@
CXX = @CXX@
#CXXCPP = @CXXCPP@	# This is broken in autoconf.  Sigh.
CXXCPP = $(CXX) -E
LIBS = @LIBS@

.SUFFIXES: .cpp

# After we finish beta testing, we'll take away the debugging -g flag.
# If you don't use GCC, don't use -g. Add -pg for profiling (gprof netmux
# gmon.out)
#
#OPTIM = -O
#OPTIM = -g -pg -O
OPTIM = -g -O

# By default, REALITY_LVLS is not enabled.  If you wish to use REALITY_LVLS,
# run configure with --enable-realitylvls.  Please read the docs/REALITY.
#
# NOTE: To ensure a clean build, please 'make clean' first.
#
REALITY_LVLS = @REALITY_LVLS@
REALITY_SRC = @REALITY_SRC@
REALITY_OBJ = @REALITY_OBJ@

# By default, WOD_REALMS is not enabled.  If you wish to use WOD_REALMS,
# run configure with --enable-wodrealms.  Please read the docs/REALMS.
#
# NOTE: To ensure a clean build, please 'make clean' first.
#
WOD_REALMS = @WOD_REALMS@

# Disk-based caching is the default.  If you wish to use memory-based, run
# configure with --enable-memorybased.  Disk-based usually uses less memory,
# but more disk space.  Memory-based usually uses more memory, less
# disk-space, and some gain in performance for a very narrow set of
# operations.
#
# NOTE: To ensure a clean build, please 'make clean' first.
#
MEMORY_BASED = @MEMORY_BASED@

# Query Slave. By default, this is off. This can be turned on by running
# configure with --enable-sqlquery. The Query Slave is how to support
# queries to foriegn data sources such as SQL servers.
#
QUERY_SLAVE = @QUERY_SLAVE@
QUERYLIBS   = -ldbi
SQLSLAVE    = @SQLSLAVE@

# Distribution source files
D_SRC	= _build.cpp alloc.cpp attrcache.cpp boolexp.cpp bsd.cpp command.cpp \
	comsys.cpp conf.cpp cque.cpp create.cpp db.cpp db_rw.cpp eval.cpp \
	file_c.cpp flags.cpp funceval.cpp functions.cpp funmath.cpp game.cpp \
	help.cpp htab.cpp local.cpp log.cpp look.cpp mail.cpp match.cpp \
	mguests.cpp move.cpp muxcli.cpp netcommon.cpp object.cpp \
	predicates.cpp player.cpp player_c.cpp powers.cpp quota.cpp rob.cpp \
	pcre.cpp set.cpp sha1.cpp speech.cpp sqlshared.cpp stringutil.cpp \
	strtod.cpp svdrand.cpp svdhash.cpp svdreport.cpp timer.cpp \
	timeutil.cpp unparse.cpp vattr.cpp walkdb.cpp wild.cpp wiz.cpp
D_OBJ	= _build.o alloc.o attrcache.o boolexp.o bsd.o command.o comsys.o \
	conf.o cque.o create.o db.o db_rw.o eval.o file_c.o flags.o \
	funceval.o functions.o funmath.o game.o help.o htab.o local.o log.o \
	look.o mail.o match.o mguests.o move.o muxcli.o netcommon.o object.o \
	predicates.o player.o player_c.o powers.o quota.o rob.o pcre.o set.o \
	sha1.o speech.o sqlshared.o stringutil.o strtod.o svdrand.o \
	svdhash.o svdreport.o timer.o timeutil.o unparse.o vattr.o walkdb.o \
	wild.o wiz.o

# Version number routine
VER_SRC	= version.cpp
VER_OBJ	= version.o
VER_FLG	= -DMUX_BUILD_DATE="\"`date`\"" \
	  -DMUX_BUILD_NUM="\"`sh ./buildnum.sh`\""

# ===================== CONFIGURATION SECTION ====================
#
# Select the correct C compiler.  Whatever you choose, it must be able
# to grok ANSI C (function prototypes)
#
#-----CC or GCC (must be able to grok function prototypes)
#
DEFS =
#
#-----CC on a NeXT system, really weird derivative of GCC
#
#DEFS = -DNEXT -DNEED_STRDUP
#
#-----GCC if the libraries were built for a pcc-derived cc compiler
#     (most systems)
#
#DEFS = -fpcc-struct-return -Wall
#
#-----GCC with GCC-compatible libraries if you want verbose error messages
#
#DEFS = -Wall
#
#-----HP-UX C compiler
#
#DEFS = -w +Obb800 -Aa -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE
#
#-----MIPS C compiler (also DEC 3xxx, Prime EXL7xxx)
#
#DEFS = -signed
#

# Libraries.  Use the second line if you want to use the resolver to get
# hostnames and your libc doesn't use it already.  If you use it, you'd
# better have your nameserver working or things may hang for a while when
# people try to login from distant sites.  Use the third line if you're running
# on a SysV-ish system and BSD support isn't built in to the standard libc.
#
MORELIBS	= -lm
#MORELIBS	= -lm -lnsl -lsocket -L/usr/ucblib -lucb	# Mips

# Select the networking support you have.  Currently only BSD networking
# is supported.
#
# ----- BSD networking
NET_S	= bsd.cpp
NET_O	= bsd.o

# ================== END OF CONFIGURATION SECTION =================

# Auxiliary source files: only used by offline utilities.
#
AUX_SRC	= unsplit.cpp
LIB_SRC = 
LIB_INC = 
ALLCXXFLAGS = $(CXXFLAGS) $(OPTIM) $(DEFS) $(COMPRESS_DEFS) $(BASED) $(MALLOC_DEFS) $(MOREDEFS) $(RLIM_F) $(MEMORY_BASED) $(WOD_REALMS) $(REALITY_LVLS) $(QUERY_SLAVE)

#Auxiliary files
A_INST	= README NOTES HIGHLIGHTS CREDITS CHANGES
A_TXT	= badsite.txt connect.txt create_reg.txt down.txt guest.txt help.txt \
	  motd.txt news.txt newuser.txt quit.txt register.txt wizhelp.txt \
	  wizmotd.txt full.txt plushelp.txt wiznews.txt
A_SH	= db_load db_unload db_check buildnum.sh
A_RT	= Startmux mux.config
A_CONF	= netmux.conf alias.conf compat.conf
A_MISC	= buildnum.data
A_VMS	= vms_dbm.cpp vms_dbm.h startmux.com compile.com link.com
A_AUTO	= configure configure.in autoconf.h.in Makefile.in .depend
AUXIL	= $(A_INST) $(A_TXT) $(A_SH) $(A_CONF) $(A_MISC) $(A_RT) $(A_VMS) \
	  $(A_AUTO)

# Compiliation source files.
#
ALLSRC	= $(D_SRC) $(REALITY_SRC) $(VER_SRC) $(AUX_SRC) $(LIB_SRC)
SRC	= $(D_SRC) $(REALITY_SRC) $(MALLOC_S)
OBJ	= $(D_OBJ) $(REALITY_OBJ) $(MALLOC_O)

.cpp.o:
	$(CXX) $(ALLCXXFLAGS) -c $<

all: netmux slave $(SQLSLAVE) links 

links: netmux slave $(SQLSLAVE)
	cd ../game/bin ; rm -f dbconvert ; ln -s ../../src/netmux dbconvert
	cd ../game/bin ; rm -f netmux ; ln -s ../../src/netmux netmux
	cd ../game/bin ; rm -f slave ; ln -s ../../src/slave slave
	( if [ -f sqlslave ]; then cd ../game/bin ; rm -f sqlslave; ln -s ../../src/sqlslave sqlslave ; fi )

sqlslave: sqlslave.o sqlshared.o
	$(CXX) $(ALLCXXFLAGS) $(LIBS) $(QUERYLIBS) -o sqlslave sqlslave.o sqlshared.o

slave: slave.o
	$(CXX) $(ALLCXXFLAGS) $(LIBS) -o slave slave.o

unsplit: unsplit.o
	$(CXX) $(ALLCXXFLAGS) -o unsplit unsplit.o

netmux: $(OBJ) $(VER_SRC)
	$(CXX) $(ALLCXXFLAGS) $(VER_FLG) -c $(VER_SRC)
	( if [ -f netmux ]; then mv -f netmux netmux~ ; fi )
	$(CXX) $(ALLCXXFLAGS) -o netmux $(OBJ) $(VER_OBJ) $(LIBS) $(MORELIBS)

depend: $(ALLSRC) unsplit
	for i in $(D_SRC) $(SA_SRC) $(AUX_SRC) $(LIB_SRC) $(MALLOC_S) slave.cpp sqlslave.cpp sqlshared.cpp ; do $(CXXCPP) $(ALLCXXFLAGS) -M $$i; done | sed -e 's:/usr[^ ]*[ ]*::g' | ./unsplit > .depend~
	mv .depend~ .depend

realclean:
	-rm -f *.o a.out core gmon.out mux.*log mux.*sum netmux netmux~

clean:
	-rm -f *.o a.out core gmon.out mux.*log mux.*sum slave sqlslave netmux

include .depend