1# 2# 3# BLIS 4# An object-based framework for developing high-performance BLAS-like 5# libraries. 6# 7# Copyright (C) 2014, The University of Texas at Austin 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions are 11# met: 12# - Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# - Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# - Neither the name(s) of the copyright holder(s) nor the names of its 18# contributors may be used to endorse or promote products derived 19# from this software without specific prior written permission. 20# 21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32# 33# 34 35# 36# Makefile 37# 38# Field G. Van Zee 39# 40# Makefile for BLIS testsuite. 41# 42 43# 44# --- Makefile PHONY target definitions ---------------------------------------- 45# 46 47.PHONY: all bin clean \ 48 check-env check-env-mk check-env-fragments check-env-make-defs \ 49 run run-amd64 run-x86 run-arm 50 51 52 53# 54# --- Determine makefile fragment location ------------------------------------- 55# 56 57# Comments: 58# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. 59# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in 60# the second case because CONFIG_NAME is not yet set. 61ifneq ($(strip $(BLIS_INSTALL_PATH)),) 62LIB_PATH := $(BLIS_INSTALL_PATH)/lib 63INC_PATH := $(BLIS_INSTALL_PATH)/include/blis 64SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis 65else 66DIST_PATH := .. 67LIB_PATH = ../lib/$(CONFIG_NAME) 68INC_PATH = ../include/$(CONFIG_NAME) 69SHARE_PATH := .. 70endif 71 72 73# 74# --- Include common makefile definitions -------------------------------------- 75# 76 77# Include the common makefile fragment. 78-include $(SHARE_PATH)/common.mk 79 80 81 82# 83# --- General build definitions ------------------------------------------------ 84# 85 86TEST_SRC_PATH := src 87TEST_OBJ_PATH := obj 88 89# Gather all local object files. 90TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ 91 $(TEST_OBJ_PATH)/%.o, \ 92 $(wildcard $(TEST_SRC_PATH)/*.c))) 93 94# Override the value of CINCFLAGS so that the value of CFLAGS returned by 95# get-user-cflags-for() is not cluttered up with include paths needed only 96# while building BLIS. 97CINCFLAGS := -I$(INC_PATH) 98 99# Use the "framework" CFLAGS for the configuration family. 100CFLAGS := $(call get-user-cflags-for,$(CONFIG_NAME)) 101 102# Add local header paths to CFLAGS 103CFLAGS += -I$(TEST_SRC_PATH) 104 105# Locate the libblis library to which we will link. 106#LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) 107 108# Binary executable name. 109TESTSUITE_BIN := test_libblis.x 110 111 112 113# 114# --- Targets/rules ------------------------------------------------------------ 115# 116 117# --- Primary targets --- 118 119all: check-env bin 120 121bin: check-env $(TESTSUITE_BIN) 122 123 124# --- Environment check rules --- 125 126check-env: check-env-make-defs check-env-fragments check-env-config-mk 127 128check-env-config-mk: 129ifeq ($(CONFIG_MK_PRESENT),no) 130 $(error Cannot proceed: config.mk not detected! Run configure first) 131endif 132 133check-env-make-defs: check-env-fragments 134ifeq ($(MAKE_DEFS_MK_PRESENT),no) 135 $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) 136endif 137 138 139# --Object file rules -- 140 141$(TEST_OBJ_PATH)/%.o: $(TEST_SRC_PATH)/%.c $(LIBBLIS_LINK) 142ifeq ($(ENABLE_VERBOSE),yes) 143 $(CC) $(CFLAGS) -c $< -o $@ 144else 145 @echo "Compiling $@" 146 @$(CC) $(CFLAGS) -c $< -o $@ 147endif 148 149 150# -- Executable file rules -- 151 152$(TESTSUITE_BIN): $(TEST_OBJS) $(LIBBLIS_LINK) 153ifeq ($(ENABLE_VERBOSE),yes) 154 $(LINKER) $(TEST_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ 155else 156 @echo "Linking $@ against '$(LIBBLIS_LINK) $(LDFLAGS)'" 157 @$(LINKER) $(TEST_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ 158endif 159 160 161# -- Test run/check rules -- 162 163run: $(TESTSUITE_BIN) 164ifeq ($(ENABLE_VERBOSE),yes) 165 ./$(TESTSUITE_BIN) > $(TESTSUITE_OUT_FILE) 166 167else 168 @echo "Running $(TESTSUITE_BIN) with output redirected to '$(TESTSUITE_OUT_FILE)'" 169 @./$(TESTSUITE_BIN) > $(TESTSUITE_OUT_FILE) 170endif 171 172run-fast: $(TESTSUITE_BIN) 173ifeq ($(ENABLE_VERBOSE),yes) 174 ./$(TESTSUITE_BIN) -g $(TESTSUITE_FAST_GEN) -o $(TESTSUITE_FAST_OPS) > $(TESTSUITE_OUT_FILE) 175 176else 177 @echo "Running $(TESTSUITE_BIN) (fast) with output redirected to '$(TESTSUITE_OUT_FILE)'" 178 @./$(TESTSUITE_BIN) -g $(TESTSUITE_FAST_GEN) -o $(TESTSUITE_FAST_OPS) > $(TESTSUITE_OUT_FILE) 179endif 180 181check: run 182ifeq ($(ENABLE_VERBOSE),yes) 183 - $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) 184else 185 @- $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) 186endif 187 188check-fast: run-fast 189ifeq ($(ENABLE_VERBOSE),yes) 190 - $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) 191else 192 @- $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) 193endif 194 195 196# -- Clean rules -- 197 198clean: 199 - $(RM_F) $(TEST_OBJS) $(TESTSUITE_BIN) 200 201