CC          = gcc
AR          = ar cr
LIBNAME     = /proj/tpfimos/larour/Libraries/linux/mpich2-1.0.2p1/lib/libmpich.a
RANLIB      = ranlib
srcdir      = /proj/tpfimos/larour/Libraries/linux/mpich2-1.0.2p1/src/mpi/romio/mpi2-other/info
CC_SHL      = ${CC} -fpic
SHLIBNAME   = /proj/tpfimos/larour/Libraries/linux/mpich2-1.0.2p1/lib/libmpich

INCLUDE_DIR = -I. -I../../include -I${srcdir}/../../mpi-io -I${srcdir}/../../adio/include -I../../adio/include
CFLAGS      = -DHAVE_MPI_INFO_SRC  -O -DFORTRANDOUBLEUNDERSCORE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_ROMIOCONF_H $(MPIOPROFILE) $(INCLUDE_DIR)

top_builddir  = /proj/tpfimos/larour/Libraries/linux/mpich2-1.0.2p1
LIBTOOL       = 
C_COMPILE_SHL = $(CC_SHL)

VPATH = .:${srcdir}

MPIO_OBJECTS = info_create.o info_dup.o info_get.o info_getnth.o \
      info_set.o info_delete.o info_free.o info_getnks.o info_getvln.o \
      info_c2f.o info_f2c.o

MPIO_TMP_POBJECTS = info_create.p info_dup.p info_get.p info_getnth.p \
      info_set.p info_delete.p info_free.p info_getnks.p info_getvln.p \
      info_c2f.p info_f2c.p

MPIO_REAL_POBJECTS = _info_create.o _info_dup.o _info_get.o _info_getnth.o \
      _info_set.o _info_delete.o _info_free.o _info_getnks.o _info_getvln.o \
      _info_c2f.o _info_f2c.o

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

.SUFFIXES: $(SUFFIXES) .p .sp .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

.c.sp:
	$(C_COMPILE_SHL) $(CFLAGS) -c $< -o _$*.lo

profile: $(MPIO_TMP_POBJECTS)
	$(AR) $(LIBNAME) $(MPIO_REAL_POBJECTS)
	$(RANLIB) $(LIBNAME) 
	@if [ "gcc" != "none" ] ; then \
	    $(MAKE) P$(SHLIBNAME).la ;\
	fi
	@rm -f _*.o

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

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

# --------------------------------------------------------------------------
# We use P$(SHLBNAME) simply to distinguish the regular lib build from the
# profiling library build
MPIO_LOPOBJECTS = $(MPIO_REAL_POBJECTS:.o=.lo)
MPIO_TMP_LOPOBJECTS = ${MPIO_TMP_POBJECTS:.p=.sp}
P$(SHLIBNAME).la: $(MPIO_TMP_LOPOBJECTS)
	$(AR) $(SHLIBNAME).la $(MPIO_LOPOBJECTS)
# --------------------------------------------------------------------------

clean:
	@rm -f *.o *.lo
