# This makefile created on Wed Mar 17 13:00:47 EST 1993
# using create_makefile version 1.0.4
#  $Header: /plaid/homes/zeus/Blind-2.45/RCS/Makefile,v 2.45 1996/12/31 23:43:37 zeus Exp zeus $
#
#  $Log: Makefile,v $
# Revision 2.45  1996/12/31  23:43:37  zeus
# Revision 2.42  1994/05/17  13:43:15  bampton
# Revision 2.41  1994/04/08  03:11:28  bampton
# Revision 2.40  1994/03/09  20:22:55  bampton
# Revision 2.39  1993/10/28  22:31:20  bampton
# Revision 2.38  1993/09/27  17:15:54  bampton
# Revision 2.37  1993/09/07  20:50:32  bampton
# Revision 2.36  1993/08/19  16:36:09  bampton
#

# ++++++++ Game Configure section ++++++++++

#put executable file name here
PROGRAM = Blind           # GM's executable
PROGRAMN = New-game       # Executable for galaxy creation
PREPROCP = blind.dbg      # Preprocessor
BTOA = blind2ascii        # Blindrc -> ascii converter
ATOB = ascii2blind        # ascii -> Blindrc converter

# sort of Optional compilation flags
# typical game DEFINES (all optional features) = 
#          -DNEWGAME -DMINSEP=30.0 -DRANDPLACE -DCARRYOVER -DV3
# typical Preproc DEFINES =  -DPREPROC -DFORECAST (plus above)

# Comment out lines which have undesired game features

# GM helper compile options.
#INTERACTIVE = -DINTERACTIVE # Not supported
#BACKUPS = -DBACKUPS         # make blindrc.turn.bak on save
#REPORTDIR = -DREPORTDIR=\"reports\"  # Write reports into this subdir
#GAMENAME = -DGAMENAME       # Include gamename in blindrc file and reports
#FCASTNAMES = -DFCASTNAMES   # forecast reports named racename.F vs forecast.F
VERBOSE = -DVERBOSE          # Be chatty on phases, so the GM knows not hung

# New Game setup compile options
#NEWGAME = -DNEWGAME=1
#RANDPLACE = -DRANDPLACE
#MINSEP = -DMINSEP=20.0
#BALANCE = -DBALANCE

# Optional supported features
KCMD      = -DKCMD      # Add in the selective planet defense stuff
CARRYOVER = -DCARRYOVER # tech level info carries over from turn to turn 
V3        = -DV3        # add in more V3 stuff
UPGRADE = -DUPGRADE     # Add in Fleets and other V2.40+ features
PTECH = -DPARTTECH     # The 2.43+ Partial tech stuff

#Bug hackarounds, see INSTALL for info.
#BOMBBUG   = -DBOMBBUG
SIZEBUG = -DSIZEBUG
NONAMEBUG = -DNONAMEBUG # To fix C command games.

# Preprocessor switches
PREPROC = -DPREPROC    # Do this if you do the other 
FORECAST = -DFORECAST

# Experimental switches
#FULL_REPORTS = -DFULL_REPORTS # Non functional
#PASSWORDS = -DPASSWORDS   # Passwords, including a Y command.
#SMARTC= -DSMARTC #Rewrites races:players on C command...

# Performance Mods, see doc/INSTALL for valid values
# 
#SPEED = -DSPEED=15


# Flags needed when compiling the blindrc editor
#EDIT=-DEDIT  # Turn these off otherwise...

# ++++++ OS Dependant stuff ++++++++

#some machines may not like/honor this directive
# Gnu Make does not. AIX's make appears to not support it either.
.KEEP_STATE::

# Pick your Flavor of Unix. Defining more than one of this will probably
# break things, as might defining none.
SUNOS4=-DSUNOS4=1   # SunOS 4.1-4.1.4
#HPUX=-DHPUX=1       # HP-UX 9.03
#SOLARIS=-DSOLARIS=1 # Slowaris 2.x
#ULTRIX=-DULTRIX=1   # Ultrix 4.3 and 4.4 
#AIX=-DAIX -D_BSD_INCLUDES  # AIX 3.2.5 BSD stuff needed for a few prototypes
#LINUX=-DLINUX       # Linux
#OSF1=-DOSF1         # OSF1 V3.2 NOTE THAT THIS IS A PARTIAL PORT!

