Files
blis/blastest/Makefile
Field G. Van Zee bf03503059 Renamed (shortened) a few build system variables.
Details:
- Renamed the following variables in config.mk (via build/config.mk.in):
    BLIS_ENABLE_VERBOSE_MAKE_OUTPUT -> ENABLE_VERBOSE
    BLIS_ENABLE_STATIC_BUILD        -> MK_ENABLE_STATIC
    BLIS_ENABLE_SHARED_BUILD        -> MK_ENABLE_SHARED
    BLIS_ENABLE_BLAS2BLIS           -> MK_ENABLE_BLAS
    BLIS_ENABLE_CBLAS               -> MK_ENABLE_CBLAS
    BLIS_ENABLE_MEMKIND             -> MK_ENABLE_MEMKIND
  and also renamed all uses of these variables in makefiles and makefile
  fragments. Notice that we use the "MK_" prefix so that those variables
  can be easily differentiated (such as via grep) from their "BLIS_" C
  preprocessor macro counterparts.
- Other whitespace changes to build/config.mk.in.
- Renamed the following C preprocessor macros in bli_config.h (via
  build/bli_config.h.in):
    BLIS_ENABLE_BLAS2BLIS        -> BLIS_ENABLE_BLAS
    BLIS_DISABLE_BLAS2BLIS       -> BLIS_DISABLE_BLAS
    BLIS_BLAS2BLIS_INT_TYPE_SIZE -> BLIS_BLAS_INT_TYPE_SIZE
  and also renamed all relevant uses of these macros in BLIS source
  files.
- Renamed "blas2blis" variable occurrences in configure to "blas", as
  was done in build/config.mk.in and build/bli_config.h.in.
- Renamed the following functions in frame/base/bli_info.c:
    bli_info_get_enable_blas2blis() -> bli_info_get_enable_blas()
    bli_info_get_blas2blis_int_type_size()
                                    -> bli_info_get_blas_int_type_size()
- Remove bli_config.h during 'make cleanh' target of top-level Makefile.
2018-05-08 16:49:22 -05:00

326 lines
8.9 KiB
Makefile

#
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2014, The University of Texas at Austin
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas at Austin nor the names
# of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
#
# Makefile
#
# Field G. Van Zee
#
# Makefile for BLIS testsuite.
#
#
# --- Makefile PHONY target definitions ----------------------------------------
#
.PHONY: all f2c bin \
clean cleanf2c cleanobj cleanbin cleanout \
check-env check-env-mk check-env-fragments check-env-make-defs \
run check
#
# --- Distribution path override -----------------------------------------------
#
# Override the default DIST_PATH and BUILD_PATH values so that make can find
# the source distribution and build location.
DIST_PATH := ..
BUILD_PATH := ..
#
# --- Include common makefile definitions --------------------------------------
#
# Define the name of the common makefile fragment.
COMMON_MK_FILE := common.mk
# Construct the path to the makefile configuration file that was generated by
# the configure script.
COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE)
# Include the common makefile fragment.
-include $(COMMON_MK_PATH)
# Detect whether we actually got the common makefile fragment. If we didn't,
# then it is likely that the user has not yet generated it (via configure).
ifeq ($(strip $(COMMON_MK_INCLUDED)),yes)
COMMON_MK_PRESENT := yes
else
COMMON_MK_PRESENT := no
endif
#
# --- Optional overrides -------------------------------------------------------
#
# Uncomment and modify these definitions if you wish to override the values
# present in the current BLIS configuration's makefile definitions file
# (ie: config/<configname>/make_defs.mk).
# CC := gcc
# LINKER := $(CC)
# CFLAGS := -g -O2 -Wall -Wno-comment
# LDFLAGS :=
# INSTALL_PREFIX := $(HOME)/blis
#
# --- 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_PATH := $(BUILD_PATH)/$(LIB_DIR)/$(CONFIG_NAME)
#BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a
# BLAS library path(s). This is where the BLAS libraries reside.
#BLAS_LIB_PATH := $(HOME)/flame/lib
# OpenBLAS, ATLAS, and MKL libraries.
#BLAS_LIB := $(LIB_PATH)/libblas.a
#BLAS_LIB := $(LIB_PATH)/libgoto.a
#BLAS_LIB := $(LIB_PATH)/libgoto2.a
#OPENBLAS_LIB := $(BLAS_LIB_PATH)/libopenblas.a
#ATLAS_LIB := $(BLAS_LIB_PATH)/libf77blas.a \
# $(BLAS_LIB_PATH)/libatlas.a
#MKL_LIB := -L/opt/intel/mkl/10.2.2.025/lib/em64t/ \
# -lmkl_sequential -lmkl_core -lmkl_intel_lp64
#
# --- General build definitions ------------------------------------------------
#
TEST_OBJ_PATH := obj
F2C_LIB := libf2c.a
F2C_PATH := f2c
DRIVER_PATH := src
BLIS_H_PATH := $(BUILD_PATH)/$(BASE_INC_PATH)
INPUT_DIR := input
# Gather all local object files.
F2C_OBJS := $(sort $(patsubst $(F2C_PATH)/%.c, \
$(TEST_OBJ_PATH)/%.o, \
$(wildcard $(F2C_PATH)/*.c)))
DRIVER_OBJS := $(sort $(patsubst $(DRIVER_PATH)/%.c, \
$(TEST_OBJ_PATH)/%.o, \
$(wildcard $(DRIVER_PATH)/*.c)))
# Extract base names for each test driver file.
DRIVER_BASES := $(basename $(notdir $(DRIVER_OBJS)))
# Binary executable names.
DRIVER_BINS := $(addsuffix .x,$(DRIVER_BASES))
# Binary run-rule names
DRIVER_BINS_R := $(addprefix run-,$(DRIVER_BASES))
# Filter level-1, level-2, and level-3 names to different variables.
DRIVER1_BASES := $(filter %1,$(DRIVER_BASES))
DRIVER2_BASES := $(filter %2,$(DRIVER_BASES))
DRIVER3_BASES := $(filter %3,$(DRIVER_BASES))
# The location of the script that checks the BLAS test output.
BLASTEST_CHECK := $(DIST_PATH)/$(BUILD_DIR)/check-blastest.sh
# Use the CFLAGS for the configuration family.
CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME))
# Suppress warnings about uninitialized functions, add local header
# paths and the path to blis.h to CFLAGS.
CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses \
-I$(F2C_PATH) \
-I$(BUILD_PATH) -DHAVE_BLIS_H
# Locate the libblis library to which we will link.
LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK)
#
# --- Targets/rules ------------------------------------------------------------
#
# --- Primary targets ---
all: check-env f2c bin
f2c: check-env $(F2C_LIB)
bin: check-env $(DRIVER_BINS)
# --- Environment check rules ---
check-env: check-env-make-defs check-env-fragments check-env-mk
check-env-mk:
ifeq ($(CONFIG_MK_PRESENT),no)
$(error Cannot proceed: config.mk not detected! Run configure first)
endif
check-env-fragments: check-env-mk
ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no)
$(error Cannot proceed: makefile fragments not detected! Run configure first)
endif
check-env-make-defs: check-env-fragments
ifeq ($(MAKE_DEFS_MK_PRESENT),no)
$(error Cannot proceed: make_defs.mk not detected! Invalid configuration)
endif
# --Object file rules --
$(TEST_OBJ_PATH)/%.o: $(F2C_PATH)/%.c
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(CFLAGS) -c $< -o $@
else
@echo "Compiling $@"
@$(CC) $(CFLAGS) -c $< -o $@
endif
$(TEST_OBJ_PATH)/%.o: $(DRIVER_PATH)/%.c
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(CFLAGS) -c $< -o $@
else
@echo "Compiling $@"
@$(CC) $(CFLAGS) -c $< -o $@
endif
# -- libf2c library archive rule --
$(F2C_LIB): $(F2C_OBJS)
ifeq ($(ENABLE_VERBOSE),yes)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
else
@echo "Archiving $@"
@$(AR) $(ARFLAGS) $@ $?
@$(RANLIB) $@
endif
# -- Executable file rules --
# first argument: the base name of the BLAS test driver.
define make-blat-rule
$(1).x: $(TEST_OBJ_PATH)/$(1).o $(F2C_LIB) $(LIBBLIS_LINK)
ifeq ($(ENABLE_VERBOSE),yes)
$(LINKER) $(TEST_OBJ_PATH)/$(1).o $(F2C_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $$@
else
@echo "Linking $$@ against '$(F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS)'"
@$(LINKER) $(TEST_OBJ_PATH)/$(1).o $(F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $$@
endif
endef
# Instantiate the rule above for each driver file.
$(foreach name, $(DRIVER_BASES), $(eval $(call make-blat-rule,$(name))))
# -- Test run rules --
run: $(DRIVER_BINS_R)
# A rule to run ?blat1.x driver files.
define make-run-blat1-rule
run-$(1): $(1).x
ifeq ($(ENABLE_VERBOSE),yes)
./$(1).x > out.$(1)
else
@echo "Running $(1).x > 'out.$(1)'"
@./$(1).x > out.$(1)
endif
endef
# Instantiate the rule above for each level-1 driver file.
$(foreach name, $(DRIVER1_BASES), $(eval $(call make-run-blat1-rule,$(name))))
# A rule to run ?blat2.x and ?blat3.x driver files.
define make-run-blat23-rule
run-$(1): $(1).x
ifeq ($(ENABLE_VERBOSE),yes)
./$(1).x < $(INPUT_DIR)/$(1).in
else
@echo "Running $(1).x < '$(INPUT_DIR)/$(1).in' (output to 'out.$(1)')"
@./$(1).x < $(INPUT_DIR)/$(1).in
endif
endef
# Instantiate the rule above for each level-2 driver file.
$(foreach name, $(DRIVER2_BASES), $(eval $(call make-run-blat23-rule,$(name))))
# Instantiate the rule above for each level-3 driver file.
$(foreach name, $(DRIVER3_BASES), $(eval $(call make-run-blat23-rule,$(name))))
check: run
ifeq ($(ENABLE_VERBOSE),yes)
- $(BLASTEST_CHECK)
else
@- $(BLASTEST_CHECK)
endif
# -- Clean rules --
cleanf2c:
- $(RM_F) $(F2C_OBJS) $(F2C_LIB)
cleanobj:
- $(RM_F) $(DRIVER_OBJS)
cleanbin:
- $(RM_F) $(DRIVER_BINS)
cleanout:
- $(RM_F) $(addprefix out.,$(DRIVER_BASES))
clean: cleanf2c cleanobj cleanbin cleanout