/**/#
/**/# $Header:$
/**/#
/**/# Imakefile for for okbridge
/**/# anonymous ("inspired" by tcsh's imakefile by Marc Horowitz)
/**/#

#ifdef DestDir
#undef DestDir
#endif
#ifdef ManSuffix
#undef ManSuffix
#endif

/* All config options go in a separate file. */

#include "imake.config"

/* Machine flags here */
#ifdef HPArchitecture
MACHINE_FLAGS = -DHPUX
#endif

#ifdef IBMArchitecture
# if (SystemV == YES)
MACHINE_FLAGS = -DAIX
# endif
#endif

#if defined(SunArchitecture) && defined(UseSunSys5Curses)
MACHINE_FLAGS = -DSUNOS
# ifdef MyCC
# undef MyCC
# endif
#define MyCC /usr/5bin/cc
#endif

#ifdef NeedStrcasecmp
STRCASECMP = -DNO_STRCASECMP
#else
# if defined(VaxArchitecture) || defined(UltrixArchitecture) \
  || defined(SunArchitecture) || defined(NeXTArchitecture) \
  || defined(HPArchitecture) || defined(IBMArchitecture) \
  || defined(MipsBsdArchitecture) || defined(MipsSysvArchitecture)
STRCASECMP =
# else
STRCASECMP = -DNO_STRCASECMP
# endif
#endif

#ifdef NeedTmZone
TIMEZONE = -DNO_TM_ZONE
#else
TIMEZONE =
#endif

#ifdef BrokenGecos
PWCOMMENT = -DNO_PWCOMMENT
#else
# if defined(HPArchitecture)
PWCOMMENT = -DNO_PWCOMMENT
# else
PWCOMMENT =
# endif
#endif

#ifndef MyLDflags
LOCAL_LDFLAGS= MyLDflags
#endif

#ifdef MyLibs
EXTRA_LIBRARIES = MyLibs
#endif

#ifdef MyCC
CC = MyCC
#endif

#ifdef MyCDebugFlags
CDEBUGFLAGS = MyCDebugFlags
#endif

#ifndef MyCflags
#define MyCflags
#endif

#ifndef MyDefines
#define MyDefines
#endif

OKBRIDGE_HELPFILE=OKLibDir/okbridge.help
OKBRIDGE_NEWSFILE=OKLibDir/okbridge.news

DEFINES = MyDefines MyCflags $(STRCASECMP) $(TIMEZONE) \
$(MACHINE_FLAGS) $(PWCOMMENT) -DHELPFILE=\"$(OKBRIDGE_HELPFILE)\" \
-DNEWSFILE=\"$(OKBRIDGE_NEWSFILE)\"

BRIDGEOBJ =   bridge.o input.o display.o terminal.o network.o help.o scoring.o\
        boards.o cipher.o rc.o protocol.o parser.o nonstd.o socket.o\
        gps.o ccdef.o commands.o conversation.o cs.o log.o

SHUFFLEOBJ = okshuffle.o nonstd.o boards.o cipher.o scoring.o

TALLYOBJ = oktally.o nonstd.o boards.o cipher.o scoring.o log.o

#ifdef OKHand
HANDOBJ = okhand.o nonstd.o boards.o cipher.o scoring.o
HANDSRC = okhand.c
#endif

#ifdef GPS
GPSOBJ = gps_server.o socket.o boards.o nonstd.o cipher.o scoring.o
GPSSRC = ../gps-1.1/gps_server.c
GPS    = ../gps-1.1/gps_server
#endif

SRCS = bridge.c input.c display.c terminal.c network.c help.c scoring.c\
	boards.c cipher.c rc.c protocol.c parser.c nonstd.c socket.c\
	gps.c ccdef.c commands.c conversation.c cs.c log.c okshuffle.c\
	oktally.c $(HANDSRC) $(GPSSRC)

all:: okbridge okshuffle oktally
#ifdef OKhand
all:: okhand
#endif
#ifdef GPS
all:: gps_server
#endif

NormalProgramTarget(okbridge, $(BRIDGEOBJ), /*DEPS*/,\
                    -lcurses -ltermcap, /*SYSLIBS*/)
NormalProgramTarget(okshuffle, $(SHUFFLEOBJ), types.h boards.h,\
                    /*LOCALLIBS*/, /*SYSLIBS*/)
NormalProgramTarget(oktally, $(TALLYOBJ), types.h,\
                    /*LOCALLIBS*/, /*SYSLIBS*/)
#ifdef OKHand
NormalProgramTarget(okhand, $(HANDOBJ), types.h boards.h okhand.h,\
                    /*LOCALLIBS*/, /*SYSLIBS*/)
#endif
#ifdef GPS
NormalProgramTarget(gps_server, $(GPSSRC) $(GPSOBJ), /*DEPS*/,\
                    /*LOCALLIBS*/, /*SYSLIBS*/)
#endif

BINDIR = OKBinDir
InstallProgram(okbridge, $(BINDIR))
InstallProgram(okshuffle, $(BINDIR))
InstallProgram(oktally, $(BINDIR))
#ifdef OKHand
InstallProgram(okhand, $(BINDIR))
#endif
#ifdef GPS
InstallProgram(gps_server, $(BINDIR))
#endif

InstallNonExec(okbridge.help, OKLibDir)
InstallNonExec(okbridge.news, OKLibDir)

MANDIR = OKManDir
MANSUFFIX = OKManSuffix
InstallManPage(okbridge, $(MANDIR))
InstallManPage(okshuffle, $(MANDIR))
InstallManPage(oktally, $(MANDIR))

clean::
	rm -f tmp* *.log *.zlog *.orig

veryclean:	clean
	rm -f okbridge okshuffle oktally gps_server helpfile.h core tags TAGS

distrib:	veryclean
	csh -f < MkDistrib

/**/# Ok, time for some highly gross, evil abstraction violating hackery.
/**/# Basicly, we want help.o rebuilt with any new path flags if it is out
/**/# of date with respect to imake.config (where the paths are).  However,
/**/# The Makefile needs to be rebuilt in order to do this.  Imake is not
/**/# friendly in allowing this to be done easily.

#define IHaveSpecialMakefileTarget

Makefile: Imakefile imake.config
	-@if [ -f Makefile ]; then set -x; \
		$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
	else exit 0; fi
	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)

help.o: Makefile

DependTarget()