# gcc 2.5.8 and 2.6.x are different (at least on a sun4&3, SunOS 4.1.x) for
# tolower and fputc prototypes. Sigh. 2.7.2 (at least on a SunOS 4.1.4
# box) wants GCC260 defined too.
# These appear to be SunOS 4 specific requirements.
GCC260 = -DGCC260
#GCC258 = -DGCC258

# gcc 2.3.3 on a Sun doesn't have prototypes for atol atoi, but 2.5.8 does
# Define or not, depending on errors
#WANT_ATO_PROT = -DWANT_ATO_PROT


# Most Unix's appear to have srand48. BSD boxes also have random. srand
# is apparently a "poor" random number generator.
# If you do not have random but do have srand48, and you aren't one of 
# the predefined OS's above, turn this on. SunOS 4.1.x has both.
#USESRAND48 = -DUSESRAND48

# Put in debugging compuiler flags here (-g, or -ggdb for GNU's debugger)
# Or use -O if you trust the code that much...
DBGFLAGS = -ggdb3
#DBGFLAGS = -O4

# These are the "Totally paranoid" flags, use them or not
# -ansi Won't work on some broken gcc installations
# -pedantic Would be nice, but not too useful, as sun's header files aren't 
#            ansi....
# -Wredundant-decls whines about stuff in Sun header files too, sigh.
#PNOIDFLAGS = -Wconversion -Wstrict-prototypes -Wmissing-prototypes -ansi -pedantic -Wshadow -Wmissing-declarations -Wredundant-decls
#PNOIDFLAGS = -Wconversion -Wstrict-prototypes -Wmissing-prototypes -ansi -pedantic -Wredundant-decls
PNOIDFLAGS = -Wconversion -Wstrict-prototypes -Wmissing-prototypes -ansi -pedantic

# Note: some compilers/OS do not support -pipe, ex: gcc on sun3's
# and Ultrix
# If -pipe is supported, files compile faster.
CCPIPE = -pipe 

# Flags to your compiler for profiling the code. Usefull for
# manually Optimizing code only. Turn it off, otherwise.
#PROF = -pg

# Put in OS flags, and other flags here that should be seen by all files:
# For HPUX/8.07 cc add -Aa (Maybe)
CFLAGS =  ${DBGFLAGS} -Wall  -c -Iprotos ${PNOIDFLAGS} ${WANT_ATO_PROT} \
	${CCPIPE} ${USESRAND48} ${GCC260} ${GCC258} ${PROF} ${ULTRIX} \
	${HPUX} ${SUNOS4} ${SOLARIS} ${AIX} ${LINUX} 

# Want a static binary? Not needed, but useful on occasion
#STATIC= -static # For gcc
#STATIC= -Bstatic # For other cc's?
# Put flags for ld here:
LDFLAGS =  ${DBGFLAGS} ${STATIC} ${PROF}

#LINT = /usr/5bin/lint # Forget it
#LINTFLAGS =  -abchn -lansic
LINTFLAGS =  -cs -lm -Aa # This works on an HP...

RM = rm -f

# Put in your complier choice here. Note: It must be ansi compliant
# Gcc is what I use, anything else, you are on your own...
CC = gcc

# Libraries needed. At least for SUNs, HPUX, and ULTRIX, this is just 
# the math lib.
# Linux appears to require -lc if compiled with -g/-ggdb
LIBS = -lm

# Copy flags, -p to preserve time stamps
CP = cp -p

# Purify, if desired [Probably not, unless you are hunting Bugs.]
#PURE=purify
# ++++++++ Install section ++++++++++
# (Optional)

INSTALLDIR=.

################################################
# You shouldn't need to edit anything below here
################################################

# Current version #
VER=2.45

#put source files here
# All C source files in the top directory.
SRCS =  Blind.c loadgame.c savegame.c enterturn.c battle.c misc.c \
	addplayer.c turn.c new-game.c version.c new-galaxy.c 

# These groups are for varios executables. They are complete, except
# for the cmds/*.c stuff, which is handled later.

# preprocessor (without forecaster) source files
SRCP =  Blind.c loadgame.c enterturn.c misc.c  version.c \
	report-gm.c report-main.c report-planets.c report-ships.c \
	report-map.c report-battle.c report-status.c 

# FORECASTing preprocessor source files
SRCPP =  Blind.c loadgame.c enterturn.c misc.c  version.c turn.c \
	report-main.c report-planets.c report-map.c report-ships.c \
	report-status.c 

# New game source files
SBJN = new-galaxy.c savegame.c addplayer.c new-game.c version.c misc.c

