# Generated automatically from Makefile.in by configure.
# Generated automatically from Makefile.in by configure.
#------------------------------------------------------
# Maximum likelihood estimation 
# of migration rate  and effectice population size
# using importance sampling of correlated genealogies
# a Metropolis-Hastings Monte Carlo algorithm        
# n-population version
# 
# In case you want to change something
# edit Makefile.in and run configure again AND
# notify me, so that I can change the configure script.
# 
# this makefile was produced with configure:
# Makefile.in -> configure -> Makefile
#
# 
#------------------------------------------------------                 
# Peter Beerli 1998, Seattle
# beerli@genetics.washington.edu
#-----------------------------------------------------

.SUFFIXES:
.SUFFIXES: .o .c .h
#######################################################
VERSION = \\\"0.7.1\\\"
#######################################################
prefix = /usr/local
exec_prefix = ${prefix}
INSTALLDIR = ${exec_prefix}/bin #/usr/local/bin
MANPAGEDIR = ${prefix}/man/man1 #/usr/local/man/man1
# Source of manpage migrate.1 -----------------------
MANPAGE = ../documentation/man1/migrate.1

#----------------------------------------------------
CC   =  gcc
INSTALL = /usr/bin/ginstall -c
COMMONFLAGS =  -DHIGHBITS -DHAVE_CONFIG_H -DHAVE_MALLOCWRAP
COMMONVFLAGS =  $(COMMONFLAGS) -DVERSION=$(VERSION)

#CFLAGS = -pg -O3 -Wall -funroll-loops -fexpensive-optimizations $(COMMONVFLAGS)
CFLAGS = -O3 -Wall -funroll-loops -fomit-frame-pointer -fexpensive-optimizations $(COMMONVFLAGS)
# if you have not gcc and want to debug, you need to know
# how to change the cflags yourself: -Wall is not known to all compilers
DEBUGCFLAGS = -g -Wall  $(COMMONFLAGS) -DVERSION=\\\"debug-version\\\"
CHECKERCFLAGS = -g -Wall  $(COMMONFLAGS) -DVERSION=\\\"checker-version\\\"
DMALLOCCFLAGS = -g -DDMALLOC_FUNC_CHECK -Wall -DHIGHBITS -DHAVE_CONFIG_H  -DVERSION=\\\"dmalloc-version\\\"
EFENCEFLAGS = -g -Wall -DHIGHBITS -DHAVE_CONFIG_H -DVERSION=\\\"efence-version\\\"
MEMDEBUGFLAGS = -g -Wall -DHIGHBITS -DHAVE_CONFIG_H -DMEMEDEBUG
OTHERLIBS = -lm
DMALLOCLIBS = -lm -ldmalloc
EFENCELIBS = -lm -lefence
MEMDEBUGLIBS = -lm -lmemdb
WINLIBS =  -luser32 -Wl,--subsystem,console 
#----------------------------------------------------
#
NAME = migrate-n
DMALLOCNAME = mig.dmalloc
EFENCENAME = mig.efence
MEMDEBUGNAME = mig.memdebug
WINNAME = mign.exe

CFILES= broyden.c fst.c menu.c random.c tree.c \
inthp.c sequence.c world.c \
combroyden2.c main.c sighandler.c \
data.c mcmc1.c options.c sort.c \
derivatives.c mcmc2.c profile.c tools.c

HFILES= broyden.h combroyden.h data.h \
definitions.h derivatives.h fst.h integrate.h \
mcmc.h mcmc2.h menu.h migration.h options.h \
parameter.h profile.h random.h sequence.h \
sighandler.h sort.h tools.h tree.h world.h

SOURCEFILES = $(CFILES)
ALLSOURCES = $(CFILES) $(HFILES)
OFILES = $(CFILES:.c=.o)
INSTALL_DEPENDS = $(INSTALLDIR) all 
PRODUCT_DEPENDS = $(OFILES)

.c.o:
	$(CC) $(CFLAGS) -c $*.c -o $*.o
#
#
#
intro::
	@echo "-----------------------------------------------------"
	@echo "                Migrate $(VERSION)"
	@echo "           please read the documentation"
	@echo "      this Makefile will produce an executable"
	@echo "                    migrate-n"
	@echo ""
	@echo "   you need either to copy this file to a location"
	@echo "   where you want to run it, or use"
	@echo "   make install, to install it into /usr/local/bin"
	@echo "   you need to be root to do this, if you don't "
	@echo "   understand all this please talk with your system" 
	@echo "   administrator."
	@echo ""
	@echo "   I am interested in getting email about any "
	@echo "   warning or error mesage you get in the course"
	@echo "   of this compile"
	@echo ""
	@echo "   send comments to"
	@echo "   beerli@genetics.washington.edu"
	@echo "   [Peter Beerli, Seattle, 1999]"
	@echo "----------------------------------------------------"
	$(MAKE) all

all::   
	$(MAKE) $(NAME) "CFLAGS = $(CFLAGS)";

debug::   
	$(MAKE) $(NAME) "CFLAGS = $(DEBUGCFLAGS)";\

win::   
	$(MAKE) $(WINNAME) "CFLAGS = -DDOS $(CFLAGS)";\

efence::   
	$(MAKE) $(EFENCENAME) "CFLAGS = $(EFENCEFLAGS)";\

memdebug::   
	$(MAKE) $(MEMDEBUGNAME) "CFLAGS = $(MEMDEBUGFLAGS)";\

checker::   
	$(MAKE) $(NAME) "CC=checkergcc" "CFLAGS = $(CHECKERCFLAGS)";\

dmalloc::
	$(MAKE) $(DMALLOCNAME) "CFLAGS = $(DMALLOCCFLAGS)";\


install:: $(INSTALL_DEPENDS)
	$(INSTALL) $(IFLAGS) $(NAME) $(INSTALLDIR)
	$(INSTALL) $(IFLAGS) $(MANPAGE) $(MANPAGEDIR)

clean::     
	-/bin/rm -rf  $(GARBAGE) *.o test/migrate test/mathfile \
	test/outfile test/treefile gmon.out migrate-n mig.efence mig.dmalloc \
	migrate-alpha

distclean::      
	/bin/rm -rf  $(GARBAGE) *.o conf.h test/migrate test/mathfile \
	test/outfile test/treefile gmon.out config.cache config.status Makefile $(NAME) *~ *.log migrate-n mig.efence mig.dmalloc migrate-alpha;

zip::
	-/bin/rm -i migrate.tar.gz 
	tar cf -  $(ALLSOURCES) | gzip > migrate.tar.gz

help::
	@echo '  make       (creates the executable)'
	@echo '  make clean (removes all *.o files but not the Makefile)'
	@echo '  make distclean (removes all created files)'
	@echo '  make install (installs the executables and man page)'
	@echo '  make debug (there is more, but first read Makefile)'

#----------------------------------------------------------
#
$(OFILE_DIR) $(INSTALLDIR):
	mkdir $@;

SRCROOT:
	@if [ -n "${$@}" ]; then exit 0; \
	else echo Must define $@; exit 1; fi

$(NAME): $(PRODUCT_DEPENDS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) $(OTHERLIBS) $(LIBS) ;


$(EFENCENAME): $(PRODUCT_DEPENDS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) $(EFENCELIBS) $(LIBS) ;


$(MEMDEBUGNAME): $(PRODUCT_DEPENDS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) $(MEMDEBUGLIBS) $(LIBS) ;


$(DMALLOCNAME): $(PRODUCT_DEPENDS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) $(DMALLOCLIBS) $(LIBS) ;












