Allow lesser Makefiles to reference installed BLIS.

Details:
- Updated the build system so that "lesser" Makefiles, such as those in
  belonging to example code or the testsuite, may be run even if the
  directory is orphaned from the original build tree. This allows a
  user to configure, compile, and install BLIS, delete the build tree
  (that is, the source distribution, or the build directory for out-
  of-tree builds) and then compile example or testsuite code and link
  against the installed copy of BLIS (provided the example or testsuite
  directory was preserved or obtained from another source). The only
  requirement is that make be invoked while setting the
  BLIS_INSTALL_PATH variable to the same installation prefix used when
  BLIS was configured. The easiest syntax is:

    make BLIS_INSTALL_PATH=/install/prefix

  though it's also permissible to set BLIS_INSTALL_PATH as an
  environment variable prior to running 'make'.
- Updated all lesser Makefiles to implement the new aforementioned build
  behavior.
- Relocated check-blastest.sh and check-blistest.sh from build to
  blastest and testsuite, respectively, so that if those directories are
  copied elsewhere the user can still run 'make check' locally.
- Updated docs/Testsuite.md with language that mentions this new option
  of building/linking against an installed copy of BLIS.
This commit is contained in:
Field G. Van Zee
2018-08-25 20:12:36 -05:00
parent 36ff92ce0d
commit 0f491e994a
22 changed files with 583 additions and 511 deletions

View File

@@ -50,66 +50,29 @@
#
# --- Makefile initialization --------------------------------------------------
#
# Define the name of the configuration file.
CONFIG_MK_FILE := config.mk
# Define the name of the file containing build and architecture-specific
# makefile definitions.
MAKE_DEFS_FILE := make_defs.mk
# Locations of important files.
ROOT_PATH := ..
CONFIG_DIR := config
#
# --- Include makefile configuration file --------------------------------------
#
# Construct the path to the makefile configuration file that was generated by
# the configure script.
CONFIG_MK_PATH := $(ROOT_PATH)/$(CONFIG_MK_FILE)
# Include the configuration file.
-include $(CONFIG_MK_PATH)
# Detect whether we actually got the configuration file. If we didn't, then
# it is likely that the user has not yet generated it (via configure).
ifeq ($(strip $(CONFIG_MK_INCLUDED)),yes)
CONFIG_MK_PRESENT := yes
# Comments:
# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given.
# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in
# the second case because CONFIG_NAME is not yet set.
ifneq ($(strip $(BLIS_INSTALL_PATH)),)
LIB_PATH := $(BLIS_INSTALL_PATH)/lib
INC_PATH := $(BLIS_INSTALL_PATH)/include/blis
SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis
else
CONFIG_MK_PRESENT := no
DIST_PATH := ..
LIB_PATH = ../lib/$(CONFIG_NAME)
INC_PATH = ../include/$(CONFIG_NAME)
SHARE_PATH := ..
endif
# Now we have access to CONFIG_NAME, which tells us which sub-directory of the
# config directory to use as our configuration.
CONFIG_PATH := $(ROOT_PATH)/$(CONFIG_DIR)/$(CONFIG_NAME)
#
# --- Include makefile definitions file ----------------------------------------
# --- Include common makefile definitions --------------------------------------
#
# Construct the path to the makefile definitions file residing inside of
# the configuration sub-directory.
MAKE_DEFS_MK_PATH := $(CONFIG_PATH)/$(MAKE_DEFS_FILE)
# Include the makefile definitions file.
-include $(MAKE_DEFS_MK_PATH)
# Detect whether we actually got the make definitios file. If we didn't, then
# it is likely that the configuration is invalid (or incomplete).
ifeq ($(strip $(MAKE_DEFS_MK_INCLUDED)),yes)
MAKE_DEFS_MK_PRESENT := yes
else
MAKE_DEFS_MK_PRESENT := no
endif
# Include the common makefile fragment.
-include $(SHARE_PATH)/common.mk
@@ -117,13 +80,6 @@ endif
# --- BLAS and LAPACK implementations ------------------------------------------
#
# BLIS library and header path. This is simply wherever it was installed.
BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib
BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis
# BLIS library.
BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a
# BLAS library path(s). This is where the BLAS libraries reside.
BLAS_LIB_PATH := $(HOME)/flame/lib
MKL_LIB_PATH := $(HOME)/intel/mkl/lib/intel64/
@@ -166,15 +122,19 @@ TEST_OBJS := $(patsubst $(TEST_SRC_PATH)/%.c, \
$(TEST_OBJ_PATH)/%.o, \
$(wildcard $(TEST_SRC_PATH)/*.c))
# Override CFLAGS from make_defs.mk here, if desired.
#CFLAGS := -g -O2 -march=native
# Override the value of CINCFLAGS so that the value of CFLAGS returned by
# get-frame-cflags-for() is not cluttered up with include paths needed only
# while building BLIS.
CINCFLAGS := -I$(INC_PATH)
# Add installed and local header paths to CFLAGS
CFLAGS += -I$(BLIS_INC_PATH) -I$(TEST_SRC_PATH)
# Use the "framework" CFLAGS for the configuration family.
CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME))
LINKER := $(CC)
#LDFLAGS := -L/home/00146/field/gnu/gcc-4.8.2/lib64
#LDFLAGS += -lgfortran -lm -lpthread
# Add local header paths to CFLAGS
CFLAGS += -I$(TEST_SRC_PATH)
# Locate the libblis library to which we will link.
LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L)
@@ -295,23 +255,23 @@ test_%_blis.o: test_%.c
# compatibility layer. This prevents BLIS from inadvertently getting called
# for the BLAS routines we are trying to test with.
test_%_openblas.x: test_%_openblas.o $(BLIS_LIB)
$(LINKER) $< $(OPENBLAS_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_openblas.x: test_%_openblas.o $(LIBBLIS_LINK)
$(LINKER) $< $(OPENBLAS_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
test_%_atlas.x: test_%_atlas.o $(BLIS_LIB)
$(LINKER) $< $(ATLAS_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_atlas.x: test_%_atlas.o $(LIBBLIS_LINK)
$(LINKER) $< $(ATLAS_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
test_%_mkl.x: test_%_mkl.o $(BLIS_LIB)
$(LINKER) $< $(MKL_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_mkl.x: test_%_mkl.o $(LIBBLIS_LINK)
$(LINKER) $< $(MKL_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
test_%_essl.x: test_%_essl.o $(BLIS_LIB)
$(LINKER) $< $(ESSL_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_essl.x: test_%_essl.o $(LIBBLIS_LINK)
$(LINKER) $< $(ESSL_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
test_%_mac.x: test_%_mac.o $(BLIS_LIB)
$(LINKER) $< $(MAC_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_mac.x: test_%_mac.o $(LIBBLIS_LINK)
$(LINKER) $< $(MAC_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
test_%_blis.x: test_%_blis.o $(BLIS_LIB)
$(LINKER) $< $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_blis.x: test_%_blis.o $(LIBBLIS_LINK)
$(LINKER) $< $(LIBBLIS_LINK) $(LDFLAGS) -o $@
# -- Clean rules --