# SMUG (TinyMUD 2.4.0) makefile
.AUTODEPEND
BCCROOT = $(MAKEDIR)\..
CC = $(BCCROOT)\bin\bcc32
LD = $(BCCROOT)\bin\ilink32
AR = $(BCCROOT)\bin\tlib
YACC = yacc
YFLAGS= -v
WINZIP = C:\apps\Winzip\wzzip
# The suffix appended to executables.
# This should be set for Cygwin and Windows.
EXE = .exe
#EXE =
# Compiler directives for debugging
!ifdef DEBUG
DEBUG_CFLAGS = -v -y -Od -r-
DEBUG_LFLAGS = -v
!else
DEBUG_CFLAGS = -v- -O2 -$(PROCESSOR_LEVEL)
DEBUG_LFLAGS = -v-
!endif
INCDIRS = -I$(BCCROOT)\include
# Compiler/linker directives for linking static or dynamic
!ifdef STATIC
STATIC_CFLAGS =
LIBS = import32.lib cw32mt.lib ws2_32.lib
!else
STATIC_CFLAGS = -tWR
LIBS = import32.lib cw32mti.lib ws2_32.lib
!endif
BCC32STARTUP = c0x32.obj
MSGS= -w -w-pia -w-par -w-sig -w-use -w-pin
DEFS= -DNOISY_GC -DLOG_COMMANDS -DDUMP_CORE -DWIN32 -DWIN32_LEAN_AND_MEAN -D_NO_VCL
CFLAGS= $(STATIC_CFLAGS) $(DEBUG_CFLAGS) -tWM -tWC $(MSGS) $(DEFS)
LFLAGS = -Tpe -ap -c -Gn $(DEBUG_LFLAGS)
HDR = alist.h bytecode.h config.h db.h externs.h globals.h interface.h \
os.h set.h
XTRA = language.pdf language.tex language.txt reserved.txt caveats.txt \
INSTALL_NOTES COPYING TODO load.sh load.cmd init.db loadup.txt tiny.m4 \
Makefile makefile.bor makefile.vc
# Files needed to run the database
DBSRC = db.c alist.c set.c utils.c vars.c predicates.c os.c
DBOBJ = $(DBSRC:.c=.obj)
# Files needed to run the interpreter
INTERSRC = move.c tell.c create.c syscall.c encrypt.c bytecode.c \
compiler.y match.c delay.c
INTEROBJ = move.obj tell.obj create.obj syscall.obj encrypt.obj \
bytecode.obj compiler.obj match.obj delay.obj
# Files needed to run the parser
PARSESRC = command.c
PARSEOBJ = $(PARSESRC:.c=.obj)
# Files needed to run the game (everything except the driver)
GAMESRC = game.c
GAMEOBJ = $(GAMESRC:.c=.obj)
# Files needed to run the network version
NETSRC = netdriver.c
NETOBJ = $(NETSRC:.c=.obj)
# Files needed to run the tty version
TTYSRC = ttydriver.c
TTYOBJ = $(TTYSRC:.c=.obj)
# Files needed for the loader utility
LDRSRC = loader.c
LDROBJ = $(LDRSRC:.c=.obj)
# Files needed for the massager utility
MSRC = massager.c
MOBJ = $(MSRC:.c=.obj)
# Files needed for the runtest program
RTSRC = runtest.c
RTOBJ = $(RTSRC:.c=.obj)
# Files needed for the comptest program
CTSRC = comptest.c
CTOBJ = $(CTSRC:.c=.obj)
OUTFILES= y.tab.h test.db y.output compiler.c
# Files in the standard distribution
DISTFILES = $(HDR) $(XTRA) $(DBSRC) $(INTERSRC) $(PARSESRC) $(GAMESRC) \
$(NETSRC) $(TTYSRC) $(LDRSRC) $(MSRC) $(RTSRC) $(CTSRC)
!ifndef RELEASE
RELEASE = dist
!endif
# Dependency information
OBJDEPENDS = $(DBOBJ) $(INTEROBJ) $(PARSEOBJ) $(GAMEOBJ) $(NETOBJ) \
$(TTYOBJ) $(LDROBJ) $(MOBJ) $(RTOBJ) $(CTOBJ)
TARGETS = netmud$(EXE) ttymud$(EXE) loader$(EXE) test.db \
massager$(EXE) runtest$(EXE) comptest$(EXE)
all: $(TARGETS)
netmud$(EXE) : $(NETOBJ) $(GAMEOBJ) $(DBOBJ) $(INTEROBJ) $(PARSEOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
ttymud$(EXE) : $(TTYOBJ) $(GAMEOBJ) $(DBOBJ) $(INTEROBJ) $(PARSEOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
loader$(EXE) : $(LDROBJ) $(DBOBJ) $(INTEROBJ) $(PARSEOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
# builds the test database
test.db: init.db loadup.txt tiny.m4 loader$(EXE)
load.cmd init.db test.db < loadup.txt
# build parser
compiler.c y.tab.h : compiler.y
$(YACC) $(YFLAGS) compiler.y
move y.tab.c compiler.c
# utilities and test programs
massager$(EXE) : $(MOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
runtest$(EXE) : $(RTOBJ) $(DBOBJ) $(INTEROBJ) $(PARSEOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
comptest$(EXE) : $(CTOBJ) compiler.obj $(DBOBJ)
$(LD) $(LFLAGS) $(BCC32STARTUP) $**, $<,, $(LIBS)
clean :
@echo "Cleaning..."
@-del *.tds *.map *.TR2 $(OUTFILES) $(TARGETS) $(OBJDEPENDS) 2>NUL
@echo "Done."
dist : $(DISTFILES)
@echo "Building distribution..."
@md smug
@© /y $** smug 1>NUL
@$(WINZIP) -Pr smug-$(RELEASE).zip smug 1>NUL 2>NUL
@rd /s /q smug
@echo "Done."
.c.obj:
$(CC) $(CFLAGS) $(INCDIRS) -c -n$(@D) $<