#################################################################
#
# Makefile for TinyMuck 1.2
#
#################################################################
# GCC:
CC=gcc
AR = ar
OPTIM= -g -O2 -pipe -Wall -W -Wno-parentheses -Wno-unused
LDFLAGS = -g
INCS = -I.
# The suffix appended to executables.
# This should be set for Cygwin and Windows.
EXE = .exe
#EXE =
#
# To log failed commands (HUH's) to stderr, include -DLOG_FAILED_COMMANDS
# To restricted object-creating commands to users with the BUILDER bit,
# include -DRESTRICTED_BUILDING
# To log all commands, include -DLOG_COMMANDS
# To force fork_and_dump() to use vfork() instead of fork(), include
# -DUSE_VFORK.
# To force grow_database() to be clever about its memory management,
# include -DDB_DOUBLING. Use this only if your realloc does not allocate
# in powers of 2 (if you already have a clever realloc, this option will
# only cost you extra space).
# By default, db.c initially allocates enough space for 10000 objects, then
# grows the space if needed. To change this value, include
# -DDB_INITIAL_SIZE=xxxx where xxxx is the new value (minimum 1).
# To include code for keeping track of the number of blocks allocated,
# include -DTEST_MALLOC.
# To include code which attempts to compress string data, include -DCOMPRESS.
# To eliminate the message third parties see when a player whispers, include
# -DQUIET_WHISPER.
# To include gender flags and pronoun substitution code,
# include -DGENDER.
# To allow players to claim ownership of objects using @chown,
# include -DPLAYER_CHOWN. This also adds the CHOWN_OK flag,
# to indicate whether an object is @chownable.
# To include teleport-to-player destinations for exits,
# include -DTELEPORT_TO_PLAYER.
# To make the ``examine'' command display full names for types and flags,
# use -DVERBOSE_EXAMINE
# To display "has connected" and "has disconnected" messages, use
# -DCONNECT_MESSAGES
# To allow players to set HAVEN flags, use -DHAVEN.
# To allow players to set ABODE flags, use -DABODE.
# To allow the game to dump core after PANIC dumps, use -DCOREDUMP.
# For the WHO list for wizards to show hostnames instead of addresses, use
# -DHOSTNAMES.
DEFS= -DGOD_PRIV -DGENDER -DVERBOSE_EXAMINE -DPLAYER_CHOWN \
-DQUIET_WHISPER -DCONNECT_MESSAGES -DTELEPORT_TO_PLAYER \
-DHAVEN -DABODE -DCOMPRESS -DRECYCLE -DCOREDUMP -DREGISTRATION \
-DDB_DOUBLING
LIBS= -Lrwho -lcrypt -lrwho
CFLAGS= $(OPTIM) $(DEFS) $(INCS)
# Everything except interface.c --- allows for multiple interfaces
CFILES= create.c game.c help.c look.c match.c move.c player.c predicates.c \
rob.c set.c speech.c stringutil.c utils.c wiz.c db.c boolexp.c \
unparse.c compress.c property.c hashtab.c os.c
OFILES = $(CFILES:.c=.o)
HFILES = config.h copyright.h db.h externs.h hashtab.h interface.h match.h os.h
AUX_FILES = CHANGES README restart minimal.db small.db muck.doc help.txt \
decompress.c interface.c sanity.c \
Makefile Makefile.bor \
CHANGELOG INSTALL_NOTES
RWHO_LIB = rwho/librwho.a
RWHO_FILES = rwho/clilib.c rwho/mudwho.c rwho/mwhod.c rwho/mwhocmd.c
RWHO_OFILES = $(RWHO_FILES:.c=.o)
RWHO_AUXFILES = rwho/HOW_TO rwho/README \
rwho/muds.dat rwho/rwhodoc rwho/rwhostart rwho/mwhod.doc
GAME_FILES = game/help.txt game/lockout.txt game/news.txt game/restart \
game/restart.bat
# Files in the standard distribution
# currently missing sanity-check.c extract.c dump.c
# I have replaced sanity-check.c with sanity.c -- it's my own version
DISTFILES= $(CFILES) $(HFILES) $(AUX_FILES) \
$(RWHO_FILES) $(RWHO_AUXFILES) $(GAME_FILES)
OBJDEPENDS = $(OFILES) $(RWHO_OFILES) decompress.o sanity.o interface.o
PDIST= $(patsubst %,tinymuck/%,$(DISTFILES))
RELEASE=dist
TARGETS= $(RWHO_LIB) netmuck$(EXE) decompress$(EXE) sanity$(EXE) \
mudwho$(EXE) mwhod$(EXE) mwhocmd$(EXE)
all: $(TARGETS)
netmuck$(EXE): interface.o $(OFILES)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
sanity$(EXE): sanity.o utils.o db.o compress.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
decompress$(EXE): decompress.o compress.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
mudwho$(EXE): rwho/mudwho.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
mwhod$(EXE): rwho/mwhod.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
mwhocmd$(EXE): rwho/mwhocmd.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
$(RWHO_LIB) : rwho/clilib.o
$(AR) rsc $@ $^
clean:
-rm -f a.out gmon.out $(TARGETS) $(OBJDEPENDS) $(OBJDEPENDS:.o=.d)
dist:
ln -s ./ tinymuck
tar czvf tinymuck-1.2-$(RELEASE).tar.gz $(PDIST)
rm tinymuck
# pull in dependency info for *existing* .o files
-include $(OBJDEPENDS:.o=.d)
# compile and generate dependency info;
# more complicated dependency computation, so all prereqs listed
# will also become command-less, prereq-less targets
# sed: append directory to object target. (gcc bug?)
# sed: strip the target (everything before colon)
# sed: remove any continuation backslashes
# fmt -1: list words one per line
# sed: strip leading spaces
# sed: add trailing colons
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
@$(CC) -MM $(CFLAGS) $*.c > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp