/
wizshell/
wizshell/binsrc/
wizshell/binsrc/elvis-1.7/doc/
wizshell/docs/help/
wizshell/etc/
wizshell/src/util/
#
#  Things you must change:
#  These two paths determine the rest of the paths used by the makefile
#
# The root directory for the accounts
# (The directory that they should get if they type 'cd /')
# (If its a mud, this is the mud root)
#
#ROOT_DIR=/usr/d/dave/mud/lib
ROOT_DIR=/usr/muds/realms

# This directory contains the etc/ dir and the bin/ dir
# Put this outside ROOT_DIR for security reasons (usually .. from here)
#
#WSH_DIR=/usr/d/dave/mud/wsh
WSH_DIR=/usr/home/beowolf/wsh

# for the boot script
#
PORT=6669

# you shouldn't need to change these five unless you don't want them in wsh/
#
BIN_DIR=$(WSH_DIR)/bin
PASSWD_FILE=$(WSH_DIR)/etc/passwd
WRITE_ACC_FILE=$(WSH_DIR)/etc/write_access
READ_ACC_FILE=$(WSH_DIR)/etc/read_access
EXCEPTIONS_FILE=$(WSH_DIR)/etc/exceptions
UTMP_FILE=$(WSH_DIR)/etc/utmp
WTMP_FILE=$(WSH_DIR)/etc/wtmp

# for ~name paths
#
HOME_DIR=/usr/muds/realms/Coders

# for shell escapes and new logins
#
WSH_FNAME=$(BIN_DIR)/wsh

# Memory allocation routines
# Sometimes the system malloc can have serious problems with mallocing
# lots of small chunks.  To avoid this, I use Sam Lantinga's (again!) memory
# wrapper - if you don't want to use it, just pick NOWRAP
#
MEMORY=MEMWRAP
#MEMORY=NOWRAP

# Utilities
# If you don't want all these utilities, then delete some.
# Also look in binsrc/ (particularly fget and help2)
#
#UTILS = util/mkpasswd util/passwd util/help util/boot util/last
UTILS = util/mkpasswd util/passwd util/last

#pick a compiler:
#
# Gnu C Compiler.  Good if you have it.  Most likely to work.
CC=gcc
#
# UNIX Distribution compiler.  See CFLAGS if you use cc
#CC=cc

#
# Put flags here  -- should always include $(DEFINES)
#
# DEFAULT:  no options - just defines
CFLAGS = $(DEFINES)
#
# DEBUGGER options
#CFLAGS = -g $(DEFINES)
#
# if using cc, do ansi and some other things
#CFLAGS = -Aa $(DEFINES) -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_AES_SOURCE                                   -D_INCLUDE_XOPEN_SOURCE

############################################################################
# You probably shouldn't need to touch anything below here                 #
############################################################################

DEFINES = -DROOT_DIR='"$(ROOT_DIR)"' -DWSH_DIR='"$(WSH_DIR)"' -D$(MEMORY)

# The old way.  Ignore this.
#DEFINES = -DROOT_DIR='"$(ROOT_DIR)"' -DWSH_DIR='"$(WSH_DIR)"' -DBIN_DIR='"$(BIN_DIR)"' -DPASSWD_FILE='"$(PASSWD_FILE)"' -DWRITE_ACC_FILE='"$(WRITE_ACC_FILE)"' -DREAD_ACC_FILE='"$(READ_ACC_FILE)"' -DEXCEPTIONS_FILE='"$(EXCEPTIONS_FILE)"' -DUTMP_FILE='"$(UTMP_FILE)"' -DWTMP_FILE='"$(WTMP_FILE)"' -DCHAT_FILE='"$(CHAT_FILE)"' -DHOME_DIR='"$(HOME_DIR)"' -DWSH_FNAME='"$(WSH_FNAME)"' -D$(MEMORY)
# The old way.  Ignore this.

SOURCE = wizshell.c login.c access.c catch.c mem.c uwtmp.c comm.c putenv.c
OBJS = $(SOURCE:.c=.o)
INCLUDES = wizshell.h config.h Makefile

all:	wsh $(UTILS)

wsh:	$(OBJS) $(INCLUDES)
	@echo "Building wsh with $(CC)"
	@$(CC) $(CFLAGS) -o $@ $(OBJS)

util/boot: Makefile
	@echo "Making file: util/boot (shell script)"
	@echo "#!/bin/csh" > util/boot
	@echo "" >> util/boot
	@echo "# This is just an autoboot program for the WizPort" >> util/boot
	@echo "# Put this in the top of the restart_mud script" >> util/boot
	@echo "# This file is created by 'make'" >> util/boot
	@echo "# If this doesn't work (on Linux in particular), try:">>util/boot
	@echo "#$(WSH_DIR)/tcpserv -t $(PORT) -- $(BIN_DIR)/wsh -l &">>util/boot
	@echo "" >> util/boot
	@echo "$(WSH_DIR)/tcpserv -t $(PORT) $(BIN_DIR)/wsh -l &" >> util/boot
	@chmod u+x util/boot
#	rm -f *.o

$(OBJS): $(INCLUDES)

.c.o:
	@echo "Building $@ with $(CC)"
	@$(CC) $(CFLAGS) -c $<

util/help: util/help.c
	@echo "Building util/help with $(CC)"
	@$(CC) $(CFLAGS) util/help.c -o util/help -DHELP_DIR='"$(HELP_DIR)"' -DMORE='"$(MORE)"' -DDEFAULT_HELP='"$(DEFAULT_HELP)"'
	@strip util/help

util/help2: util/help2.c
	@echo "Building util/help2 with $(CC)"
	@$(CC) $(CFLAGS) util/help2.c mem.c -o util/help2 -DHELP_DIR='"$(HELP_DIR)"' -DMORE='"$(MORE)"' -DDEFAULT_HELP='"$(DEFAULT_HELP)"'
	@strip util/help2

util/passwd: util/passwd.c
	@echo "Building util/passwd with $(CC)"
	@$(CC) $(CFLAGS) util/passwd.c -o util/passwd -DPASSWD_FILE='"$(PASSWD_FILE)"'
	@strip util/passwd

util/who: util/who.c
	@echo "Building util/who with $(CC)"
	@$(CC) $(CFLAGS) util/who.c -o util/who mem.o
	@strip util/who

util/last: Makefile
	@echo "Making file: util/last (shell script)"
	@echo "#!/bin/csh" > util/last
	@echo "" >> util/last
	@echo "# This is the last command for the WizPort" >> util/last
	@echo "# This simply cats out the etc/wtmp file" >> util/last
	@echo "# This file is created by 'make'" >> util/last
	@echo "" >> util/last
	@echo "if ( $1 == \"|\" && ( $2 == \"more\" || $2 == \"less\" ) ) then" >> util/last
	@echo "  $(BIN_DIR)/less $(WTMP_FILE)" >> util/last
	@echo "else" >> util/last
	@echo "  cat $(WTMP_FILE)" >> util/last
	@echo "endif" >> util/last
	@chmod u+x util/last

util/mkpasswd: util/mkpasswd.c
	@echo "Building util/mkpasswd with $(CC)"
	@$(CC) $(CFLAGS) util/mkpasswd.c -o util/mkpasswd
	@strip util/mkpasswd

clean:
	rm -f *.o core $(UTILS)