#
# Makefile for indexlib directory
# Generated from indexlib/Makefile.in
# Daniel Veillard, 1997
#

@VPATHOPT@= @srcdir@
THOTDIR = @top_srcdir@

include ../Options

INCLUDES= -DHAVE_CONFIG_H -I.. -I@srcdir@/f @THOTINCLUDES@ $(X_FLAGS)

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@

#
# Rule to build objects
#
.c.o :
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

all : libThotIndex

clean :
	$(RM) libThotIndex.a
	$(RM) *.o

install :

uninstall :

include .depends

../tools/mkdep/mkdep : 
	@(cd ../tools/mkdep ; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)")

.depends depend : ../tools/mkdep/mkdep
	../tools/mkdep/mkdep -relative -vpath $(VPATH) $(INCLUDES) $(VPATH)/*.c  > .depends

#########################################################################
#									#
#		Rules to build the library				#
#									#
#########################################################################

INDEX_OBJ = \
	indcharge.o \
	indcree.o \
	indmenu.o \
	indpres.o \
	indtable.o \
	indtri.o

libThotIndex : libThotIndex.a

libThotIndex.a : $(INDEX_OBJ)
	$(AR) libThotIndex.a $(INDEX_OBJ)
	$(RANLIB) libThotIndex.a

CEXTRACT= ../bin/cextract

$(CEXTRACT) :
	@(cd ../tools/cextract-$(CEXTRACT_VER) ; $(MAKE) )

proto : ../bin/cextract
	@(for i in @srcdir@/*.c ; \
	  do \
	  dir=`dirname $$i`;base=`basename $$i .c`; \
	  if [ ! -d $$dir/f ] ; then $(MKDIR) $$dir/f ;fi;\
	  $(CEXTRACT) $(CEXTRACT_FLAGS) -o /tmp/cextract.$$base.$$$$ $$i 2> /dev/null ; \
	  if [ -f $$dir/f/"$$base"_f.h ] ; \
	  then \
	      delta=`$(DIFF) /tmp/cextract.$$base.$$$$ $$dir/f/"$$base"_f.h` ; \
	      if [ "$$delta" != "" ] ; \
	      then \
	          echo "  $$i proto changed" ; \
		  $(MV) /tmp/cextract.$$base.$$$$ $$dir/f/"$$base"_f.h ; \
              else \
	          $(RM) /tmp/cextract.$$base.$$$$ ; \
	      fi ; \
	  else \
	      echo "  $$i proto added" ; \
	      $(MV) /tmp/cextract.$$base.$$$$ $$dir/f/"$$base"_f.h ; \
	  fi ; \
	 done)

