/**/#
/**/# Imakefile for ./Src - part of the PIX X-Tank distribution
/**/#
/**/# $Author: lidl $
/**/# $Id: Imakefile,v 1.1.1.1 1995/02/01 00:25:33 lidl Exp $
/**/#

#include "../Imakefile.Config"

             SRCS = actions.c animate.c box.c camo.c \
                    collision.c cosell.c disc.c display.c escher.c \
                    explosion.c file.c game.c gr.c highlib.c \
                    hit.c hud.c icounter.c init.c input.c interface.c \
                    intersect.c lowlib.c main.c malloc.c mapper.c maze.c \
                    mdesign.c menu.c message.c newconsole.c \
                    newradar.c program.c radar.c repair.c scroll.c setup.c \
                    setups.c status.c sysdep.c unix.c update.c \
                    util.c vdesign.c vehicle.c players.c newfile.c vload.c \
                    version.c $(ARCH_SRCS) $(SUPP_SRCS)
        SUPP_SRCS = $(SOUND_SRCS)
             OBJS = actions.o animate.o box.o camo.o \
                    collision.o cosell.o disc.o display.o escher.o \
                    explosion.o file.o game.o gr.o highlib.o \
                    hit.o hud.o icounter.o init.o input.o interface.o \
                    intersect.o lowlib.o main.o malloc.o mapper.o maze.o \
                    mdesign.o menu.o message.o newconsole.o \
                    newradar.o program.o radar.o repair.o scroll.o setup.o \
                    setups.o status.o sysdep.o unix.o update.o \
                    util.o vdesign.o vehicle.o players.o newfile.o vload.o \
                    version.o $(ARCH_OBJS) $(SUPP_OBJS)
        SUPP_OBJS = $(SOUND_OBJS)
             INCL = Include/bullet.h Include/common.h Include/cosell.h \
                    Include/disc.h Include/game.h Include/globals.h \
                    Include/gr.h Include/graphics.h Include/icounter.h \
                    Include/interface.h Include/loc.h Include/lowlib.h \
                    Include/malloc.h Include/map.h Include/maze.h \
                    Include/mdesign.h Include/menu.h Include/message.h \
                    Include/object.h Include/outpost.h Include/program.h \
                    Include/screen.h Include/scroll.h Include/settings.h \
                    Include/setup.h Include/special-defs.h \
                    Include/special.h Include/sysdep.h Include/tanklimits.h \
                    Include/tanktypes.h Include/team.h Include/terminal.h \
                    Include/thread.h Include/tread-defs.h Include/vdesc.h \
                    Include/vehicle.h Include/vehicleparts.h \
                    Include/vstructs.h Include/weapon-defs.h \
                    Include/xtank.h Include/xtanklib.h \
                    $(ARCH_INCS) $(SUPP_INCS)
        SUPP_INCS = $(SOUND_INCS)
            XINCL = Include/x11.h

/**/# Note that both x11.c and mazeconv.c are included in other .c files,
/**/# so they are not listed above!

#if defined(HAVE_SOUND)
       SOUND_SRCS = sload.c sound.c
       SOUND_OBJS = sload.o sound.o
       SOUND_INCS = Include/sound.h
#endif

/**/# Important things that Xtank wants to find and link with, for
/**/# all supported architechtures

          DEPLIBS = $(DEPXLIB) ./Display/libxtankdisplay.a \
                    ./Threads/libxtankthreads.a \
                    ./Programs/libxtankrobots.a
  LOCAL_LIBRARIES = -LDisplay -lxtankdisplay -LThreads -lxtankthreads \
                    -LPrograms -lxtankrobots $(XLIB)

/**/# We might have some extra support libraries that need to be
/**/# linked into the file version, we will round all these up
/**/# into EXTRA_SUPP_LIBRARIES

   EXTRA_SUPP_INC = $(SOUND_INCLUDES)
   EXTRA_SUPP_LIB = $(SOUND_LIBRARY)

   EXTRA_INCLUDES = -I. -IInclude $(EXTRA_SUPP_INC)
  EXTRA_LIBRARIES = $(EXTRA_SUPP_LIB) -lm

/**/# Start of System Dependent Things
/**/# (e.g. libraries, linker flags and so forth)

#ifdef i860Architecture
    SYS_LIBRARIES = -lnsl
        ARCH_SRCS = floor.c
        ARCH_OBJS = floor.o
#endif

#ifdef AlphaArchitecture
    SYS_LIBRARIES = -lc_r -lpthreads -lmach -ldnet_stub
#endif

#ifdef ApolloArchitecture
    SYS_LIBRARIES = -L/usr/X11/lib
#endif

/* Stupid fucking changes between BSDI v1.0 and v1.1 cause needless */
/* pain and suffering for those that wish to support both! */

/* We only need -ll on BSDi v1.1, but so help me god, I am just */
/* furious that the only way of figuring out what version of the OS */
/* is running is truely stupid.  It was 1.0 for the bsdi v1.0 release */
/* and the Xfree folks conveinently made it 4.3 for the 1.1 release. */

