btmux-0.6-rc4/doc/
btmux-0.6-rc4/event/
btmux-0.6-rc4/game/
btmux-0.6-rc4/game/maps/
btmux-0.6-rc4/game/mechs/
btmux-0.6-rc4/game/text/help/
btmux-0.6-rc4/game/text/help/cat_faction/
btmux-0.6-rc4/game/text/help/cat_inform/
btmux-0.6-rc4/game/text/help/cat_misc/
btmux-0.6-rc4/game/text/help/cat_mux/
btmux-0.6-rc4/game/text/help/cat_mux/cat_commands/
btmux-0.6-rc4/game/text/help/cat_mux/cat_functions/
btmux-0.6-rc4/game/text/help/cat_templates/
btmux-0.6-rc4/game/text/wizhelp/
btmux-0.6-rc4/include/
btmux-0.6-rc4/misc/
btmux-0.6-rc4/python/
btmux-0.6-rc4/src/hcode/btech/
btmux-0.6-rc4/tree/
#!/usr/bin/make -f

CC             = @CC@
MAKEDEPEND     = @CC@ -MM
CFLAGS         = -Wall -Wno-unused --std=gnu99
CPPFLAGS	   = @CPPFLAGS@	
INCLUDES       = -Iinclude -Isrc -Isrc/hcode/include -Isrc/hcode/btech
LIBS           = @LIBS@
LDFLAGS		   = @LDFLAGS@

VERSION_FLAGS  = -DMUX_BUILD_DATE="\"`date`\""              \
                 -DMUX_BUILD_NUM="\"`sh src/buildnum.sh`\""
ifdef DEBUG
VERSION_FLAGS += -DSVN_REVISION="\"`svnversion .`\"" -DMUX_BUILD_USER="\"`whoami`\"" -DMUX_BUILD_HOST="\"`hostname -f`\""
CFLAGS 	      += -g3 -DDEBUG
OBJSUFFIX      = .debug
else
CFLAGS        += -g -O3
OBJSUFFIX      =
endif

BUILDFLAGS     = 

ALLFLAGS       = $(CFLAGS) $(INCLUDES) $(CPPFLAGS) $(LDFLAGS) $(BUILDFLAGS)

MISC_OBJECTS   = misc/myfifo.o

EVENT_OBJECTS  = event/event.o

TREE_OBJECTS   = tree/mux_tree.o \
                 tree/tree.o     \

MUX_OBJECTS    = src/boolexp.o     \
                 src/bsd.o         \
                 src/commac.o      \
                 src/command.o     \
                 src/compat.o      \
                 src/comsys.o      \
                 src/conf.o        \
                 src/cque.o        \
                 src/create.o      \
                 src/db.o          \
				 src/db_xml.o	   \
				 src/db_xdr.o	   \
                 src/db_rw.o       \
                 src/dllist.o      \
				 src/dnschild.o	   \
                 src/eval.o        \
                 src/file_c.o      \
                 src/flags.o       \
                 src/funceval.o    \
                 src/functions.o   \
                 src/game.o        \
                 src/help.o        \
                 src/log.o         \
@LOGCACHE@
                 src/look.o        \
                 src/macro.o       \
                 src/mail.o        \
                 src/match.o       \
                 src/mguests.o     \
                 src/move.o        \
				 src/mmdb.o		   \
				 src/nametab.o     \
                 src/netcommon.o   \
				 src/nrbtab.o      \
                 src/object.o      \
                 src/player.o      \
				 src/player_c.o    \
                 src/powers.o      \
                 src/predicates.o  \
                 src/python.o      \
				 src/rbtree.o	   \
                 src/rbtab.o	   \
				 src/rob.o         \
                 src/set.o         \
				 src/signal.o	   \
                 src/speech.o      \
@SQLCHILD@
                 src/stringutil.o  \
                 src/timer.o       \
                 src/unparse.o     \
                 src/vattr.o       \
                 src/walkdb.o      \
                 src/wild.o        \
                 src/wiz.o         \

