#
# Microsoft Visual Studio Makefile for PHYLIP 3.6.
#
# You should not need to change anything, though if you want you could
# change one of first two (noncomment) statements to some directory locations
# that might be more useful.
# The archives when extracted put the source code into a directory .\src,
# and also puts the documentation web pages into .\exe, and makes a directory
# .\exe for the final executables.  Only change the definition of EXEDIR
# if you want something different from that structure.
#
# If it causes trouble in compiling, the CFLAGS statement below may alse need
# to be changed.
#
# To use the PHYLIP v3.6 Makefile, type
#   make install       to compile the whole package and then install
#                        the executables in $(EXEDIR), then remove the object
#                        files to save space
#   make all           to compile the whole package but not install it
#                        or remove the object files
#   make put           to move the executables into $(EXEDIR)
#   make clean         to remove all object files and executables from the
#                        current directory
#   make dnaml         to compile and link one program, (in this example,
#                        DnaML) and leave the executable and object files
#                        in the current directory (where the source code is).
#                        You will have to move the executable into the
#                        executables directory (e.g. "mv dnaml.exe")
#                        Note that the program name should be lower case.
#
# ----------------------------------------------------------------------------
#  (Starting here is the section where you may want to change things)
# ----------------------------------------------------------------------------
#
# these are the two statements we have been talking about:
# one of the reasons for changing them would be to put the executables and\or
# the documentation on a different file system.
# The default configuration is to have within the overall PHYLIP
# directory three subdirectories:  "src" for source code, "exe" for the
# executables, and "doc" for the documentation files.
#
# the following specifies the directory where the executables will be placed
EXEDIR  = ..\exe
#
# ----------------------------------------------------------------------------
# You must change MSVCPATH to the full path where you have installed 
# Microsoft Visual Studio. These must be names without spaces. The default
# location is 
# c:\Program Files\microsoft visual studio.net\vc7. 
# The shortened name is
# c:\progra~1\Micros~1.net\VC7
MSVCPATH=c:\Progra~1\Micros~1.net\VC7
INCPATH=$(MSVCPATH)\Include\#
INCPATH2=$(MSVCPATH)\Platformsdk\include
CFLAGS  =/c /O2 /Oy /DWIN32 /I$(INCPATH) /I$(INCPATH2)
LFLAGS =/link /libpath:$(MSVCPATH)\Lib\ /libpath:$(MSVCPATH)\PlatformSDK\lib
#
#
#
#
# ----------------------------------------------------------------------------
#  (After this point there should not be any reason to change anything)
# ----------------------------------------------------------------------------
#
#  Specifies the C compiler.
CC        = cl.exe $(CFLAGS)
LINK	= cl.exe 
LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
#
# Specifies the resource compiler
RC = rc.exe /I$(INCPATH) /I$(INCPATH2)
#
#
#
# the list of programs
#
PROGS   =          clique.exe consense.exe contml.exe contrast.exe \
                   dnacomp.exe dnadist.exe dnainvar.exe dnaml.exe dnamlk.exe \
                   dnamove.exe dnapars.exe dnapenny.exe dolmove.exe \
                   dollop.exe dolpenny.exe drawgram.exe drawtree.exe \
                   factor.exe fitch.exe gendist.exe kitsch.exe mix.exe \
                   move.exe neighbor.exe pars.exe penny.exe proml.exe \
                   promlk.exe protdist.exe protpars.exe restdist.exe \
                   restml.exe retree.exe seqboot.exe treedist.exe
#
# general commands
#

#
#  The first uses a symbol you are unlikely to type.  It is the one that
#  is executed if you just type "make".  It tells you how to use the
#  Makefile.
#
a1b2c3d4:
	@echo ""
	@echo " To use the PHYLIP v3.6 Makefile, type"
	@echo "     make install       to compile the whole package and then install"
	@echo "                          the executables in $(EXEDIR), then remove the object"
	@echo "                          files to save space"
	@echo "     make all           to compile the whole package but not install it"
	@echo "                          or remove the object files"
	@echo "     make put           to move the executables into $(EXEDIR)"
	@echo "     make clean         to remove all object files and executables from the"
	@echo "                          current directory"
	@echo "     make dnaml         to compile and link one program, (in this example,"
	@echo "                          DnaML) and leave the executable and object files"
	@echo "                          in the current directory (where the source code is)."
	@echo "                          You will have to move the executable into the"
	@echo "                          executables directory (e.g. "mv dnaml.exe ..\exe")"
	@echo "                          Note that the program name should be lower case."
	@echo " "