# Game in progress source files
SRCG =  Blind.c loadgame.c savegame.c enterturn.c battle.c misc.c  \
	turn.c version.c ${REPORT_C}

# Game editor source files
SRCE =  edit.c loadgame.c savegame.c enterturn.c misc.c version.c

# Blindrc to ascii converter
SRCB2A = loadgame.c util/blindrc-to-ascii.c misc.c

# Ascii to Blindrc converter
SRCA2B = savegame.c util/ascii-to-blindrc.c misc.c


#put object files here
OBJS =  Blind.o loadgame.o savegame.o enterturn.o battle.o misc.o \
	addplayer.o turn.o new-game.o version.o new-galaxy.o 
OBJP =  Blind.o loadgame.o enterturn.o misc.o version.o 
OBJPP =  Blind.o loadgame.o enterturn.o misc.o version.o turn.o report/Main.o \
	report/map.o report/ships.o report/status.o report/planets.o
OBJN = new-galaxy.o savegame.o addplayer.o new-game.o version.o misc.o report/gm.o report/Main.o report/map.o report/planets.o
OBJG = Blind.o loadgame.o savegame.o enterturn.o battle.o misc.o  \
	turn.o version.o 
OBJE =  util/edit.o loadgame.o savegame.o misc.o report-main.o report-ships.o \
	report-planets.o report-map.o
OBJB2A = loadgame.o util/blindrc-to-ascii.o misc.o
OBJA2B = savegame.o util/ascii-to-blindrc.o misc.o


# Put Header files here
HEADERS = protos/battle.h protos/cmds-g.h protos/cmds.h protos/common.h \
	protos/enterturn-g.h protos/enterturn.h protos/global.h protos/i-o.h \
	protos/misc-g.h protos/misc.h protos/new-game.h protos/prototypes.h \
	protos/report-g.h protos/report.h protos/version.h protos/battle-g.h \
	protos/turn.h protos/turn-g.h protos/addplayer.h protos/exit.h \
	protos/a2b.h protos/b2a.h protos/speed.h protos/options.h


# Put player command parsing files here
# Yes, q.r, v.c, z.c are missing. There are no commands by that name yet
CMDS_C = cmds/a.c cmds/b.c cmds/c.c cmds/d.c cmds/e.c cmds/f.c cmds/g.c \
	cmds/h.c cmds/i.c cmds/j.c cmds/k.c cmds/l.c cmds/m.c cmds/n.c \
	cmds/o.c cmds/p.c cmds/r.c cmds/s.c cmds/t.c cmds/u.c \
	cmds/w.c cmds/x.c cmds/y.c cmds/z.c cmds/Cmds-lib.c

CMDS_O = cmds/a.o cmds/b.o cmds/c.o cmds/d.o cmds/e.o cmds/f.o cmds/g.o \
	cmds/h.o cmds/i.o cmds/j.o cmds/k.o cmds/l.o cmds/m.o cmds/n.o \
	cmds/o.o cmds/p.o cmds/r.o cmds/s.o cmds/t.o cmds/u.o \
	cmds/w.o cmds/x.o cmds/y.o cmds/Cmds-lib.o

# Put report code here
REPORT_C = report/Battle.c report/Main.c report/gm.c report/map.c \
	report/planets.c report/ships.c report/status.c

REPORT_O = report/Battle.o report/Main.o report/gm.o report/map.o \
	report/planets.o report/ships.o report/status.o

# Misc files to include
MISC = Makefile Readme To-Do Changes 
MISC2 = manifest
# Documentation stuff
DOCS = doc/Add-ons doc/FAQ doc/INSTALL doc/Notes doc/Ported doc/QuickRef \
	doc/Rules doc/fleet.txt doc/intro doc/Bugs doc/Starting-a-game \
	doc/UFAQ doc/Player-intro doc/intro doc/New doc/Codeinfo

# Scripts that might be of use
SCRIPTS = support/README support/mailer support/Compile-all support/mailer.csh
S=scripts
SERVER = ${S}/ADDNEW ${S}/README ${S}/multi-forw ${S}/turn-over ${S}/MONITER  \
	${S}/body.awk ${S}/return.awk ${S}/turn-run ${S}/Pre-proc \
	${S}/game-forw ${S}/run ${S}/good-subject ${S}/p-Can-Fwd \
	${S}/blind-preproc.awk ${S}/v3-blind-preproc.awk ${S}/forw-body.awk

# Convertison utilities code
UTILS = util/blindrc-to-ascii.c util/ascii-to-blindrc.c util/edit.c