HCODE_OBJECTS =  src/hcode/coolmenu.o        \
                 src/hcode/debug.o           \
                 src/hcode/events.o          \
                 src/hcode/glue.hcode.o      \
                 src/hcode/glue.o            \
                 src/hcode/glue.scode.o      \
                 src/hcode/mech.lostracer.o  \
                 src/hcode/mechfile.o        \
                 src/hcode/spath.o           \

BTECH_OBJECTS  = src/hcode/btech/aero.bomb.o                \
                 src/hcode/btech/aero.move.o                \
                 src/hcode/btech/artillery.o                \
                 src/hcode/btech/autopilot_ai.o             \
                 src/hcode/btech/autopilot_autogun.o        \
                 src/hcode/btech/autopilot_commands.o       \
                 src/hcode/btech/autopilot_core.o           \
                 src/hcode/btech/autopilot_radio.o          \
                 src/hcode/btech/bsuit.o                    \
                 src/hcode/btech/btech.o                    \
                 src/hcode/btech/btechstats.o               \
                 src/hcode/btech/btspath.o                  \
                 src/hcode/btech/crit.o                     \
                 src/hcode/btech/ds.bay.o                   \
                 src/hcode/btech/ds.turret.o                \
                 src/hcode/btech/econ.o                     \
                 src/hcode/btech/econ_cmds.o                \
                 src/hcode/btech/eject.o                    \
                 src/hcode/btech/failures.o                 \
                 src/hcode/btech/hudinfo.o                  \
                 src/hcode/btech/map.bits.o                 \
                 src/hcode/btech/map.coding.o               \
                 src/hcode/btech/map.conditions.o           \
                 src/hcode/btech/map.dynamic.o              \
                 src/hcode/btech/map.los.o                  \
                 src/hcode/btech/map.o                      \
                 src/hcode/btech/map.obj.o                  \
                 src/hcode/btech/mech.advanced.o            \
                 src/hcode/btech/mech.ammodump.o            \
                 src/hcode/btech/mech.avail.o               \
                 src/hcode/btech/mech.bth.o                 \
                 src/hcode/btech/mech.build.o               \
                 src/hcode/btech/mech.c3.misc.o             \
                 src/hcode/btech/mech.c3.o                  \
                 src/hcode/btech/mech.c3i.o                 \
                 src/hcode/btech/mech.combat.misc.o         \
                 src/hcode/btech/mech.combat.missile.o      \
                 src/hcode/btech/mech.combat.o              \
                 src/hcode/btech/mech.consistency.o         \
                 src/hcode/btech/mech.contacts.o            \
                 src/hcode/btech/mech.damage.o              \
                 src/hcode/btech/mech.ecm.o                 \
                 src/hcode/btech/mech.enhanced.criticals.o  \
                 src/hcode/btech/mech.events.o              \
                 src/hcode/btech/mech.fire.o                \
                 src/hcode/btech/mech.hitloc.o              \
                 src/hcode/btech/mech.ice.o                 \
                 src/hcode/btech/mech.lite.o                \
                 src/hcode/btech/mech.los.o                 \
                 src/hcode/btech/mech.maps.o                \
                 src/hcode/btech/mech.mechref_ident.o       \
                 src/hcode/btech/mech.move.o                \
                 src/hcode/btech/mech.notify.o              \
                 src/hcode/btech/mech.ood.o                 \
                 src/hcode/btech/mech.partnames.o           \
                 src/hcode/btech/mech.physical.o            \
                 src/hcode/btech/mech.pickup.o              \
                 src/hcode/btech/mech.restrict.o            \
                 src/hcode/btech/mech.scan.o                \
                 src/hcode/btech/mech.sensor.functions.o    \
                 src/hcode/btech/mech.sensor.o              \
                 src/hcode/btech/mech.spot.o                \
                 src/hcode/btech/mech.startup.o             \
                 src/hcode/btech/mech.stat.o                \
                 src/hcode/btech/mech.status.o              \
                 src/hcode/btech/mech.tag.o                 \
                 src/hcode/btech/mech.tech.commands.o       \
                 src/hcode/btech/mech.tech.damages.o        \
                 src/hcode/btech/mech.tech.do.o             \
                 src/hcode/btech/mech.tech.events.o         \
                 src/hcode/btech/mech.tech.o                \
                 src/hcode/btech/mech.tech.repairs.o        \
                 src/hcode/btech/mech.tech.saverepair.o     \
                 src/hcode/btech/mech.tic.o                 \
                 src/hcode/btech/mech.update.o              \
                 src/hcode/btech/mech.utils.o               \
                 src/hcode/btech/mechrep.o                  \
                 src/hcode/btech/mine.o                     \
                 src/hcode/btech/pcombat.o                  \
                 src/hcode/btech/template.o                 \