introduce:
	@echo "Building PHYLIP version 3.6"

all:        introduce $(PROGS)
	@echo "Finished compiling."

install:        all put clean
	@echo "Done."

put:
	@echo "Installing PHYLIP v3.6 binaries in $(EXEDIR)"
	@copy *.exe $(EXEDIR)
	@echo "Installing font files in $(EXEDIR)"
	@copy font* $(EXEDIR)
	@echo "Finished installation."

clean:
	@echo "Removing object files to save space"
	@del *.obj *.res
	@echo "Finished removing object files.  Now will remove"
	@echo "executable files from the current directory, but not from the"
	@echo "executables directory.  (If some are not here, the makefile"
	@echo "will terminate with an error message but this is not a problem)"
	@echo ""
	@echo "Removing executables from this directory"
	@del $(PROGS)
	@echo "Finished cleanup."

# The following is so that a command like
# make dnaml 
# will actually do something usefull
clique: clique.exe
consense: consense.exe
contml: contml.exe
contrast: contrast.exe
dnacomp: dnacomp.exe
dnadist: dnadist.exe
dnainvar: dnainvar.exe
dnaml: dnaml.exe
dnamove: dnamove.exe
dnapars: dnapars.exe
dnapenny: dnapenny.exe
dolmove: dolmove.exe
dollop: dollop.exe
dolpenny: dolpenny.exe
drawgram: drawgram.exe
drawtree: drawtree.exe
factor: factor.exe
fitch: fitch.exe
gendist: gendist.exe
kitsch: kitsch.exe
mix: mix.exe
move: move.exe
neighbor: neighbor.exe
pars: pars.exe
penny: penny.exe
proml: proml.exe
promlk: promlk.exe
protdist: protdist.exe
protpars: protpars.exe
restdist: restdist.exe
restml: restml.exe
retree: retree.exe
seqboot: seqboot.exe
treedist: treedist.exe

#
# compile the support files with the shared functions
#

phylip.obj:        phylip.h
	$(CC)  phylip.c

seq.obj:        seq.c phylip.h seq.h
	$(CC)  seq.c

disc.obj:   disc.c phylip.h disc.h
	$(CC)  disc.c

discrete.obj:        discrete.c discrete.h phylip.h
	$(CC)  discrete.c

dollo.obj:        dollo.c phylip.h dollo.h
	$(CC)  dollo.c

wagner.obj:        wagner.c phylip.h wagner.h
	$(CC)  wagner.c

dist.obj:   dist.c phylip.h dist.h
	$(CC)  dist.c

cont.obj:       cont.c cont.h phylip.h
	$(CC)  cont.c

moves.obj:   moves.c phylip.h moves.h
	$(CC)  moves.c

mlclock.obj: mlclock.c mlclock.h phylip.h
	$(CC) mlclock.c

printree.obj: printree.c printree.h phylip.h
	$(CC) printree.c

#
# compile the individual programs
#

clique.obj:       clique.c disc.h phylip.h
	$(CC) -c clique.c

clique.exe:       clique.obj clique.res disc.obj phylip.obj
	 $(LINK) clique.obj disc.obj phylip.obj clique.res $(LFLAGS)

cons.obj:          cons.c cons.h phylip.h 
	$(CC) -c cons.c

consense.obj:     consense.c cons.c cons.h phylip.h
	$(CC) -c consense.c

consense.exe:     consense.obj consense.res phylip.obj cons.obj
	$(LINK) consense.obj phylip.obj cons.obj consense.res $(LFLAGS)

contml.obj:       contml.c cont.h phylip.h
	$(CC) -c contml.c

contml.exe:       contml.obj contml.res cont.obj phylip.obj
	$(LINK) contml.obj cont.obj phylip.obj contml.res $(LFLAGS)

contrast.obj:       contrast.c cont.h phylip.h
	$(CC) -c contrast.c

contrast.exe:       contrast.obj contrast.res cont.obj phylip.obj
	$(LINK) contrast.obj cont.obj phylip.obj contrast.res $(LFLAGS)

dnacomp.obj:      dnacomp.c seq.h phylip.h
	$(CC) -c dnacomp.c