# The whole thing
ALLSRC = ${SRCS} ${HEADERS} ${SERVER} ${SCRIPTS} ${MISC} ${DOCS} ${MISC2} \
	${UTILS} ${CMDS_C} ${REPORT_C}

#Default action for make:
Blind:   ${OBJG} ${CMDS_O} ${REPORT_O}
	@# Cut here if using Ultrix
	#case x${NEWGAME} in
	#	*) ;;
	#  x) ;; # AOK
	#  x1) echo ""; echo ""; echo "Blind configure error ..."; \
	#      echo "NEWGAME defined. "; echo "undefine, or 'make New-game'"; \
	#      echo ""; exit 2;;
	#esac
	@if [ x${PREPROC} = x  -a x${FORECAST} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error .."; \
	echo "PREPROC not defined, and FORECAST defined "; \
	echo "undefine'"; \
	echo ""; \
	exit 2; \
	fi
	@# Stop cutting here for Ultrix
	${PURE} ${CC} $(LDFLAGS) ${OPTS} -o ${PROGRAM} ${OBJG} ${CMDS_O} ${REPORT_O} ${LIBS}

New-game: ${OBJN}
	@if [ x${NEWGAME} = x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error ..."; \
	echo "NEWGAME not defined. "; \
	echo "define, or 'make Blind'"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${PREPROC} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error .."; \
	echo "PREPROC defined. "; \
	echo "undefine'"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${PREPROC} = x  -a x${FORECAST} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error .."; \
	echo "PREPROC not defined, FORECAST defined "; \
	echo "undefine'"; \
	echo ""; \
	exit 2; \
	fi
	${PURE} ${CC} $(LDFLAGS) ${OPTS} -o ${PROGRAMN} ${OBJN} ${LIBS} 

blind.dbg:   $(OBJP) ${CMDS_O}
	@if [ x${FORECAST} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error ..."; \
	echo "FORECAST defined, undefine, or build dbg-plus"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${NEWGAME} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error ..."; \
	echo "NEWGAME defined, undefine"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${PREPROC} = x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error .."; \
	echo "PREPROC not defined"; \
	echo ""; \
	exit 2; \
	fi
	${PURE} ${CC} $(LDFLAGS) ${OPTS} -o ${PREPROCP} ${OBJP} ${CMDS_O} ${LIBS}

dbg-plus:   $(OBJPP) $(CMDS_O)
	@if [ x${FORECAST} = x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error ..."; \
	echo "FORECAST not defined, define, or build blind.dbg"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${NEWGAME} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error ..."; \
	echo "NEWGAME defined, undefine"; \
	echo ""; \
	exit 2; \
	fi
	@if [ x${PREPROC} = x ] ; then \
	echo ""; \
	echo ""; \
	echo "Blind configure error .."; \
	echo "PREPROC not defined"; \
	echo ""; \
	exit 2; \
	fi
	${PURE} ${CC} $(LDFLAGS) ${OPTS} -o ${PREPROCP} ${OBJPP} ${CMDS_O} ${LIBS}
	@touch dbg-plus

edit: $(OBJE)
	${PURE} ${CC} $(LDFLAGS) ${DEFINES} ${OPTS} -o Edit $(OBJE) ${LIBS}

blind2ascii: ${OBJB2A}
	${PURE} ${CC} -o ${BTOA} ${OBJB2A} ${LDFLAGS} ${OPTS} ${LIBS}

ascii2blind: ${OBJA2B}
	${PURE} ${CC} -o ${ATOB} ${OBJA2B} ${LDFLAGS} ${OPTS} ${LIBS}

upgrade: ${OBJG} Fix
	@if [ x${PREPROC} != x ] ; then \
	echo ""; \
	echo ""; \
	echo "Upgrade configure error .."; \
	echo "PREPROC defined. "; \
	echo "undefine"; \
	echo ""; \
	exit 2; \
	fi
	${CC} loadgame.c ${CFLAGS} ${PREPOC} ${NEW} ${CARRYOVER} ${V3} ${KCMD} \
	-DBOMBBUG
	${CC} savegame.c ${CFLAGS} ${PREPOC} ${NEW} ${CARRYOVER} ${V3} ${KCMD} \
	-DFIX ${NONAMEBUG} ${GAMENAME}
	${CC} Blind.c ${CFLAGS} ${BACKUPS} ${PREPROC} -DVER=${VER} \
	${UPGRADE} ${REPORTDIR} ${V3} ${CARRYOVER}  ${GAMENAME} -DFIX


	${CC} $(LDFLAGS) ${OPTS} -o Fix ${OBJG} ${LIBS}
	@echo ""; echo "";
	@echo "Making backup copy of blindrc: blindrc.orig"
	@${CP} blindrc blindrc.orig
	@if [ x${GAMENAME} != x ] ; then \
	echo "GAMENAME defined, see INSTALL for manual upgrade instrctions";\
	exit 2; \
	fi
	@echo "q" | Fix
	@echo "Conversion complete"

install:
	${CP} Blind blind.dbg ${INSTALLDIR}

Blind.o: Blind.c
	${CC} $*.c ${CFLAGS} ${BACKUPS} ${NEWGAME} ${PREPROC} -DVER=${VER} \
	${UPGRADE} ${REPORTDIR} ${V3} ${CARRYOVER}  ${GAMENAME}

new-galaxy.o: new-galaxy.c
	${CC} $*.c ${CFLAGS} ${BACKUPS} ${NEWGAME} -DVER=${VER} \
	${UPGRADE} ${CARRYOVER}  ${GAMENAME} ${MINSEP}


addplayer.o: addplayer.c
	${CC} $*.c ${CFLAGS} ${RANDPLACE} ${MINSEP} ${V3} \
	${CARRYOVER} ${UPGRADE}

battle.o: battle.c
	${CC} $*.c ${CFLAGS} ${V3} ${VERBOSE} ${UPGRADE} ${CARRYOVER}

util/edit.o: util/edit.c
	${CC} $*.c ${CFLAGS} -DVER=${VER}  ${UPGRADE} ${CARRYOVER} ${V3}
	@mv edit.o util

#cmds.o: cmds.c
#	${CC} $*.c ${CFLAGS} ${KCMD} ${PREPROC} ${V3} ${UPGRADE} ${SIZEBUG} \
#	${CARRYOVER} ${PTECH}

cmds/a.o: cmds/a.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} 
	@mv a.o cmds

cmds/b.o: cmds/b.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv b.o cmds

cmds/c.o: cmds/c.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER}
	@mv c.o cmds

cmds/d.o: cmds/d.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE} ${SIZEBUG}
	@mv d.o cmds

cmds/e.o: cmds/e.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv e.o cmds

cmds/f.o: cmds/f.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER}
	@mv f.o cmds

