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/opt/panfs/include
CFLAGS      = @CFLAGS@ $(INCLUDE_DIR)

C_COMPILE_SHL = $(CC_SHL)

@VPATH@

AD_PANFS_OBJECTS = ad_panfs.o ad_panfs_open.o ad_panfs_hints.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_PANFS_OBJECTS)
	$(AR) $(LIBNAME) $(AD_PANFS_OBJECTS)
	$(RANLIB) $(LIBNAME) 

AD_PANFS_LOOBJECTS=$(AD_PANFS_OBJECTS:.o=.lo)
$(SHLIBNAME).la: $(AD_PANFS_LOOBJECTS)
	$(AR) $(SHLIBNAME).la $(AD_PANFS_LOOBJECTS)

coverage:
	-@for file in  ${AD_PANFS_OBJECTS:.o=.c} ; do \
		gcov -b -f $$file ; done

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