dnacomp.exe:      dnacomp.obj seq.obj phylip.obj dnacomp.res
	$(LINK) dnacomp.obj seq.obj phylip.obj dnacomp.res $(LFLAGS)

dnadist.obj:      dnadist.c seq.h phylip.h
	$(CC) -c dnadist.c

dnadist.exe:      dnadist.obj seq.obj phylip.obj dnadist.res
	$(LINK) dnadist.obj seq.obj phylip.obj dnadist.res $(LFLAGS)

dnainvar.obj:      dnainvar.c seq.h phylip.h
	$(CC) -c dnainvar.c

dnainvar.exe:      dnainvar.obj seq.obj phylip.obj dnainvar.res
	$(LINK) dnainvar.obj seq.obj phylip.obj dnainvar.res $(LFLAGS)

dnaml.obj:      dnaml.c seq.h phylip.h
	$(CC) -c dnaml.c

dnaml.exe:      dnaml.obj seq.obj phylip.obj dnaml.res
	$(LINK) dnaml.obj seq.obj phylip.obj dnaml.res $(LFLAGS)

dnamlk.obj:      dnamlk.c seq.h phylip.h mlclock.h printree.h
	$(CC) -c dnamlk.c

dnamlk.exe:      dnamlk.obj seq.obj phylip.obj mlclock.obj printree.obj dnamlk.res
	$(LINK) dnamlk.obj seq.obj phylip.obj mlclock.obj printree.obj dnamlk.res $(LFLAGS)

dnamove.obj:      dnamove.c seq.h moves.h phylip.h
	$(CC) -c dnamove.c

dnamove.exe:      dnamove.obj seq.obj moves.obj phylip.obj dnamove.res
	$(LINK) dnamove.obj seq.obj moves.obj phylip.obj dnamove.res $(LFLAGS)

dnapenny.obj:      dnapenny.c seq.h phylip.h
	$(CC) -c dnapenny.c

dnapenny.exe:      dnapenny.obj seq.obj phylip.obj dnapenny.res
	$(LINK) dnapenny.obj seq.obj phylip.obj dnapenny.res $(LFLAGS)

dnapars.obj:      dnapars.c seq.h phylip.h
	$(CC) -c dnapars.c

dnapars.exe:      dnapars.obj seq.obj phylip.obj dnapars.res
	$(LINK) dnapars.obj seq.obj phylip.obj dnapars.res $(LFLAGS)

dolmove.obj:       dolmove.c disc.h moves.h dollo.h phylip.h
	$(CC) -c dolmove.c

dolmove.exe:       dolmove.obj disc.obj moves.obj dollo.obj phylip.obj dolmove.res 
	$(LINK) dolmove.obj disc.obj moves.obj dollo.obj phylip.obj dolmove.res $(LFLAGS)

dollop.obj:       dollop.c disc.h dollo.h phylip.h
	$(CC) -c dollop.c

dollop.exe:       dollop.obj disc.obj dollo.obj phylip.obj dollop.res
	$(LINK) dollop.obj disc.obj dollo.obj phylip.obj dollop.res $(LFLAGS)

dolpenny.obj:       dolpenny.c disc.h dollo.h phylip.h
	$(CC) -c dolpenny.c

dolpenny.exe:       dolpenny.obj disc.obj dollo.obj phylip.obj dolpenny.res
	$(LINK) dolpenny.obj disc.obj dollo.obj phylip.obj dolpenny.res $(LFLAGS)

draw.obj:   draw.c draw.h phylip.h 
	$(CC) -c -DWIN32 draw.c

draw2.obj:   draw2.c draw.h phylip.h 
	$(CC) -c -DWIN32 draw2.c

drawgram.obj:     drawgram.c draw.h phylip.h
	$(CC) -c -DWIN32 drawgram.c

drawgram.exe:     drawgram.obj draw.obj draw2.obj phylip.obj drawgram.res
	$(LINK) $(LIBS) drawgram.obj draw.obj draw2.obj phylip.obj drawgram.res $(LFLAGS)

drawtree.obj:     drawtree.c draw.h phylip.h
	$(CC) -c -DWIN32 drawtree.c

drawtree.exe:     drawtree.obj draw.obj draw2.obj phylip.obj drawtree.res
	$(LINK) $(LIBS) drawtree.obj draw.obj draw2.obj phylip.obj drawtree.res $(LFLAGS)

factor.obj:       factor.c phylip.h
	$(CC) -c factor.c

