Sample makefile for the Blue Gene

A simple mid-point rule integration program written in Fortran, C, and C++, along with the makefile, are included in this zip file.

For details of the integration program, see the MPI Tutorial


#
# Makefile to build MPI examples in fortran, C and C++ for Blue Gene/L
#
# For Fortran, the MPI include file is mpif.h
# For C, the MPI include file is mpi.h
# For C++, also needs mpi.h header file (place before stdio.h, iostream.h -- if used):
#   #include mpi.h
#   #include stdio.h
#   #iostream.h
#
# In addition, a -DHAVE_MPI_CXX flag must be included in the compile process
# to turn on the C++ portion in the mpi.h header file.
#
# (08/29/05)
####################
# C
#
# Choose your C complier (blrts_xlc, blrts_gcc, etc)
CC = blrts_xlc

# Choose C options
CCFLAGS = -O3 -qarch=440 -qtune=440

# Add your include directories here
YOUR_C_INCLUDES = -I.

# Add your libraries here (e.g. -Lpath_to_libfoo.a -lfoo)
YOUR_C_LIBS =

####################
# Fortran
#
# Choose your Fortran complier (blrts_xlf, blrts_g77, etc)
F77 = blrts_xlf

# Choose Fortran options
# Note: blrts_g77 requires -fno-underscoring
#
F77FLAGS = -O3 -qarch=440 -qtune=440

# Add your include directories here
YOUR_F77_INCLUDES = -I.

# Add your libraries here (e.g. -Lpath_to_libfoo.a -lfoo)
YOUR_F77_LIBS =

####################
# C++
#
# Choose your C++ complier (blrts_xlC, blrts_g++)
CXX = blrts_xlC

# Choose C++ options
CXXFLAGS = -O3 -qarch=440 -qtune=440

# Add your include directories here
YOUR_CXX_INCLUDES = -I.

# Add your libraries here (e.g. -Lpath_to_libfoo.a -lfoo)
YOUR_CXX_LIBS =

####################
# You are on your own if you change anything in this section .
#
C_LIBS = $(YOUR_C_LIBS) \
	-L/bgl/BlueLight/ppcfloor/bglsys/lib \
	-lmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts

C_INCLUDES = -I/bgl/BlueLight/ppcfloor/bglsys/include \
	$(YOUR_C_INCLUDES)

F77_LIBS = $(YOUR_F77_LIBS) \
	-L/bgl/BlueLight/ppcfloor/bglsys/lib \
	-lmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts

F77_INCLUDES = -I/bgl/BlueLight/ppcfloor/bglsys/include \
	$(YOUR_F77_INCLUDES)

CXX_LIBS = $(YOUR_CXX_LIBS) \
	-L/bgl/BlueLight/ppcfloor/bglsys/lib \
	-lcxxmpich.rts -lmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts

CXX_INCLUDES = -I/bgl/BlueLight/ppcfloor/bglsys/include \
	$(YOUR_CXX_INCLUDES)

####################

PROGS = example1_1f example1_1c example1_1+

default: $(PROGS)

all: $(PROGS)

example1_1f: example1_1f.f
	$(F77) $(F77FLAGS) $(F77_INCLUDES) -o $@  $< $(F77_LIBS)

example1_1c: example1_1c.c
	$(CC) $(CCFLAGS) $(C_INCLUDES) -o $@ $< $(C_LIBS)

example1_1+: example1_1+.C
	$(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -DHAVE_MPI_CXX -o $@ $< $(CXX_LIBS)

clean:
	/bin/rm -f *.o  *~  $(PROGS)