cmds/g.o: cmds/g.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${PTECH} ${UPGRADE}
	@mv g.o cmds

cmds/h.o: cmds/h.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER}
	@mv h.o cmds

cmds/i.o: cmds/i.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv i.o cmds

cmds/j.o: cmds/j.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv j.o cmds

cmds/k.o: cmds/k.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${KCMD} ${UPGRADE}
	@mv k.o cmds

cmds/l.o: cmds/l.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv l.o cmds

cmds/m.o: cmds/m.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER}
	@mv m.o cmds

cmds/n.o: cmds/n.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv n.o cmds

cmds/o.o: cmds/o.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${PREPROC}
	@mv o.o cmds

cmds/p.o: cmds/p.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${PREPROC} ${UPGRADE} \
	${PTECH}
	@mv p.o cmds

cmds/r.o: cmds/r.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv r.o cmds

cmds/s.o: cmds/s.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv s.o cmds

cmds/t.o: cmds/t.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv t.o cmds

cmds/u.o: cmds/u.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv u.o cmds

cmds/w.o: cmds/w.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER}
	@mv w.o cmds

cmds/x.o: cmds/x.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE}
	@mv x.o cmds

cmds/y.o: cmds/y.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE} ${PASSWORDS} ${PREPROC}
	@mv y.o cmds

cmds/Cmds-lib.o: cmds/Cmds-lib.c
	${CC} $*.c ${CFLAGS} ${V3} ${CARRYOVER} ${UPGRADE} ${PREPROC} \
	${PTECH}
	@mv Cmds-lib.o cmds

enterturn.o: enterturn.c
	${CC} $*.c ${CFLAGS} ${INTERACTIVE} ${KCMD} ${PREPROC} \
	${V3} ${FORECAST} ${UPGRADE} ${CARRYOVER} ${PASSWORDS} ${GAMENAME}

loadgame.o: loadgame.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${KCMD} ${VERBOSE} \
	${BOMBBUG} ${UPGRADE} ${SIZEBUG} ${NONAMEBUG} ${GAMENAME} ${SPEED}

misc.o: misc.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${PREPROC} ${V3} ${KCMD} \
	${UPGRADE} ${PTECH} ${INTERACTIVE}  ${SPEED}