factor.exe:       factor.obj phylip.obj factor.res
	$(LINK) factor.obj phylip.obj factor.res $(LFLAGS)

fitch.obj:        fitch.c dist.h phylip.h
	$(CC) -c fitch.c

fitch.exe:        fitch.obj dist.obj phylip.obj fitch.res
	$(LINK) fitch.obj dist.obj phylip.obj fitch.res $(LFLAGS)

gendist.obj:      gendist.c phylip.h
	$(CC) -c gendist.c

gendist.exe:      gendist.obj phylip.obj gendist.res
	$(LINK) gendist.obj phylip.obj gendist.res $(LFLAGS)

kitsch.obj:        kitsch.c dist.h phylip.h
	$(CC) -c kitsch.c

kitsch.exe:        kitsch.obj dist.obj phylip.obj kitsch.res
	$(LINK) kitsch.obj dist.obj phylip.obj kitsch.res $(LFLAGS)

mix.obj:        mix.c disc.h wagner.h phylip.h
	$(CC) -c mix.c

mix.exe:        mix.obj disc.obj wagner.obj phylip.obj mix.res
	$(LINK) mix.obj disc.obj wagner.obj phylip.obj mix.res $(LFLAGS)

move.obj:        move.c disc.h moves.h wagner.h phylip.h
	$(CC) -c move.c

move.exe:        move.obj disc.obj moves.obj wagner.obj phylip.obj move.res
	$(LINK) move.obj disc.obj moves.obj wagner.obj phylip.obj move.res $(LFLAGS)

neighbor.obj:        neighbor.c dist.h phylip.h
	$(CC) -c neighbor.c

neighbor.exe:        neighbor.obj dist.obj phylip.obj neighbor.res
	$(LINK) neighbor.obj dist.obj phylip.obj neighbor.res $(LFLAGS)

pars.obj:   pars.c discrete.c discrete.h phylip.h
	$(CC) -c pars.c

pars.exe: pars.obj discrete.obj pars.res phylip.obj
	$(LINK) pars.obj discrete.obj phylip.obj pars.res $(LFLAGS)

penny.obj:  penny.c disc.h wagner.h phylip.h
	$(CC) -c penny.c

penny.exe:  penny.obj disc.obj wagner.obj phylip.obj penny.res
	$(LINK) penny.obj disc.obj wagner.obj  phylip.obj penny.res $(LFLAGS)

proml.obj:      proml.c seq.h phylip.h
	$(CC) -c proml.c

proml.exe:      proml.obj seq.obj phylip.obj proml.res
	$(LINK) proml.obj seq.obj phylip.obj proml.res $(LFLAGS)

promlk.obj:      promlk.c seq.h phylip.h mlclock.h printree.h
	$(CC) -c promlk.c

promlk.exe:      promlk.obj seq.obj phylip.obj mlclock.obj printree.obj promlk.res
	$(LINK) promlk.obj seq.obj phylip.obj mlclock.obj printree.obj promlk.res $(LFLAGS)


protdist.obj:      protdist.c seq.h phylip.h
	$(CC) -c protdist.c

protdist.exe:      protdist.obj seq.obj phylip.obj protdist.res
	$(LINK) protdist.obj seq.obj phylip.obj protdist.res $(LFLAGS)

protpars.obj: protpars.c seq.h phylip.h
	$(CC) -c protpars.c

protpars.exe: protpars.obj seq.obj phylip.obj protpars.res
	$(LINK) protpars.obj seq.obj phylip.obj protpars.res $(LFLAGS)

restdist.obj: restdist.c seq.h phylip.h
	 $(CC) -c restdist.c

restdist.exe: restdist.obj restdist.res seq.obj phylip.obj restdist.res
	$(LINK) restdist.obj seq.obj phylip.obj restdist.res $(LFLAGS)

restml.obj: restml.c seq.h phylip.h
	 $(CC) -c restml.c

restml.exe: restml.obj seq.obj phylip.obj restml.res
	$(LINK) restml.obj seq.obj phylip.obj restml.res $(LFLAGS)

retree.obj:       retree.c moves.h phylip.h
	$(CC) -c retree.c

retree.exe:       retree.obj moves.obj phylip.obj retree.res
	$(LINK) retree.obj moves.obj phylip.obj retree.res $(LFLAGS)

seqboot.obj:      seqboot.c phylip.h
	$(CC) -c seqboot.c

