XCOMM Copyright (c) 1998 Joe Rumsey (mrogre@mediaone.net) */
XCOMM This software is covered by the GNU General Public License
XCOMM See the file COPYING for details

XCOMM =====================================================================
XCOMM Imakefile - Get Tanked v0.90 - mrogre@mediaone.net - April 11, 1998
XCOMM =====================================================================

XCOMM This is the only line you should have to change.  the high scores
XCOMM file will be written in this directory, change SCOREFILE to put
XCOMM it somewhere else or change the name.  The sounds directory and
XCOMM sound server executable also reside here if sound is supported on
XCOMM your system.  If not doing "make install", set this to where the
XCOMM files are now.

    TANKEDDIR = /home/ogre/tanked

    SOUNDDIR		= $(TANKEDDIR)/sounds

XCOMM sound?? I don't think I wrote sound support in yet, just ignore my
XCOMM obvious laziness in copying this from the XGalaga Imakefile :-)

XCOMM Should be defined automatically for appropriate systems
XCOMM define SOUND

XCOMM You should not have to change IMAGEDIR unless you rerun
XCOMM mkimgsrc and set it to not compile images in.  IE
XCOMM don't mess with this unless you know what it does.

    IMAGEDIR            = $(TANKEDDIR)/images

XCOMM You can get libXpm from ftp.x.org.  If it is already installed
XCOMM with the standard X libs, you shouldn't need to change this.
XCOMM otherwise make these point at wherever you put it.

    XPMLIB 		= -lXpm
    XPMINCLUDE 		= -I/usr/include/X11

    XSPRITELIB          = -L./libsprite -lXsprite

XCOMM use gcc if at all possible.  If you can't make sure you set this
XCOMM to an ANSI compiler!
    CC = gcc

XCOMM **** System specific preprocessor flags.  If yours isn't here,
XCOMM **** and you need something changed, tell me about it!

#if defined(LinuxArchitecture)
    SYSDEFS = -Wall
    SOUNDSERVER =
    SOUNDOBJS = 
    SOUNDDEV = /dev/dsp
#endif

#if defined(AIXArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(HPArchitecture)
    CC = gcc
    CDEBUGFLAGS = -O2
    CCOPTIONS = -ansi
    SYSDEFS = -DUSE_LRAND48  -ansi
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(SunArchitecture)
    SYSDEFS =
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(UltrixArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(SGIArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(FreeBSDArchitecture)
#define SOUND
SYSDEFS = 
SOUNDSERVER = tanked.sndsrv.freebsd
SOUNDOBJS = sound.o
SOUNDDEV = /dev/dsp
#endif

XCOMM ***********************************************************
XCOMM ---> You shouldn't need to change anything below this <----
XCOMM ***********************************************************

    EXTRA_INCLS = $(XPMINCLUDE) -I./libsprite -I../common

#ifndef SOUND
    DEFINES = $(EXTRA_INCLS) $(SYSDEFS)
#else
    INSTALLSOUND = True

    DEFINES = $(EXTRA_INCLS) $(SYSDEFS) -DSOUND \
	-DSOUNDSERVER=\"$(TANKEDDIR)/$(SOUNDSERVER)\" \
	-DSOUNDDIR=\"$(SOUNDDIR)\" \
	-DSOUNDDEV=\"$(SOUNDDEV)\"
#endif

    LOCAL_LIBRARIES = $(XSPRITELIB) $(XPMLIB) $(XLIB) -lm

    DEPLIBS = $(DEPXLIB) libsprite/libXsprite.a

    OBJS1 = main.o data.o images.o sintab.o socket.o message.o playerwin.o \
	motd.o redraw.o input.o outfit.o dash.o option.o defaults.o $(SOUNDOBJS)
    SRCS1 = `echo $(OBJS1) | sed -e 's/\.o/.c/g'`

    PROGRAMS = tanked

#define HasSubDirs YES
SUBDIRS       = libsprite
#define PassCDebugFlags "CC=$(CC)" "CDEBUGFLAGS=$(CDEBUGFLAGS)"
MakeSubdirs($(SUBDIRS))
MakefileSubdirs($(SUBDIRS))

ComplexProgramTarget_1($(PROGRAMS), $(LOCAL_LIBRARIES), )

#ifdef SOUND
NormalProgramTarget($(SOUNDSERVER), $(SOUNDSERVER).o,,,)
#endif

XCOMM libsprite/libXsprite.a:
XCOMM 	cd libsprite ; xmkmf ; make

install:: $(PROGRAMS) $(SOUNDSERVER)
	@echo "tanked directory is " $(TANKEDDIR)
	@:
	@echo "Creating directory " $(TANKEDDIR)
	@if [ ! -d $(TANKEDDIR) ]; then mkdir $(TANKEDDIR); fi
	@echo "Making an empty high score file"
	@touch $(SCOREFILE)
	@chmod a+rw $(SCOREFILE)
	@:
	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
	 then								\
		echo "Creating directory " $(SOUNDDIR); 		\
		if [ ! -d $(SOUNDDIR) ]; then mkdir $(SOUNDDIR); fi;    \
		echo "Copying sound server to directory " $(SOUNDDIR); \
		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(TANKEDDIR); \
		echo "Copying sound files into directory " $(SOUNDDIR); \
		cd ./sounds; set -x; for file in *.raw; do		\
		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
		done;   						\
	 fi

all:: $(SOUNDSERVER)

clean::
	cd libsprite ; make clean

dist:
	@make clean
	@rm -f $(EXE) TAGS core
	@makedepend
	@:
	cd .. ; tar czvf $(PROGRAMS).tar.gz $(PROGRAMS)/

proto:
	@cproto $(CDEFS) $(INCLUDEDIRS) $(SRCS) > proto.h