ALLOBJS = $(MISC_OBJECTS) $(EVENT_OBJECTS) $(TREE_OBJECTS) \
          $(MUX_OBJECTS) $(HCODE_OBJECTS) $(BTECH_OBJECTS)

ALLSRCS = $(ALLOBJS:.o=.c)

TARGETS = src/netmux$(OBJSUFFIX) src/mkindx$(OBJSUFFIX)

debug:
	@DEBUG=1 make all

install-debug:
	@DEBUG=1 make install

mudflap:
	$(CC) -g3 -DDEBUG -DSVN_REVISION="\"`svnversion .`\"" $(ALLFLAGS) $(VERSION_FLAGS) -fmudflap -o src/netmux.mudflap $(ALLSRCS) src/version.c $(LIBS) -lmudflap

release all: Makefile $(TARGETS)

Makefile: Makefile.dist configure.in Makefile.in
	make -f Makefile.dist clean
	exec make -f Makefile.dist

# Install copies the 'game' directory to game.run, after trying to get all
# files from svn. If the svn command fails, we don't really care.
install: $(TARGETS)
	if [ ! -d game ]; then \
            echo No game directory, attempting to download one from the Subversion repository.; \
            svn co http://svn.btmux.com/game/trunk game; \
            svn co http://svn.btmux.com/maps/trunk game/maps; \
            svn co http://svn.btmux.com/text/trunk game/text; \
            svn co http://svn.btmux.com/mechs/trunk game/mechs; \
        fi
	if [ ! -d game ]; then \
	    echo No game directory. Please acquire one from http://sourceforge.net/projects/btonline-btech.; \
	    exit 1; \
	fi
	if [ ! -d game.run ]; then \
	    cp -pPR game game.run || exit 1; \
	    chmod -R u+w game.run || exit 1; \
	fi
	if [ ! -d game.run/bin ]; then \
	    mkdir game.run/bin/; \
	fi
	mv -f $(TARGETS) game.run/bin/

update:
	svn update;

netmux$(OBJSUFFIX) src/netmux$(OBJSUFFIX): $(ALLOBJS:.o=$(OBJSUFFIX).o) src/version.c src/buildnum.sh
	$(CC) $(ALLFLAGS) $(VERSION_FLAGS) -c src/version.c -o src/version$(OBJSUFFIX).o
	$(CC) $(ALLFLAGS) -o src/netmux$(OBJSUFFIX) $(ALLOBJS:.o=$(OBJSUFFIX).o) src/version$(OBJSUFFIX).o $(LIBS)

clean:
	rm -f $(ALLOBJS) $(ALLOBJS:.o=.debug.o) src/version.debug.o src/version.o $(TARGETS) $(TARGETS:=.debug) .depend

cleandep: clean
	rm -f $(ALLOBJS:%.o=%.d)

distclean: clean cleandep
	make -f Makefile.dist clean

mkindx$(OBJSUFFIX) src/mkindx$(OBJSUFFIX): src/mkindx.c
	$(CC) $(ALLFLAGS) -o src/mkindx$(OBJSUFFIX) src/mkindx.c

dbconvert src/dbconvert:
	echo "dbconvert is no longer supported." && exit 1;

$(ALLSRCS:%.c=%.d): %.d: %.c
	$(CC) -MM -MF $@ -MT $(@:%.d=%$$\(OBJSUFFIX\).o) $(ALLFLAGS) $<

$(ALLOBJS:.o=$(OBJSUFFIX).o): %$(OBJSUFFIX).o: %.c
	$(CC) $(ALLFLAGS) -c $< -o $@

-include $(ALLSRCS:%.c=%.d)

.PHONY: clean protos