/* They all deserve to lose massively for not making the major/minor */
/* OS release numbers for 1.1 what they should be.  Since they are */
/* determined to lose, I made this file fail if the system isn't either */
/* 1.0 (figured out correctly) or 4.3 (==1.1), so someone will have to */
/* examine this once the first post-1.1 systems arrive. */

#ifdef i386BsdArchitecture
#if (OSMajorVersion == 4) && (OSMinorVersion == 3)
	/* duh, this is really bsdi v1.1 */
     SYS_LIBRARIES =
#endif
#if (OSMajorVersion == 1) && (OSMinorVersion == 0)
	/* duh, this is really bsdi v1.0 */
	/* nothing special to do for bsdi v1.0 */
     SYS_LIBRARIES =
#endif
#endif

#ifdef HPArchitecture
    SYS_LIBRARIES = -lBSD -lmalloc
# ifdef hp9000s800
        ARCH_SRCS = flush_hp9k8.s
        ARCH_OBJS = flush_hp9k8.o
# endif
#endif
#ifdef MultimaxArchitecture
        CCOPTIONS = -g -O -q nosb -q ext=parallel
#endif
#if defined(RiscArchitecture) || defined(RsArchitecture)
/**/#
/**/# Which is real?  I don't know... X11R5 says the latter...
/**/#
        ARCH_SRCS = rs6klongjmp.s
        ARCH_OBJS = rs6klongjmp.o
 EXTRA_LOAD_FLAGS = -lbsd
#endif
#ifdef RtArchitecture
/**/# IBM RT
#endif
#ifdef SGIArchitecture
    SYS_LIBRARIES = -lm43 -lbsd -lsun
#endif
#ifdef SunArchitecture
    SYS_LIBRARIES = /usr/lib/debug/malloc.o -llwp
#if defined(HasGcc) || defined(FORCE_GCC)
        CCOPTIONS = -static $(EXTRA_CCOPTS)
#else
        CCOPTIONS = -Bstatic /usr/lib/libm.il $(EXTRA_CCOPTS)
#endif
#ifdef SparcArchitecture
/**/# Sun4 only options go here
#else
/**/# Sun3 only options go here
#endif
#endif
#ifdef UltrixArchitecture
#ifdef MipsArchitecture
# You might need to uncomment the following lines, depending on your
# system, and it's configuration, and your compiler.
#
#           SYS_LIBRARIES = -ldnet
#           CCOPTIONS = -Wl,-D,1000000
#           STD_INCLUDES = $(EXTRA_INCLUDES) -I/usr/include/mit
        ARCH_SRCS = mipssj.s
        ARCH_OBJS = mipssj.o
#endif
#endif
#ifdef VaxArchitecture
        ARCH_SRCS = vaxsj.s
        ARCH_OBJS = vaxsj.o
#endif

/**/# End of System Dependent Things

#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
#undef PassCDebugFlags
#define PassCDebugFlags
#define PassDefines 'DEFINES=$(DEFINES)'

MakeSubdirs($(SUBDIRS))

all::
	$(RM) version.c

ComplexProgramTarget($(XTANK_TARGET))

InstallManPageLong(Xtank,$(MANDIR),Xtank)

ExtraSpecialObjectRule(init.o, init.c, -g)

          SUBDIRS = Threads Display Programs
          DependSubdirs($(SUBDIRS))

setups.c: setups.l
	$(FLEX) -t setups.l > $@
	@-chmod 664 $@ 2>/dev/null

sload.c: sload.l
	$(FLEX) -t sload.l | sed 's/yy/ss/g'-e 's/sswrap/yywrap/g' > $@
	@-chmod 664 $@ 2>/dev/null

vload.c: vload.l
	$(FLEX) -t vload.l | sed -e 's/yy/zz/g' -e 's/zzwrap/yywrap/g' > $@
	@-chmod 664 $@ 2>/dev/null

version.c:
	@echo -n "Updating version number..."
	@../Bin/newversion.sh $(XTANK_TARGET)
	@echo " Done."

copyout:
	co $(SRCS) $(INCL)

all::
	@-chgrp xtank $(XTANK_TARGET) .version setups.c vload.c *.o 2>/dev/null
	@-chmod 664 .version setups.c vload.c *.o 2>/dev/null

/**/#prof:
/**/#	$(COMPILE.c) -O -pg $(SRCS)
/**/#	$(LINK.c) -O -pg -o xtank.sun4.prof $(OBJS) $(LIBSUN)

/**/#lint: $(SRCS)
/**/#	$(LINT.c) $(SRCS) | grep -v "possible pointer alignment problem"

print:
	enscript -2rG Makefile $(INCL) $(SRCS) x11.c

TAGS: $(INCL) $(SRCS) $(XINCL) $(XSRCS) x11.c
	etags -t $(INCL) $(XINCL) $(SRCS) $(XSRCS) x11.c
