# Makefile for HMMER
# 
##########
# HMMER - Biological sequence analysis with HMMs
# Copyright (C) 1992-1995 Sean R. Eddy
#
#   This source code is distributed under the terms of the 
#   GNU General Public License. See the files COPYING and 
#   LICENSE for details.
#    
###########

## where you want things installed.
#  In general BINDIR and MANDIR are all you need to think about 
#  changing in the Makefile.
#
BINDIR  = ./bin/$(ARCH)
MANDIR  = /usr/local/man
#BINDIR = $(HOME)/bin
#MANDIR = $(HOME)/man

#######
## You only need to change stuff below this if
## you experience compilation difficulties, or if you
## want to change the default compiler or compiler options.
#######

RELEASE     = "1.8.4"
RELEASEDATE = "July 1997"

## your compiler. This must be an ANSI-compliant compiler.
## In particular, SunOS cc is not ANSI. On SunOS, you should use gcc.
##
CC = gcc
#CC = gcc	# GNU cc; especially on SunOS
#CC = fxc       # Alliant FX/2800 

## any special compiler flags you want
##
CFLAGS =  -O4
#CFLAGS = -O -uniproc -w   # Alliant FX/2800

## machine specific definitions
# -DNOSTR                BSD?: no strstr() function
# -DNO_STRDUP            BSD?: no strdup() function
##
MDEFS =                    # Sun SPARC, Silicon Graphics IRIX, DEC Alpha
#MDEFS = -DNO_STRDUP       # Alliant FX/2800

## how to install the man pages 
## either cp -- to copy unformatted man page
## or a script with identical syntax to cp, to format & install formatted page
## Alternatively, you can set INSTMAN to something harmless like
## "echo", and hand-install the man pages.
##
INSTMAN   = cp             # this is fine on most machines 
MANSUFFIX = 1

#######
## You should not need to modify below this line.
#######
SHELL  = /bin/sh
LIBS   = -lm # -lefence

MANS  = zhmmt zhmms zhmmsw zhmmfs zhmmls zhmme zhmm_convert zhmmb

PROGS = zhmmt zhmms zhmmsw zhmmfs zhmmls zhmme zhmm_convert zhmmb
#       align_homologues is unsupported in this release
#       hmm_evolve is unsupported in this release

READMES = COPYING FILES GNULICENSE INSTALL README

HDRS =  config.h zexterns.h zstates.h zversion.h

SQUIDSRC = zaligneval.c zalignio.c zsqerror.c zsqio.c ziupac.c zmsf.c zrevcomp.c\
	zselex.c zsre_ctype.c zsre_math.c zsre_string.c ztypes.c zcluster.c\
	zweight.c zstack.c zdayhoff.c

SQUIDOBJ = zaligneval.o zalignio.o zsqerror.o zsqio.o ziupac.o zmsf.o zrevcomp.o\
	zselex.o zsre_ctype.o zsre_math.o zsre_string.o ztypes.o zcluster.o\
	zweight.o zstack.o zdayhoff.o

SRC =   zalign.c zbuild_main.c zconvert_main.c zdbviterbi.c\
	zalign_homologues.c\
	zemit.c zforback.c zfragviterbi.c zhmma.c zhmme.c zhmmfs.c\
	zhmmio.c zhmmls.c zmaxmodelmaker.c zmisc.c\
	zoutput.c zprofiles.c zprior.c\
	zsaviterbi.c zscorestack.c zsearch.c\
	zstates.c ztrain_main.c zviterbi.c\
	zhmmsw.c zswviterbi.c ztrace.c zweeviterbi.c jtrain_main.c

OBJ =   zalign.o zdbviterbi.o zemit.o zforback.o zfragviterbi.o zhmmio.o \
	zmaxmodelmaker.o zmisc.o zoutput.o zprior.o zprofiles.o\
	zsaviterbi.o  zscorestack.o zstates.o\
	zviterbi.o zswviterbi.o ztrace.o zweeviterbi.o

SQUIDHDRS = zsquid.h zsqfuncs.h


all: 	$(PROGS)

zhmma: 	$(OBJ) $(SQUIDOBJ) zhmma.o
	$(CC) $(CFLAGS) -o zhmma zhmma.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmmb:   $(OBJ) $(SQUIDOBJ) zbuild_main.o
	 $(CC) $(CFLAGS) -o zhmmb  zbuild_main.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmme:   $(OBJ) $(SQUIDOBJ) zhmme.o
	 $(CC) $(CFLAGS) -o zhmme zhmme.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmmfs:  $(OBJ) $(SQUIDOBJ) zhmmfs.o
	 $(CC) $(CFLAGS) -o zhmmfs  zhmmfs.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmmls:  $(OBJ) $(SQUIDOBJ) zhmmls.o
	 $(CC) $(CFLAGS) -o zhmmls  zhmmls.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmms:   $(OBJ) $(SQUIDOBJ) zsearch.o
	 $(CC) $(CFLAGS) -o zhmms  zsearch.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmmsw:  $(OBJ) $(SQUIDOBJ) zhmmsw.o
	 $(CC) $(CFLAGS) -o zhmmsw  zhmmsw.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmmt: 	$(OBJ) $(SQUIDOBJ) ztrain_main.o
	$(CC) $(CFLAGS) -o zhmmt ztrain_main.o $(OBJ) $(SQUIDOBJ) $(LIBS)

#jhmmt: 	$(OBJ) $(SQUIDOBJ) jtrain_main.o
#	$(CC) $(CFLAGS) -o jhmmt jtrain_main.o $(OBJ) $(SQUIDOBJ) $(LIBS)

zhmm_convert: $(OBJ) $(SQUIDOBJ) zconvert_main.o
	$(CC) $(CFLAGS) -o zhmm_convert zconvert_main.o $(OBJ) $(SQUIDOBJ) $(LIBS)

#align_homologues: $(OBJ) $(SQUIDOBJ) align_homologues.o
#	$(CC) $(CFLAGS) -o align_homologues align_homologues.o $(OBJ) $(SQUIDOBJ) $(LIBS)

#test:
#	(cd Testsuite; perl Run_Tests)

install: 
	test -d $(BINDIR) || mkdir -p $(BINDIR)
	test -d $(MANDIR)/man$(MANSUFFIX) || mkdir -p $(MANDIR)/man$(MANSUFFIX)
	cp $(PROGS) $(BINDIR)/
#	for manfile in $(MANS); do\
#	  $(INSTMAN) Man/$$manfile.man $(MANDIR)/man$(MANSUFFIX)/$$manfile.$(MANSUFFIX);\
#	done

#bindist:
#	cp $(PROGS) ../hmmer-$(RELEASE)-bin/

#clean:
#	-rm -f *.o *~ Makefile.bak core $(PROGS) TAGS

#tags:
#	etags -t $(SRC) $(HDRS)

#lint:
#	lint $(SRC) $(SQUIDSRC) -lm 

#.c.o:
#	$(CC) $(CFLAGS) $(MDEFS) -c $<		
