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

INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I../../../include -I${srcdir}/../../../mpi-io -I${srcdir}/../../../adio/include -I../../../adio/include -I${srcdir}/../../../../../../src/include  -I../../../../../../src/include 
CFLAGS      = -DHAVE_MPI_INFO_SRC @CPPFLAGS@ @CFLAGS@ $(MPIOPROFILE) $(INCLUDE_DIR)

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

@VPATH@

MPIO_OBJECTS = mpio_file.o mpio_err.o

all: $(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

.c.p:
	@cp $(srcdir)/$*.c _$*.c
	$(CC) $(CFLAGS) -c _$*.c
	@rm -f _$*.c

profile: 
	sleep 1

$(LIBNAME): $(MPIO_OBJECTS)
	$(AR) $(LIBNAME) $(MPIO_OBJECTS)
	$(RANLIB) $(LIBNAME)  

MPIO_LOOBJECTS = $(MPIO_OBJECTS:.o=.lo)
$(SHLIBNAME).la: $(MPIO_LOOBJECTS)
	$(AR) $(SHLIBNAME).la $(MPIO_LOOBJECTS)

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