seqboot.exe:      seqboot.obj seq.obj phylip.obj seqboot.res
	$(LINK) seqboot.obj seq.obj phylip.obj seqboot.res $(LFLAGS)

treedist.obj:     treedist.c cons.c cons.h phylip.h
	$(CC) -c treedist.c

treedist.exe:     treedist.obj phylip.obj cons.obj treedist.res
	$(LINK) treedist.obj cons.obj phylip.obj treedist.res $(LFLAGS)

protpars.res:     icons\protpars.rcb
	$(RC) /fo protpars.res icons\protpars.rcb

dnapars.res:     icons\dnapars.rcb
	$(RC) /fo dnapars.res icons\dnapars.rcb

dnacomp.res:     icons\dnacomp.rcb
	$(RC) /fo dnacomp.res icons\dnacomp.rcb

dnapenny.res:     icons\dnapenny.rcb
	$(RC) /fo dnapenny.res icons\dnapenny.rcb
	
dnamove.res:     icons\dnamove.rcb
	$(RC) /fo dnamove.res icons\dnamove.rcb

dnainvar.res:     icons\dnainvar.rcb
	$(RC) /fo dnainvar.res icons\dnainvar.rcb

protdist.res:     icons\protdist.rcb
	$(RC) /fo protdist.res icons\protdist.rcb

dnadist.res:     icons\dnadist.rcb
	$(RC) /fo dnadist.res icons\dnadist.rcb

dnaml.res:     icons\dnaml.rcb
	$(RC) /fo dnaml.res icons\dnaml.rcb

dnamlk.res:     icons\dnamlk.rcb
	$(RC) /fo dnamlk.res icons\dnamlk.rcb

proml.res:     icons\proml.rcb
	$(RC) /fo proml.res icons\proml.rcb

promlk.res: icons\promlk.rcb
	$(RC) /fo promlk.res icons\promlk.rcb

seqboot.res:     icons\seqboot.rcb
	$(RC) /fo seqboot.res icons\seqboot.rcb
	
restdist.res:     icons\restdist.rcb
	$(RC) /fo restdist.res icons\restdist.rc

restml.res:     icons\restml.rcb
	$(RC) /fo restml.res icons\restml.rc

fitch.res:     icons\fitch.rcb
	$(RC) /fo fitch.res icons\fitch.rcb

kitsch.res:     icons\kitsch.rcb
	$(RC) /fo kitsch.res icons\kitsch.rcb

neighbor.res:     icons\neighbor.rcb
	$(RC) /fo neighbor.res icons\neighbor.rcb

gendist.res:     icons\gendist.rcb
	$(RC) /fo gendist.res icons\gendist.rcb	

contml.res:     icons\contml.rcb
	$(RC) /fo contml.res icons\contml.rcb

contrast.res:     icons\contrast.rcb
	$(RC) /fo contrast.res icons\contrast.rcb

pars.res:     icons\pars.rcb
	$(RC) /fo pars.res icons\pars.rcb

mix.res:     icons\mix.rcb
	$(RC) /fo mix.res icons\mix.rcb

penny.res:     icons\penny.rcb
	$(RC) /fo penny.res icons\penny.rcb

move.res:     icons\move.rcb
	$(RC) /fo move.res icons\move.rcb

dollop.res:     icons\dollop.rcb
	$(RC) /fo dollop.res icons\dollop.rcb

dolpenny.res:     icons\dolpenny.rcb
	$(RC)  /fo dolpenny.res icons\dolpenny.rcb

dolmove.res:     icons\dolmove.rcb
	$(RC) /fo dolmove.res icons\dolmove.rcb

clique.res:     icons\clique.rcb
	$(RC) /fo clique.res icons\clique.rcb

factor.res:     icons\factor.rcb
	$(RC) /fo factor.res icons\factor.rcb	

drawgram.res:     icons\drawgram.rc
	$(RC) /fo drawgram.res icons/drawgram.rc

drawtree.res:     icons\drawtree.rc
	$(RC) /fo drawtree.res icons\drawtree.rc

consense.res:     icons\consense.rcb
	$(RC) /fo consense.res icons\consense.rcb	

treedist.res:     icons\treedist.rc
	$(RC) /fo treedist.res icons\treedist.rc

retree.res:     icons\retree.rc
	$(RC) /fo retree.res icons\retree.rc