new-game.o: new-game.c
	${CC} $*.c ${CFLAGS} ${GAMENAME} ${UPGRADE} ${V3} ${CARRYOVER} \
	${BALANCE} ${VERBOSE} ${MINSEP}

report/Main.o: report/Main.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} \
	${NEWGAME} ${VERBOSE} ${EDIT}
	@mv Main.o report

report-main.o: report-main.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} \
	${NEWGAME} ${VERBOSE} ${EDIT}

report/Battle.o: report/Battle.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} 
	@mv Battle.o report

report-battle.o: report-battle.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} 

report/status.o: report/status.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} 
	@mv status.o report

report-status.o: report-status.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${FULL_REPORTS} ${PREPROC} ${V3} \
	${KCMD} -DVER=${VER} ${FORECAST} ${FCASTNAMES} ${UPGRADE} ${GAMENAME} 


report/gm.o: report/gm.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${UPGRADE} ${NEWGAME}
	@mv gm.o report

report-gm.o: report-gm.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${UPGRADE} ${NEWGAME}

report/ships.o: report/ships.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${FORECAST} ${UPGRADE}
	@mv ships.o report

report-ships.o: report-ships.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${FORECAST} ${UPGRADE}

report/map.o: report/map.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${FORECAST} ${UPGRADE}
	@mv map.o report

report-map.o: report-map.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${FORECAST} ${UPGRADE}

report/planets.o: report/planets.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${KCMD} ${FORECAST} ${UPGRADE} \
	${NEWGAME} ${SPEED} ${EDIT}
	@mv planets.o report

report-planets.o: report-planets.c
	${CC} $*.c ${CFLAGS} ${CARRYOVER} ${V3} ${KCMD} ${FORECAST} ${UPGRADE} \
	${NEWGAME} ${SPEED} ${EDIT}

savegame.o: savegame.c
	${CC} $*.c ${CFLAGS} ${PREPOC} ${CARRYOVER} ${V3} ${KCMD} ${UPGRADE} \
	${BOMBBUG} ${SIZEBUG} ${NONAMEBUG} ${GAMENAME}

turn.o: turn.c
	${CC} $*.c ${CFLAGS} ${PREPROC} ${FORECAST} ${VERBOSE} ${UPGRADE} \
	${V3} ${CARRYOVER} ${PTECH} ${SPEED} ${SMARTC}

version.o: version.c
	${CC} $*.c ${CFLAGS} ${BACKUPS} ${INTERACTIVE} ${PTECH} \
	${CARRYOVER} ${V3} ${KCMD} ${RANDPLACE} ${MINSEP} ${NEWGAME} \
	${PREPROC} ${FORECAST} -DVER=${VER} ${BOMBBUG} ${UPGRADE} \
	${SIZEBUG} ${BALANCE} ${VERBOSE} ${FCASTNAMES} ${NEW1} ${SMARTC} \
	${FORECASTNAMES} ${GAMENAME} ${NONAMEBUG} ${SPEED} ${PASSWORDS}

util/blindrc-to-ascii.o: util/blindrc-to-ascii.c
	${CC} $*.c ${CFLAGS} -DVER=${VER} ${GAMENAME} ${KCMD} ${V3} \
	${UPGRADE} ${CARRYOVER}  ${NONAMEBUG} -I.
	@mv blindrc-to-ascii.o util

util/ascii-to-blindrc.o: util/ascii-to-blindrc.c
	${CC} $*.c ${CFLAGS} -DVER=${VER} ${GAMENAME} ${KCMD} ${V3} \
	${UPGRADE} ${CARRYOVER}  ${NONAMEBUG} ${VERBOSE} -I.
	@mv ascii-to-blindrc.o util

#rule to follow for making object files form source files
#.c.o:; ${CC} ${CFLAGS} $*.c ${DEFINES}


build-dirs:;
	@if [ -d Blind-${VER} ] ; then \
	echo "Warning, directory exists" ; \
	else \
	mkdir Blind-${VER} Blind-${VER}/doc Blind-${VER}/cmds \
	Blind-${VER}/protos Blind-${VER}/scripts Blind-${VER}/support \
	Blind-${VER}/util Blind-${VER}/report; \
	fi
	${CP} ${SRCS}  ${MISC} Blind-${VER}
	${CP} ${DOCS} Blind-${VER}/doc
	${CP} ${CMDS_C} Blind-${VER}/cmds
	${CP} ${HEADERS} Blind-${VER}/protos
	${CP} ${SERVER} Blind-${VER}/scripts
	${CP} ${SCRIPTS} Blind-${VER}/support
	${CP} ${UTILS} Blind-${VER}/util
	${CP} ${REPORT_C} Blind-${VER}/report

