#
#  Makefile for the SOIF template processing code
#
#  Darren Hardy, hardy@cs.colorado.edu, May 1994
#
#  Makefile.in,v 1.30 1995/11/16 19:26:27 duane Exp
#
prefix = @prefix@
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_UTILDIR	= $(INSTALL_LIBDIR)/gatherer
INSTALL_MANDIR 	= $(prefix)/man

CC		= @CC@
INSTALL		= @INSTALL@
INSTALL_BIN 	= @INSTALL_PROGRAM@
INSTALL_FILE 	= @INSTALL_DATA@
RANLIB		= @RANLIB@
XTRA_LIBS	= @XTRA_LIBS@
LN_S		= @LN_S@

DEBUG		= $(DEBUG_TOP) #-O #-g #-DDEBUG
DEBUG_LIBS	=

CFLAGS		= $(DEBUG) -I../include
OBJS 		= template.o
LIBDIR		= ../lib
LDFLAGS		= -L$(LIBDIR)
LIBS		= -ltemplate -lutil $(DEBUG_LIBS) $(XTRA_LIBS)
LIBFILE		= libtemplate.a
BINS		= cksoif print-attr
SCRIPTS		= mktemplate 

all:	$(LIBFILE) install-lib $(BINS) $(SCRIPTS) soif.pl

$(LIBFILE):	$(OBJS)
	ar r $@ $(OBJS)
	$(RANLIB) $@

clean:
	-rm -f core $(OBJS) $(LIBFILE) $(BINS) *.o 

realclean:
	-rm -f Makefile

install: all
	@for f in $(BINS) $(SCRIPTS); do \
		echo $(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
		$(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
	done
	@for f in soif.pl soif-mem-efficient.pl; do \
		echo $(INSTALL_FILE) $$f $(INSTALL_LIBDIR); \
		$(INSTALL_FILE) $$f $(INSTALL_LIBDIR); \
	done

install-lib:	$(LIBDIR)/$(LIBFILE)

$(LIBDIR)/$(LIBFILE):	$(LIBFILE)
	$(INSTALL_FILE) $(LIBFILE) $(LIBDIR)/$(LIBFILE)
	$(RANLIB) $(LIBDIR)/$(LIBFILE)

cksoif: cksoif.o 
	$(CC) -o $@ $@.o $(LDFLAGS) $(LIBS)

print-attr: print-attr.o 
	$(CC) -o $@ $@.o $(LDFLAGS) $(LIBS)

lsm2soif: lsm2soif.o 
	$(CC) -o $@ $@.o $(LDFLAGS) -lurl $(LIBS) -lgdbm -lmd5 $(XTRA_LIBS)

iafa2soif: iafa2soif.o 
	$(CC) -o $@ $@.o $(LDFLAGS) -lurl $(LIBS) -lgdbm -lmd5 $(XTRA_LIBS)

pcindex2soif: pcindex2soif.o 
	$(CC) -o $@ $@.o $(LDFLAGS) -lurl $(LIBS) -lgdbm -lmd5 $(XTRA_LIBS)

