#################################################################
# Infernal
# src Makefile
# SVN $Id: Makefile,v 3.1 2006/03/07 19:39:54 yzizhen Exp $
#################################################################
#    This copyrighted source code is freely distributed 
#    under the terms of the GNU General Public License. See
#    the files COPYRIGHT and LICENSE for details.
#################################################################

SHELL  = /bin/sh

## your compiler and compiler flags
#
CC     = gcc
CFLAGS = -g -O2

## other defined flags. 
#  DEFS contains stuff that autoconf decides on. 
#  LIBS contains system libraries that the configure script decides we need.
#
DEFS  = -DHAVE_CONFIG_H
LIBS  =  -lm 

## archiving command, and ranlib command if you need one.
#  In general, you shouldn't need to change these, and they're
#  only used for building the testsuite anyway... e.g. we
#  make a "libhmmer.a" library for building the testsuite.
#
AR     = /usr/bin/ar rcv 
RANLIB = ranlib

# Where the build arena is (module .h and .o files)
#
MYLIBS   = -lsquid -leasel
MYLIBDIR = -L../squid -L../easel
MYINCDIR = -I../squid -I../easel

PROGS = cmalign cmbuild cmscore cmsearch

OBJS  = alphabet.o\
	bandcyk.o\
	cm.o\
	cmio.o\
	display.o\
	emit.o\
	emitmap.o\
	globals.o\
	modelconfig.o\
	modelmaker.o\
	parsetree.o\
	prior.o\
	scancyk.o\
	smallcyk.o\
	cm_eweight.o

HDRS  = funcs.h\
	prior.h\
	structs.h

.c.o: 
	$(CC) $(CFLAGS) $(DEFS) $(MYINCDIR) -c $<

#################################################################
## Targets defining how to make INFERNAL executables.
##
all: 	$(PROGS)

$(PROGS): %: %.o $(OBJS) ${HDRS}
	$(CC) $(CFLAGS) $(DEFS) $(MYLIBDIR) -o $@ $@.o $(OBJS) $(MYLIBS) $(LIBS)

#################################################################
## Targets used in making INFERNAL module for testsuite compilation.
##
module: libinfernal.a

libinfernal.a: $(OBJS) ${HDRS}
	$(AR) libinfernal.a $(OBJS)  ../squid/*.o ../easel/*.o
	$(RANLIB) libinfernal.a
	chmod 644 libinfernal.a



#################################################################
## Miscellaneous targets.
##
clean:
	-rm -f *.o *~ Makefile.bak core $(PROGS) TAGS gmon.out libinfernal.a

distclean:
	-rm -f *.o *~ Makefile.bak core $(PROGS) TAGS gmon.out libinfernal.a
	-rm -f Makefile config.h

TAGS:
	etags -t *.c *.h Makefile.in