tar: ${ALLSRC} build-dirs manifest
	tar cvf Blind-src-V${VER}.tar Blind-${VER}
	compress Blind-src-V${VER}.tar

zip: ${ALLSRC} build-dirs manifest
	zip -r Blind-src-V${VER}.zip Blind-${VER}

rcs-ver::
	ci -l${VER} ${SRCS} ${HEADERS} Makefile ${SCRIPTS} ${SERVER} ${CMDS_C} \
	${UTILS}

ftp::
	${CP} Blind-src-V${VER}.zip Blind-src-V${VER}.tar.Z doc/Rules doc/FAQ \
	doc/UFAQ doc/QuickRef /ruby/homes/ftp/pub/bampton/Blind
	(cd /ruby/homes/ftp/pub/bampton/Blind; compress QuickRef Rules UFAQ)

clean::
	- ${RM} *.o cmds/*.o util/*.o report/*.o *.ln *~ core


very-clean::
	${RM} *.o cmds/*.o util/*.o report/*.o *.ln *~ core ${PROGRAM} ${PREPROCP} New-game Edit blindrc forecast.F blind2ascii ascii2blind

print::
	enscript -2 -r -h ${SRCS} ${HEADERS} ${MISC} ${DOCS}


lint:           l${PROGRAM}.ln


manifest: build-dirs
	@echo "Files included in this release:" > Blind-${VER}/manifest
	@echo "" >> Blind-${VER}/manifest
	@ls -lR Blind-${VER} >> Blind-${VER}/manifest
	@echo "Made Blind-${VER}/manifest"

l${PROGRAM}.ln: ${SRCS}
	${LINT} ${LINTFLAGS} ${SRCS} ${BACKUPS} ${INTERACTIVE} ${FULL_REPORTS} \
        ${CARRYOVER} ${V3} ${KCMD} ${RANDPLACE} ${MINSEP} ${NEWGAME} \
        ${PREPROC} ${FORECAST} -DVER=${VER} ${BOMBBUG} ${UPGRADE} \
        ${SIZEBUG} ${BALANCE} ${VERBOSE} ${FCASTNAMES} ${NEW1} \
        ${FORECASTNAMES} ${GAMENAME} ${NONAMEBUG}

# Header file dependancies:

Blind.o: protos/common.h protos/global.h protos/prototypes.h protos/new-game.h \
	protos/turn-g.h protos/exit.h
addplayer.c: protos/common.h protos/global.h protos/prototypes.h \
	protos/misc-g.h protos/addplayer.h protos/options.h
battle.o: protos/common.h protos/global.h protos/prototypes.h protos/battle.h \
	protos/battle-g.h protos/misc-g.h
cmds.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h \
	protos/global.h protos/cmds-g.h protos/misc-g.h
enterturn.o: protos/common.h protos/global.h protos/prototypes.h \
	protos/enterturn.h protos/cmds-g.h protos/enterturn-g.h \
	protos/misc-g.h protos/exit.h protos/cmds.h protos/options.h
loadgame.o: protos/common.h protos/global.h protos/prototypes.h protos/i-o.h \
	protos/misc-g.h protos/exit.h
misc.o: protos/common.h protos/prototypes.h protos/misc.h protos/global.h \
	protos/misc-g.h protos/exit.h protos/speed.h
new-galaxy.o: protos/common.h protos/global.h protos/prototypes.h \
	protos/new-game.h
new-game.o: protos/common.h protos/global.h protos/prototypes.h  \
	protos/new-game.h protos/i-o.h
savegame.o: protos/common.h protos/global.h protos/prototypes.h protos/i-o.h \
	protos/misc-g.h
turn.o: protos/common.h protos/global.h protos/prototypes.h protos/turn.h \
	protos/turn-g.h protos/battle-g.h protos/speed.h protos/misc-g.h \
	protos/options.h
version.o: protos/common.h protos/global.h protos/prototypes.h protos/version.h
version.o: protos/options.h
util/edit.o: protos/common.h protos/prototypes.h protos/report-g.h protos/global.h
Fix: loadgame.o savegame.o Blind.o
report-battle.o: protos/global.h protos/prototypes.h protos/report-g.h \
	protos/common.h protos/report.h protos/misc-g.h protos/i-o.h \
	protos/options.h
report-gm.o: protos/common.h protos/global.h protos/options.h
report-gm.o: protos/prototypes.h protos/report-g.h protos/report.h
report-main.o: protos/global.h protos/prototypes.h protos/report-g.h
report-main.o: protos/common.h protos/report.h protos/exit.h protos/misc-g.h
report-map.o: protos/common.h protos/global.h protos/options.h
report-map.o: protos/prototypes.h protos/report-g.h protos/report.h \
	protos/options.h
report-planets.o: protos/global.h protos/prototypes.h protos/report-g.h \
	protos/common.h protos/report.h protos/misc-g.h \
	protos/options.h
report-ships.o: protos/global.h protos/prototypes.h protos/report-g.h \
	protos/common.h protos/report.h protos/misc-g.h protos/options.h \
	protos/options.h
report-status.o: protos/global.h protos/prototypes.h protos/report-g.h \
	protos/common.h protos/report.h protos/misc-g.h protos/options.h
cmds/Cmds-lib.o: protos/common.h protos/prototypes.h protos/enterturn-g.h
cmds/Cmds-lib.o: protos/cmds.h protos/cmds-g.h protos/misc-g.h protos/options.h
cmds/a.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/a.o: protos/enterturn-g.h
cmds/b.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/b.o: protos/enterturn-g.h protos/misc-g.h protos/options.h
cmds/c.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/c.o: protos/cmds-g.h
cmds/d.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/d.o: protos/cmds-g.h
cmds/e.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/e.o: protos/cmds-g.h
cmds/f.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/f.o: protos/options.h
cmds/g.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/g.o: protos/enterturn-g.h protos/misc-g.h
cmds/h.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/h.o: protos/enterturn-g.h
cmds/i.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/i.o: protos/enterturn-g.h
cmds/j.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/j.o: protos/enterturn-g.h
cmds/k.o: protos/common.h protos/prototypes.h protos/cmds.h protos/cmds-g.h
cmds/k.o: protos/enterturn-g.h
cmds/l.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/l.o: protos/cmds-g.h
cmds/m.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/m.o: protos/cmds-g.h protos/options.h
cmds/n.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/n.o: protos/cmds-g.h
cmds/o.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/o.o: protos/cmds-g.h protos/options.h
cmds/p.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/p.o: protos/cmds-g.h
cmds/r.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/r.o: protos/cmds-g.h
cmds/s.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/s.o: protos/cmds-g.h
cmds/t.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/t.o: protos/cmds-g.h
cmds/u.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/u.o: protos/cmds-g.h
cmds/w.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/w.o: protos/cmds-g.h
cmds/x.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/x.o: protos/cmds-g.h
cmds/y.o: protos/common.h protos/prototypes.h protos/enterturn-g.h protos/cmds.h
cmds/y.o: protos/cmds-g.h
util/blindrc-to-ascii.o: protos/common.h protos/prototypes.h protos/b2a.h
util/ascii-to-blindrc.o: protos/common.h protos/prototypes.h protos/a2b.h
report/Battle.o: protos/common.h protos/prototypes.h protos/report-g.h
report/Battle.o: protos/report.h protos/misc-g.h protos/i-o.h protos/options.h
report/Battle.o: protos/global.h
report/Main.o: protos/common.h protos/prototypes.h protos/report-g.h
report/Main.o: protos/report.h protos/misc-g.h protos/exit.h protos/options.h
report/Main.o: protos/global.h
report/gm.o: protos/common.h protos/prototypes.h protos/report-g.h
report/gm.o: protos/report.h protos/options.h protos/global.h
report/map.o: protos/common.h  protos/options.h protos/prototypes.h
report/map.o:  protos/report.h protos/report-g.h protos/global.h
report/planets.o: protos/common.h protos/misc-g.h protos/options.h 
report/planets.o: protos/global.h
report/planets.o: protos/prototypes.h protos/report-g.h protos/report.h
report/ships.o: protos/common.h  protos/global.h
report/ships.o: protos/prototypes.h protos/report-g.h protos/report.h
report/ships.o: protos/misc-g.h protos/options.h
report/status.o: protos/common.h  protos/global.h
report/status.o: protos/prototypes.h protos/report-g.h protos/report.h
report/status.o: protos/misc-g.h protos/options.h
# If .KEEP_STATE is ignored, try uncommenting this line out
#.o: Makefile
# DO NOT DELETE THIS LINE -- make depend depends on it.
