#
# sample makefile
#

# Note to user: Please modify the following three definitions
# to match your configuration of FLAME as well as the location
# of your BLAS library.

# Indicate the path to the BLAS libraries.
#BLAS_PATH       := $(HOME)/flame/lib

# Indicate what BLAS library to use.
BLAS_LIB        := -llapack -lblas -lpthread

# Indicate the FLAME install prefix.
INSTALL_PREFIX  := $(HOME)/flame

# Indicate architecture and version of FLAME to be used.
# Uncomment this out if your FLAME libraries have an architecture
# or version string in their names.
# ARCH_VERS       := _i686-v0.9

# Indicate compiler information.
CC              := gcc
FC              := g77
LINKER          := $(FC)
CFLAGS          := -g
FFLAGS          := 
LDFLAGS         := -lm

#########################################################
# Note to user: You should not need to modify anything below
# this line.

# Indicate the path to the source files.
SRC_PATH        := .

# Indicate where the object files are to be created.
OBJ_PATH        := .

# Indicate where the FLAME libraries reside.
LIB_PATH        := $(INSTALL_PREFIX)/lib

# Indicate where the FLAME include files reside.
INC_PATH        := $(INSTALL_PREFIX)/include

# Indicate the path to the FLAME base library.
FLAME_BASE      := -lflame

# Indicate the path to the FLAME blas library.
FLAME_BLAS      := -llapack2flame

# Indicate the name of the object files.
TEST_OBJS       := gemm_driver.o

# Indicate the name of the binary executable.
TEST_BIN        := gemm_driver.x 

# Add in the include paths to CFLAGS and FFLAGS.
CFLAGS          := -I$(SRC_PATH) -I$(INC_PATH) $(CFLAGS)
FFLAGS          := $(CFLAGS)

# Define the make rule.
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c
	$(CC) $(CFLAGS) -c $< -o $@

# Define the link rule.
gemm_driver.x: $(TEST_OBJS)
	$(LINKER) $(TEST_OBJS) $(LDFLAGS) -L$(INSTALL_LIBS) $(FLAME_BLAS) $(FLAME_BASE) $(BLAS_LIB) -o $(TEST_BIN)

# Define the clean rule.
clean:
	rm -f *.o *~ core *.x

