CC          = @CC@
AR          = @AR@
RANLIB      = @RANLIB@
LIBNAME     = @LIBNAME@
srcdir      = @srcdir@
CC_SHL      = @CC_SHL@
SHLIBNAME   = @SHLIBNAME@

INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include  -I${srcdir}/../../../../include -I../../../../include
CFLAGS      = @CPPFLAGS@ @CFLAGS@ $(INCLUDE_DIR)

top_builddir  = @master_topbuild_dir@
LIBTOOL       = @LIBTOOL@
C_COMPILE_SHL = $(CC_SHL)

@VPATH@

AD_XFS_OBJECTS = ad_xfs_read.o \
      ad_xfs_open.o ad_xfs_write.o ad_xfs_done.o \
      ad_xfs_fcntl.o ad_xfs_iread.o ad_xfs_iwrite.o ad_xfs_wait.o \
      ad_xfs_resize.o ad_xfs_hints.o \
      ad_xfs.o

default: $(LIBNAME)
	@if [ "@ENABLE_SHLIB@" != "none" ] ; then \
	    $(MAKE) $(SHLIBNAME).la ;\
	fi

.SUFFIXES: $(SUFFIXES) .p .lo

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

.c.lo:
	$(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o
	@mv -f _s$*.o $*.lo

$(LIBNAME): $(AD_XFS_OBJECTS)
	$(AR) $(LIBNAME) $(AD_XFS_OBJECTS)
	$(RANLIB) $(LIBNAME) 

AD_XFS_LOOBJECTS=$(AD_XFS_OBJECTS:.o=.lo)
$(SHLIBNAME).la: $(AD_XFS_LOOBJECTS)
	$(AR) $(SHLIBNAME).la $(AD_XFS_LOOBJECTS)

clean:
	@rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg
	@rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda 
	@rm -f ${srcdir}/*.bb ${srcdir}/*.bbg
