#
#  Makefile for the SOIF template processing code
#
#  Darren Hardy, hardy@cs.colorado.edu, May 1994
#
#  $Id: Makefile.in,v 1.17 1994/11/02 05:27:11 hardy Exp $
#

srcdir = @srcdir@
VPATH  = @srcdir@
prefix = /usr/local/harvest
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_MANDIR 	= $(prefix)/man

SHELL		= /bin/sh
CC		= @CC@
INSTALL		= @INSTALL@
INSTALL_BIN 	= @INSTALL_PROGRAM@
INSTALL_FILE 	= @INSTALL_DATA@
RANLIB		= @RANLIB@
LN_S		= @LN_S@

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

CFLAGS		= -O
INCLUDE		= -I$(srcdir)/../include
ALL_CFLAGS	= $(CFLAGS) $(DEBUG) $(INCLUDE)

.c.o:
		$(CC) -c $(ALL_CFLAGS) $<

OBJS		= template.o
LIBDIR		= ../lib
LDFLAGS               = -L. -L../util
LIBS		= -ltemplate -lutil $(DEBUG_LIBS) $(XTRA_LIBS)
LIBFILE		= libtemplate.a
BINS		= cksoif print-template print-attr \
		lsm2soif iafa2soif pcindex2soif translate-urls
 
all:  $(LIBFILE)

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

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

#realclean:
#	-rm -f Makefile mktemplate

install:	install-lib
	@for f in $(BINS) mktemplate; do \
		echo $(INSTALL_BIN) $$f $(INSTALL_BINDIR); \
		$(INSTALL_BIN) $$f $(INSTALL_BINDIR); \
	done
	-rm -f $(INSTALL_BINDIR)/LSM.unnest
	$(LN_S) $(INSTALL_BINDIR)/lsm2soif $(INSTALL_BINDIR)/LSM.unnest

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

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

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

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

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

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

translate-urls: translate-urls.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)

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

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

