Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
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 # Copyright (C) 2022, Advanced Micro Devices, Inc.
9 #
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions are
12 # met:
13 # - Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # - Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
18 # - Neither the name(s) of the copyright holder(s) nor the names of its
19 # contributors may be used to endorse or promote products derived
20 # from this software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #
34 #
35
36 #
37 # Makefile
38 #
39 # Field G. Van Zee
40 #
41 # Top-level makefile for libflame linear algebra library.
42 #
43 #
44
45 #
46 # --- Makefile PHONY target definitions ----------------------------------------
47 #
48
49 .PHONY: all \
50 libs libblis \
51 check-env check-env-mk check-env-fragments check-env-make-defs \
52 flat-header flat-cblas-header \
53 test \
54 testblas blastest-f2c blastest-bin blastest-run \
55 testsuite testsuite-bin \
56 testsuite-run testsuite-run-fast testsuite-run-md testsuite-run-salt \
57 testblis testblis-fast testblis-md testblis-salt \
58 check checkblas \
59 checkblis checkblis-fast checkblis-md checkblis-salt \
60 install-headers install-helper-headers install-libs install-lib-symlinks \
61 showconfig \
62 clean cleanmk cleanh cleanlib distclean \
63 cleantest cleanblastest cleanblistest \
64 changelog \
65 symbols \
66 install uninstall uninstall-old \
67 uninstall-libs uninstall-lib-symlinks uninstall-headers \
68 uninstall-old-libs uninstall-lib-symlinks uninstall-old-headers
69
70 #
71 # --- Determine makefile fragment location -------------------------------------
72 #
73
74 # Comments:
75 # - We don't need to define DIST_PATH, LIB_PATH, INC_PATH, or SHARE_PATH since
76 # the defaults in common.mk (and config.mk) are designed to work with the
77 # top-level Makefile.
78 #DIST_PATH := .
79 #LIB_PATH = ./lib/$(CONFIG_NAME)
80 #INC_PATH = ./include/$(CONFIG_NAME)
81 #SHARE_PATH := .
82
83
84 #
85 # --- Include common makefile definitions --------------------------------------
86 #
87
88 # Define the name of the common makefile.
89 COMMON_MK_FILE := common.mk
90
91 # Include the configuration file.
92 -include $(COMMON_MK_FILE)
93
94 # Detect whether we actually got the configuration file. If we didn't, then
95 # it is likely that the user has not yet generated it (via configure).
96 ifeq ($(strip $(COMMON_MK_INCLUDED)),yes)
97 COMMON_MK_PRESENT := yes
98 else
99 COMMON_MK_PRESENT := no
100 endif
101
102
103
104 #
105 # --- Main target variable definitions -----------------------------------------
106 #
107
108 # --- Object file paths ---
109
110 # Construct the base object file path for the current configuration.
111 BASE_OBJ_PATH := ./$(OBJ_DIR)/$(CONFIG_NAME)
112
113 # Construct base object file paths corresponding to the four locations
114 # of source code.
115 BASE_OBJ_CONFIG_PATH := $(BASE_OBJ_PATH)/$(CONFIG_DIR)
116 BASE_OBJ_FRAME_PATH := $(BASE_OBJ_PATH)/$(FRAME_DIR)
117 BASE_OBJ_REFKERN_PATH := $(BASE_OBJ_PATH)/$(REFKERN_DIR)
118 BASE_OBJ_KERNELS_PATH := $(BASE_OBJ_PATH)/$(KERNELS_DIR)
119 BASE_OBJ_ADDON_PATH := $(BASE_OBJ_PATH)/$(ADDON_DIR)
120 BASE_OBJ_SANDBOX_PATH := $(BASE_OBJ_PATH)/$(SANDBOX_DIR)
121
122 # --- Define install target names for static libraries ---
123
124 LIBBLIS_A_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_A)
125
126 # --- Define install target names for shared libraries ---
127
128 LIBBLIS_SO_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_SO)
129 LIBBLIS_SO_MAJ_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_SONAME)
130
131 ifeq ($(IS_WIN),yes)
132 # The 'install' target does not create symlinks for Windows builds, so we don't
133 # bother defining LIBBLIS_SO_MMB_INST.
134 LIBBLIS_SO_MMB_INST :=
135 else
136 LIBBLIS_SO_MMB_INST := $(INSTALL_LIBDIR)/$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT)
137 endif
138
139 # --- Determine which libraries to build ---
140
141 MK_LIBS :=
142 MK_LIBS_INST :=
143 MK_LIBS_SYML :=
144
145 ifeq ($(MK_ENABLE_STATIC),yes)
146 MK_LIBS += $(LIBBLIS_A_PATH)
147 MK_LIBS_INST += $(LIBBLIS_A_INST)
148 MK_LIBS_SYML +=
149 endif
150 ifeq ($(MK_ENABLE_SHARED),yes)
151 MK_LIBS += $(LIBBLIS_SO_PATH) \
152 $(LIBBLIS_SO_MAJ_PATH)
153 MK_LIBS_INST += $(LIBBLIS_SO_MMB_INST)
154 MK_LIBS_SYML += $(LIBBLIS_SO_INST) \
155 $(LIBBLIS_SO_MAJ_INST)
156 endif
157
158 # Strip leading, internal, and trailing whitespace.
159 MK_LIBS_INST := $(strip $(MK_LIBS_INST))
160 MK_LIBS_SYML := $(strip $(MK_LIBS_SYML))
161
162 # --- Define install directory for headers ---
163
164 # Set the path to the subdirectory of the include installation directory.
165 MK_INCL_DIR_INST := $(INSTALL_INCDIR)/blis
166
167 # --- Define install directory for public makefile fragments ---
168
169 # Set the path to the subdirectory of the share installation directory.
170 MK_SHARE_DIR_INST := $(INSTALL_SHAREDIR)/blis
171
172 PC_SHARE_DIR_INST := $(INSTALL_SHAREDIR)/pkgconfig
173
174
175 #
176 # --- Library object definitions -----------------------------------------------
177 #
178
179 # In this section, we will isolate the relevant source code filepaths and
180 # convert them to lists of object filepaths. Relevant source code falls into
181 # four categories: configuration source; architecture-specific kernel source;
182 # reference kernel source; and general framework source.
183
184 # $(call gen-obj-paths-from-src file_exts, src_files, base_src_path, base_obj_path)
185 gen-obj-paths-from-src = $(foreach ch, $(1), \
186 $(patsubst $(3)/%.$(ch), \
187 $(4)/%.o, \
188 $(filter %.$(ch), $(2)) ) )
189
190 # Generate object file paths for source code found in the sub-configuration
191 # directories.
192 MK_CONFIG_OBJS := $(call gen-obj-paths-from-src,$(CONFIG_SRC_SUFS),$(MK_CONFIG_SRC),$(CONFIG_PATH),$(BASE_OBJ_CONFIG_PATH))
193
194 # Generate object file paths for architecture-specific kernel source code.
195 # We target only .c, .s, and .S files. Note that MK_KERNELS_SRC is already
196 # limited to the kernel source corresponding to the kernel sets in
197 # KERNEL_LIST. This is because the configure script only propogated makefile
198 # fragments into those specific kernel subdirectories.
199 MK_KERNELS_OBJS := $(call gen-obj-paths-from-src,$(KERNELS_SRC_SUFS),$(MK_KERNELS_SRC),$(KERNELS_PATH),$(BASE_OBJ_KERNELS_PATH))
200
201 # Generate object file paths for reference kernels, with one set of object
202 # files for each sub-configuration in CONFIG_LIST. Note that due to the
203 # nuances of naming the reference kernel files, we can't use the function
204 # gen-obj-paths-from-src as we do above and below.
205 MK_REFKERN_C := $(filter %.c, $(MK_REFKERN_SRC))
206 MK_REFKERN_OBJS := $(foreach arch, $(CONFIG_LIST), \
207 $(patsubst $(REFKERN_PATH)/%_$(REFNM).c, \
208 $(BASE_OBJ_REFKERN_PATH)/$(arch)/%_$(arch)_$(REFNM).o, \
209 $(MK_REFKERN_C) \
210 ) \
211 )
212
213 # Generate object file paths for all of the portable framework source code.
214 MK_FRAME_OBJS := $(call gen-obj-paths-from-src,$(FRAME_SRC_SUFS),$(MK_FRAME_SRC),$(FRAME_PATH),$(BASE_OBJ_FRAME_PATH))
215
216 # Generate object file paths for the addon source code. If one or more addons
217 # were not enabled a configure-time, these variable will we empty.
218 # NOTE: We separate the source and objects into kernel and non-kernel lists.
219 MK_ADDON_KERS_SRC := $(foreach addon, $(ADDON_LIST), \
220 $(filter $(ADDON_PATH)/$(addon)/$(KERNELS_DIR)/%, \
221 $(MK_ADDON_SRC)) \
222 )
223 MK_ADDON_OTHER_SRC := $(foreach addon, $(ADDON_LIST), \
224 $(filter-out $(ADDON_PATH)/$(addon)/$(KERNELS_DIR)/%, \
225 $(MK_ADDON_SRC)) \
226 )
227 MK_ADDON_KERS_OBJS := $(call gen-obj-paths-from-src,$(ADDON_SRC_SUFS),$(MK_ADDON_KERS_SRC),$(ADDON_PATH),$(BASE_OBJ_ADDON_PATH))
228 MK_ADDON_OTHER_OBJS := $(call gen-obj-paths-from-src,$(ADDON_SRC_SUFS),$(MK_ADDON_OTHER_SRC),$(ADDON_PATH),$(BASE_OBJ_ADDON_PATH))
229 MK_ADDON_OBJS := $(MK_ADDON_KERS_OBJS) $(MK_ADDON_OTHER_OBJS)
230
231 # Generate object file paths for the sandbox source code. If a sandbox was not
232 # enabled a configure-time, this variable will we empty.
233 MK_SANDBOX_OBJS := $(call gen-obj-paths-from-src,$(SANDBOX_SRC_SUFS),$(MK_SANDBOX_SRC),$(SANDBOX_PATH),$(BASE_OBJ_SANDBOX_PATH))
234
235 # AMD has chosen to introduce AOCL-specific optimizations to certain BLIS
236 # framework files that are otherwise intended to remain generic. Upstream
237 # developers of vanilla BLIS have agreed to integrate some of these
238 # optimizations, but in a way that keeps the AOCL-specific code segregated
239 # in separate files containing the suffix '_amd'. For example, the BLAS
240 # compatibility layer in vanilla BLIS contains a generic file named
241 # 'bla_gemm.c'. AMD's version of this file is named 'bla_gemm_amd.c'.
242 # Only one or the other is ever built and included in libblis. Currently,
243 # these files are chosen automatically based on the target configuration.
244 ifeq ($(ENABLE_AMD_FRAME_TWEAKS),yes)
245 # Build is being done for AMD platforms; remove the objects which DO NOT have
246 # an "_amd" suffix.
247 MK_FRAME_AMD_OBJS := $(filter $(BASE_OBJ_FRAME_PATH)/%amd.o, $(MK_FRAME_OBJS))
248 FILES_TO_REMOVE := $(subst _amd.o,.o, $(MK_FRAME_AMD_OBJS))
249 MK_FRAME_OBJS := $(filter-out $(FILES_TO_REMOVE), $(MK_FRAME_OBJS))
250 else
251 # Build is being done for non-AMD platforms; remove the objects which DO have
252 # an "_amd" suffix.
253 MK_FRAME_AMD_OBJS := $(filter $(BASE_OBJ_FRAME_PATH)/%amd.o, $(MK_FRAME_OBJS))
254 MK_FRAME_OBJS := $(filter-out $(MK_FRAME_AMD_OBJS), $(MK_FRAME_OBJS))
255 endif
256
257 # Combine all of the object files into some readily-accessible variables.
258 MK_BLIS_OBJS := $(MK_CONFIG_OBJS) \
259 $(MK_KERNELS_OBJS) \
260 $(MK_REFKERN_OBJS) \
261 $(MK_FRAME_OBJS) \
262 $(MK_ADDON_OBJS) \
263 $(MK_SANDBOX_OBJS)
264
265 # Optionally filter out the BLAS and CBLAS compatibility layer object files.
266 # This is not actually necessary, since each affected file is guarded by C
267 # preprocessor macros, but it but prevents "empty" object files from being
268 # added into the library (and reduces compilation time).
269 BASE_OBJ_BLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat
270 BASE_OBJ_CBLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat/cblas
271 ifeq ($(MK_ENABLE_CBLAS),no)
272 MK_BLIS_OBJS := $(filter-out $(BASE_OBJ_CBLAS_PATH)/%.o, $(MK_BLIS_OBJS) )
273 endif
274 ifeq ($(MK_ENABLE_BLAS),no)
275 MK_BLIS_OBJS := $(filter-out $(BASE_OBJ_BLAS_PATH)/%.o, $(MK_BLIS_OBJS) )
276 endif
277
278
279
280 #
281 # --- Monolithic header definitions --------------------------------------------
282 #
283
284 # Define lists of headers to create/install. The default is to only
285 # create/install blis.h.
286 HEADERS_TO_BUILD := $(BLIS_H_FLAT)
287 HEADERS_TO_INSTALL := $(BLIS_H_FLAT)
288
289 # If CBLAS is enabled, we also create/install cblas.h. This allows the user to
290 # continue using #include "cblas.h" in their application, if they wish. (NOTE:
291 # The user can also access CBLAS definitions and function prototypes by
292 # #include'ing "blis.h".)
293 ifeq ($(MK_ENABLE_CBLAS),yes)
294 HEADERS_TO_BUILD += $(CBLAS_H_FLAT)
295 HEADERS_TO_INSTALL += $(CBLAS_H_FLAT)
296 endif
297
298 # If requested, include AMD's C++ template header files in the list of headers
299 # to install.
300 ifeq ($(INSTALL_HH),yes)
301 HEADERS_TO_INSTALL += $(wildcard $(VEND_CPP_PATH)/*.hh)
302 endif
303
304 # Determine that paths of the installed header files
305 HEADERS_INSTALLED := $(foreach hdr,$(HEADERS_TO_INSTALL),$(MK_INCL_DIR_INST)/$(notdir $(hdr)))
306
307 # Define a list of so-called helper headers to install. These helper headers
308 # are very simple headers that go one directory up from INCDIR/blis (which
309 # by default is PREFIX/include/blis, where PREFIX is the install prefix). The
310 # default is to only install the blis.h helper header.
311 HELP_HEADERS_TO_INSTALL := $(HELP_BLIS_H_PATH)
312 HELP_HEADERS_INSTALLED := $(INSTALL_INCDIR)/$(BLIS_H)
313
314 # If CBLAS is enabled, we also install the cblas.h helper header.
315 ifeq ($(MK_ENABLE_CBLAS),yes)
316 HELP_HEADERS_TO_INSTALL += $(HELP_CBLAS_H_PATH)
317 HELP_HEADERS_INSTALLED += $(INSTALL_INCDIR)/$(CBLAS_H)
318 endif
319
320
321
322 #
323 # --- public makefile fragment definitions -------------------------------------
324 #
325
326 # Define a list of makefile fragments to install.
327 FRAGS_TO_INSTALL := $(CONFIG_MK_FILE) \
328 $(COMMON_MK_FILE) \
329 $(DIST_PATH)/build/gen-make-frags/gen-make-frag.sh \
330 $(DIST_PATH)/build/gen-make-frags/fragment.mk \
331 $(DIST_PATH)/build/gen-make-frags/ignore_list \
332 $(DIST_PATH)/build/gen-make-frags/special_list \
333 $(DIST_PATH)/build/gen-make-frags/suffix_list \
334 $(DIST_PATH)/build/flatten-headers.py \
335 $(DIST_PATH)/build/mirror-tree.sh \
336 $(DIST_PATH)/config_registry \
337 $(DIST_PATH)/build/detect/iset/avx.s \
338 $(DIST_PATH)/build/detect/iset/avx512dq.s \
339 $(DIST_PATH)/build/detect/iset/avx512f.s \
340 $(DIST_PATH)/build/detect/iset/fma3.s \
341 $(DIST_PATH)/build/detect/iset/fma4.s
342
343 # Define a list of plugin makefile fragments to install.
344 PLUGIN_FRAGS_TO_INSTALL := $(DIST_PATH)/build/plugin/bli_plugin_init_ref.c \
345 $(DIST_PATH)/build/plugin/bli_plugin_init_zen3.c \
346 $(DIST_PATH)/build/plugin/bli_plugin_register.c \
347 $(DIST_PATH)/build/plugin/my_kernel_1_ref.c \
348 $(DIST_PATH)/build/plugin/my_kernel_2_ref.c \
349 $(DIST_PATH)/build/plugin/my_kernel_1_zen3.c \
350 $(DIST_PATH)/build/plugin/bli_plugin.h.in \
351 $(DIST_PATH)/build/plugin/config.mk.in \
352 $(DIST_PATH)/build/plugin/Makefile
353
354 PC_IN_FILE := blis.pc.in
355 PC_OUT_FILE := blis.pc
356
357
358 #
359 # --- BLAS test drivers definitions --------------------------------------------
360 #
361
362 # The location of the BLAS test suite's input files.
363 BLASTEST_INPUT_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/input
364
365 # The location of the BLAS test suite object directory.
366 BASE_OBJ_BLASTEST_PATH := $(BASE_OBJ_PATH)/$(BLASTEST_DIR)
367
368 # The locations of the BLAS test suite source code (f2c and drivers).
369 BLASTEST_F2C_SRC_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/f2c
370 BLASTEST_DRV_SRC_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/src
371
372 # The paths to object files we will create (f2c and drivers).
373 BLASTEST_F2C_OBJS := $(sort \
374 $(patsubst $(BLASTEST_F2C_SRC_PATH)/%.c, \
375 $(BASE_OBJ_BLASTEST_PATH)/%.o, \
376 $(wildcard $(BLASTEST_F2C_SRC_PATH)/*.c)) \
377 )
378
379 BLASTEST_DRV_OBJS := $(sort \
380 $(patsubst $(BLASTEST_DRV_SRC_PATH)/%.c, \
381 $(BASE_OBJ_BLASTEST_PATH)/%.o, \
382 $(wildcard $(BLASTEST_DRV_SRC_PATH)/*.c)) \
383 )
384
385 # libf2c name and location.
386 BLASTEST_F2C_LIB_NAME := libf2c.a
387 BLASTEST_F2C_LIB := $(BASE_OBJ_BLASTEST_PATH)/$(BLASTEST_F2C_LIB_NAME)
388
389 # The base names of each driver source file (ie: filename minus suffix).
390 BLASTEST_DRV_BASES := $(basename $(notdir $(BLASTEST_DRV_OBJS)))
391
392 # The binary executable driver names.
393 BLASTEST_DRV_BINS := $(addsuffix .x,$(BLASTEST_DRV_BASES))
394 BLASTEST_DRV_BIN_PATHS := $(addprefix $(BASE_OBJ_BLASTEST_PATH)/,$(BLASTEST_DRV_BINS))
395
396 # Binary executable driver "run-" names
397 BLASTEST_DRV_BINS_R := $(addprefix run-,$(BLASTEST_DRV_BASES))
398
399 # Filter level-1, level-2, and level-3 names to different variables.
400 BLASTEST_DRV1_BASES := $(filter %1,$(BLASTEST_DRV_BASES))
401 BLASTEST_DRV2_BASES := $(filter %2,$(BLASTEST_DRV_BASES))
402 BLASTEST_DRV3_BASES := $(filter %3,$(BLASTEST_DRV_BASES))
403
404 # Define some CFLAGS that we'll only use when compiling BLAS test suite
405 # files.
406 BLAT_CFLAGS := -Wno-parentheses \
407 -I$(BLASTEST_F2C_SRC_PATH) \
408 -I. -DHAVE_BLIS_H
409
410 # Suppress warnings about possibly uninitialized variables for the BLAS
411 # test driver code (as output from f2c), which is riddled with such
412 # variables, but only if the option to do so is supported.
413 ifeq ($(CC_VENDOR),gcc)
414 BLAT_CFLAGS += -Wno-maybe-uninitialized
415 endif
416
417 # The location of the script that checks the BLAS test output.
418 BLASTEST_CHECK_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/$(BLASTEST_CHECK)
419
420
421 #
422 # --- BLIS testsuite definitions -----------------------------------------------
423 #
424
425 # The location of the test suite's general and operations-specific
426 # input/configuration files.
427 TESTSUITE_CONF_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CONF_GEN)
428 TESTSUITE_CONF_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CONF_OPS)
429 TESTSUITE_FAST_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_FAST_GEN)
430 TESTSUITE_FAST_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_FAST_OPS)
431 TESTSUITE_MIXD_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_MIXD_GEN)
432 TESTSUITE_MIXD_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_MIXD_OPS)
433 TESTSUITE_SALT_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_SALT_GEN)
434 TESTSUITE_SALT_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_SALT_OPS)
435
436 # The locations of the test suite source directory and the local object
437 # directory.
438 TESTSUITE_SRC_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/src
439 BASE_OBJ_TESTSUITE_PATH := $(BASE_OBJ_PATH)/$(TESTSUITE_DIR)
440
441 # Convert source file paths to object file paths by replacing the base source
442 # directories with the base object directories, and also replacing the source
443 # file suffix (eg: '.c') with '.o'.
444 MK_TESTSUITE_OBJS := $(sort \
445 $(patsubst $(TESTSUITE_SRC_PATH)/%.c, \
446 $(BASE_OBJ_TESTSUITE_PATH)/%.o, \
447 $(wildcard $(TESTSUITE_SRC_PATH)/*.c)) \
448 )
449
450 # The test suite binary executable filename.
451 # NOTE: The TESTSUITE_WRAPPER variable defaults to the empty string if it
452 # is not already set, in which case it has no effect lateron when the
453 # testsuite binary is executed via lines such as
454 #
455 # $(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) ... > $(TESTSUITE_OUT_FILE)
456 #
457 # The reason TESTSUITE_WRAPPER is employed in this way is so that some
458 # unusual environments (e.g. ARM) can run the testsuite through some other
459 # binary. See .travis.yml for details on how the variable is employed in
460 # practice.
461 TESTSUITE_BIN := test_$(LIBBLIS).x
462 TESTSUITE_WRAPPER ?=
463
464 # The location of the script that checks the BLIS testsuite output.
465 TESTSUITE_CHECK_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CHECK)
466
467
468
469 #
470 # --- Uninstall definitions ----------------------------------------------------
471 #
472
473 ifeq ($(IS_CONFIGURED),yes)
474
475 # These shell commands gather the filepaths to any library in the current
476 # LIBDIR that might be left over from an old installation. We start with
477 # including nothing for static libraries, since older static libraries are
478 # always overwritten by newer ones. Then we add shared libraries, which are
479 # named with three .so version numbers.
480 UNINSTALL_OLD_LIBS :=
481
482 UNINSTALL_OLD_LIBS += $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?.?.?))
483
484 # These shell commands gather the filepaths to any library symlink in the
485 # current LIBDIR that might be left over from an old installation. We start
486 # with symlinks named using the .so major version number.
487 UNINSTALL_OLD_SYML := $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS_SO).$(SO_MAJOR),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?))
488
489 # We also prepare to uninstall older-style symlinks whose names contain the
490 # BLIS version number and configuration family.
491 UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.a)
492 UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.$(SHLIB_EXT))
493
494 # This shell command grabs all files named "*.h" that are not blis.h or cblas.h
495 # in the installation directory. We consider this set of headers to be "old" and
496 # eligible for removal upon running of the uninstall-old-headers target.
497 UNINSTALL_OLD_HEADERS := $(filter-out %/$(BLIS_H),$(filter-out %/$(CBLAS_H),$(wildcard $(INSTALL_INCDIR)/blis/*.h)))
498
499 endif # IS_CONFIGURED
500
501
502 #
503 # --- Targets/rules ------------------------------------------------------------
504 #
505
506 # --- Primary targets ---
507
508 all: libs
509
510 libs: libblis
511
512 test: checkblis checkblas
513
514 check: checkblis-fast checkblas
515
516 install: libs install-libs install-lib-symlinks install-headers install-share
517
518 uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers uninstall-share
519
520 uninstall-old: uninstall-old-libs uninstall-old-symlinks uninstall-old-headers
521
522 clean: cleanh cleanlib
523
524
525 # --- Environment check rules ---
526
527 check-env: check-env-make-defs check-env-fragments check-env-mk
528
529 check-env-mk:
530 ifeq ($(CONFIG_MK_PRESENT),no)
531 $(error Cannot proceed: config.mk not detected! Run configure first)
532 endif
533
534 check-env-fragments: check-env-mk
535 ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no)
536 $(error Cannot proceed: makefile fragments not detected! Run configure first)
537 endif
538
539 check-env-make-defs: check-env-fragments
540 ifeq ($(ALL_MAKE_DEFS_MK_PRESENT),no)
541 $(error Cannot proceed: Some make_defs.mk files not found or mislabeled!)
542 endif
543
544
545 # --- Shared/dynamic libblis symbol file creation/refresh ---
546
547 symbols: check-env $(SYM_FILE)
548
549 $(SYM_FILE): $(HEADERS_TO_INSTALL)
550 ifeq ($(ENABLE_VERBOSE),yes)
551 $(GEN_SYMS) > $(SYM_FILE)
552 else
553 @echo "Updating $(SYM_FILE)"
554 @$(GEN_SYMS) > $(SYM_FILE)
555 endif
556
557
558 # --- Consolidated blis.h header creation ---
559
560 flat-header: check-env $(BLIS_H_FLAT)
561
562 $(BLIS_H_FLAT): $(ALL_H99_FILES)
563 ifeq ($(ENABLE_VERBOSE),yes)
564 $(FLATTEN_H) -l -v1 $(BLIS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
565 else
566 @echo -n "Generating monolithic blis.h"
567 @$(FLATTEN_H) -l -v1 $(BLIS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
568 @echo "Generated $@"
569 endif
570
571 # --- Consolidated cblas.h header creation ---
572
573 flat-cblas-header: check-env $(CBLAS_H_FLAT)
574
575 # Note that the flattened blis.h is a prerequisite of flattening cblas.h. This
576 # is done so that the two headers are built sequentially even when using
577 # 'make -j[n]'. Otherwise, the output from the two processes can become
578 # interleaved, which looks awkward/confusing.
579 $(CBLAS_H_FLAT): $(FRAME_H99_FILES) $(BLIS_H_FLAT)
580 ifeq ($(ENABLE_VERBOSE),yes)
581 $(FLATTEN_H) -l -v1 $(CBLAS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
582 else
583 @echo -n "Generating monolithic cblas.h"
584 @$(FLATTEN_H) -l -v1 $(CBLAS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
585 @echo "Generated $@"
586 endif
587
588
589 # --- General source code / object code rules ---
590
591 # FGVZ: Add support for compiling .s and .S files in 'config'/'kernels'
592 # directories.
593 # - May want to add an extra foreach loop around function eval/call.
594
595 # first argument: a configuration name from config_list, used to look up the
596 # CFLAGS to use during compilation.
597 define make-config-rule
598 $(BASE_OBJ_CONFIG_PATH)/$(1)/%.o: $(CONFIG_PATH)/$(1)/%.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
599 ifeq ($(ENABLE_VERBOSE),yes)
600 $(CC) $(call get-config-cflags-for,$(1)) -c $$< -o $$@
601 else
602 @echo "Compiling $$@" $(call get-config-text-for,$(1))
603 @$(CC) $(call get-config-cflags-for,$(1)) -c $$< -o $$@
604 endif
605 endef
606
607 # first argument: a configuration name from the union of config_list and
608 # config_name, used to look up the CFLAGS to use during compilation.
609 define make-frame-rule
610 $(BASE_OBJ_FRAME_PATH)/%.o: $(FRAME_PATH)/%.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
611 ifeq ($(ENABLE_VERBOSE),yes)
612 $(CC) $(call get-frame-cflags-for,$(1)) -c $$< -o $$@
613 else
614 @echo "Compiling $$@" $(call get-frame-text-for,$(1))
615 @$(CC) $(call get-frame-cflags-for,$(1)) -c $$< -o $$@
616 endif
617
618 ifneq ($(findstring hpx,$(THREADING_MODEL)),)
619 $(BASE_OBJ_FRAME_PATH)/%.o: $(FRAME_PATH)/%.cpp $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
620 ifeq ($(ENABLE_VERBOSE),yes)
621 $(CXX) $(call get-frame-cxxflags-for,$(1)) -c $$< -o $$@
622 else
623 @echo "Compiling $$@" $(call get-frame-cxxtext-for,$(1))
624 @$(CXX) $(call get-frame-cxxflags-for,$(1)) -c $$< -o $$@
625 endif
626 endif
627 endef
628
629 # first argument: a kernel set (name) being targeted (e.g. haswell).
630 define make-refinit-rule
631 $(BASE_OBJ_REFKERN_PATH)/$(1)/bli_cntx_$(1)_ref.o: $(REFKERN_PATH)/bli_cntx_ref.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
632 ifeq ($(ENABLE_VERBOSE),yes)
633 $(CC) $(call get-refinit-cflags-for,$(1)) -c $$< -o $$@
634 else
635 @echo "Compiling $$@" $(call get-refinit-text-for,$(1))
636 @$(CC) $(call get-refinit-cflags-for,$(1)) -c $$< -o $$@
637 endif
638 endef
639
640 # first argument: a kernel set (name) being targeted (e.g. haswell).
641 define make-refkern-rule
642 $(BASE_OBJ_REFKERN_PATH)/$(1)/%_$(1)_ref.o: $(REFKERN_PATH)/%_ref.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
643 ifeq ($(ENABLE_VERBOSE),yes)
644 $(CC) $(call get-refkern-cflags-for,$(1)) -c $$< -o $$@
645 else
646 @echo "Compiling $$@" $(call get-refkern-text-for,$(1))
647 @$(CC) $(call get-refkern-cflags-for,$(1)) -c $$< -o $$@
648 endif
649 endef
650
651 # first argument: a kernel set (name) being targeted (e.g. haswell).
652 # second argument: the configuration whose CFLAGS we should use in compilation.
653 # third argument: the kernel file suffix being considered.
654 define make-kernels-rule
655 $(BASE_OBJ_KERNELS_PATH)/$(1)/%.o: $(KERNELS_PATH)/$(1)/%.$(3) $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
656 ifeq ($(ENABLE_VERBOSE),yes)
657 $(CC) $(call get-kernel-cflags-for,$(2)) -c $$< -o $$@
658 else
659 @echo "Compiling $$@" $(call get-kernel-text-for,$(2))
660 @$(CC) $(call get-kernel-cflags-for,$(2)) -c $$< -o $$@
661 endif
662 endef
663
664 # first argument: a configuration name from the union of config_list and
665 # config_name, used to look up the CFLAGS to use during compilation.
666 # second argument: the C99 addon file suffix being considered.
667 define make-c99-addon-rule
668 $(BASE_OBJ_ADDON_PATH)/%.o: $(ADDON_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_H99_FILES) $(MAKE_DEFS_MK_PATHS)
669 ifeq ($(ENABLE_VERBOSE),yes)
670 $(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
671 else
672 @echo "Compiling $$@" $(call get-addon-c99text-for,$(1))
673 @$(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
674 endif
675 endef
676
677 # first argument: a configuration name from the union of config_list and
678 # config_name, used to look up the CFLAGS to use during compilation.
679 # second argument: the C99 addon file suffix being considered.
680 # third argument: the name of the addon being considered.
681 define make-c99-addon-kers-rule
682 $(BASE_OBJ_ADDON_PATH)/$(3)/$(KERNELS_DIR)/%.o: $(ADDON_PATH)/$(3)/$(KERNELS_DIR)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_H99_FILES) $(MAKE_DEFS_MK_PATHS)
683 ifeq ($(ENABLE_VERBOSE),yes)
684 $(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
685 else
686 @echo "Compiling $$@" $(call get-addon-kernel-text-for,$(1))
687 @$(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
688 endif
689 endef
690
691 # first argument: a configuration name from the union of config_list and
692 # config_name, used to look up the CFLAGS to use during compilation.
693 # second argument: the C++ addon file suffix being considered.
694 define make-cxx-addon-rule
695 $(BASE_OBJ_ADDON_PATH)/%.o: $(ADDON_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_HXX_FILES) $(MAKE_DEFS_MK_PATHS)
696 ifeq ($(ENABLE_VERBOSE),yes)
697 $(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
698 else
699 @echo "Compiling $$@" $(call get-addon-cxxtext-for,$(1))
700 @$(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
701 endif
702 endef
703
704 # first argument: a configuration name from the union of config_list and
705 # config_name, used to look up the CFLAGS to use during compilation.
706 # second argument: the C99 sandbox file suffix being considered.
707 define make-c99-sandbox-rule
708 $(BASE_OBJ_SANDBOX_PATH)/%.o: $(SANDBOX_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(SANDBOX_H99_FILES) $(MAKE_DEFS_MK_PATHS)
709 ifeq ($(ENABLE_VERBOSE),yes)
710 $(CC) $(call get-sandbox-c99flags-for,$(1)) -c $$< -o $$@
711 else
712 @echo "Compiling $$@" $(call get-sandbox-c99text-for,$(1))
713 @$(CC) $(call get-sandbox-c99flags-for,$(1)) -c $$< -o $$@
714 endif
715 endef
716
717 # first argument: a configuration name from the union of config_list and
718 # config_name, used to look up the CFLAGS to use during compilation.
719 # second argument: the C++ sandbox file suffix being considered.
720 define make-cxx-sandbox-rule
721 $(BASE_OBJ_SANDBOX_PATH)/%.o: $(SANDBOX_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(SANDBOX_HXX_FILES) $(MAKE_DEFS_MK_PATHS)
722 ifeq ($(ENABLE_VERBOSE),yes)
723 $(CXX) $(call get-sandbox-cxxflags-for,$(1)) -c $$< -o $$@
724 else
725 @echo "Compiling $$@" $(call get-sandbox-cxxtext-for,$(1))
726 @$(CXX) $(call get-sandbox-cxxflags-for,$(1)) -c $$< -o $$@
727 endif
728 endef
729
730 # Define functions to choose the correct sub-configuration name for the
731 # given kernel set. This function is called when instantiating the
732 # make-kernels-rule.
733 get-config-for-kset = $(lastword $(subst :, ,$(filter $(1):%,$(KCONFIG_MAP))))
734
735 # Instantiate the build rule for files in the configuration directory for
736 # each of the sub-configurations in CONFIG_LIST with the CFLAGS designated
737 # for that sub-configuration.
738 $(foreach conf, $(CONFIG_LIST), $(eval $(call make-config-rule,$(conf))))
739
740 # Instantiate the build rule for framework files. Use the CFLAGS for the
741 # configuration family, which exists in the directory whose name is equal to
742 # CONFIG_NAME. Note that this doesn't need to be in a loop since we expect
743 # CONFIG_NAME to only ever contain a single name. (BTW: If CONFIG_NAME refers
744 # to a singleton family, then CONFIG_LIST contains CONFIG_NAME as its only
745 # item.)
746 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-frame-rule,$(conf))))
747
748 # Instantiate the build rule for reference kernel initialization and
749 # reference kernels for each of the sub-configurations in CONFIG_LIST with
750 # the CFLAGS designated for that sub-configuration.
751 $(foreach conf, $(CONFIG_LIST), $(eval $(call make-refinit-rule,$(conf))))
752 $(foreach conf, $(CONFIG_LIST), $(eval $(call make-refkern-rule,$(conf))))
753
754 # Instantiate the build rule for optimized kernels for each of the kernel
755 # sets in KERNEL_LIST with the CFLAGS designated for the sub-configuration
756 # specified by the KCONFIG_MAP.
757 $(foreach suf, $(KERNELS_SRC_SUFS), \
758 $(foreach kset, $(KERNEL_LIST), $(eval $(call make-kernels-rule,$(kset),$(call get-config-for-kset,$(kset)),$(suf)))))
759
760 # Instantiate the build rule for C addon files. Use the CFLAGS for the
761 # configuration family.
762 $(foreach suf, $(ADDON_C99_SUFS), \
763 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-rule,$(conf),$(suf)))))
764
765 # Instantiate the build rule for C addon/kernels files. Use the CFLAGS for the
766 # configuration family.
767 $(foreach addon, $(ADDON_LIST), \
768 $(foreach suf, $(ADDON_C99_SUFS), \
769 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-kers-rule,$(conf),$(suf),$(addon))))))
770
771 # Instantiate the build rule for C++ addon files. Use the CFLAGS for the
772 # configuration family.
773 $(foreach suf, $(ADDON_CXX_SUFS), \
774 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-cxx-addon-rule,$(conf),$(suf)))))
775
776 # Instantiate the build rule for C sandbox files. Use the CFLAGS for the
777 # configuration family.
778 $(foreach suf, $(SANDBOX_C99_SUFS), \
779 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-sandbox-rule,$(conf),$(suf)))))
780
781 # Instantiate the build rule for C++ sandbox files. Use the CXXFLAGS for the
782 # configuration family.
783 $(foreach suf, $(SANDBOX_CXX_SUFS), \
784 $(foreach conf, $(CONFIG_NAME), $(eval $(call make-cxx-sandbox-rule,$(conf),$(suf)))))
785
786
787 # --- All-purpose library rule (static and shared) ---
788
789 libblis: check-env $(MK_LIBS)
790
791
792 # --- Static library archiver rules ---
793
794 $(LIBBLIS_A_PATH): $(MK_BLIS_OBJS)
795 ifeq ($(ENABLE_VERBOSE),yes)
796 ifeq ($(ARG_MAX_HACK),yes)
797 $(file > [email protected],$^)
798 $(AR) $(ARFLAGS) $@ @[email protected]
799 $(RM_F) [email protected]
800 $(RANLIB) $@
801 else
802 $(AR) $(ARFLAGS) $@ $?
803 $(RANLIB) $@
804 endif
805 else # ifeq ($(ENABLE_VERBOSE),no)
806 ifeq ($(ARG_MAX_HACK),yes)
807 @echo "Archiving $@"
808 @$(file > [email protected],$^)
809 @$(AR) $(ARFLAGS) $@ @[email protected]
810 @$(RM_F) [email protected]
811 @$(RANLIB) $@
812 else
813 @echo "Archiving $@"
814 @$(AR) $(ARFLAGS) $@ $?
815 @$(RANLIB) $@
816 endif
817 endif
818
819
820 # --- Shared library linker rules ---
821
822 $(LIBBLIS_SO_PATH): $(MK_BLIS_OBJS)
823 ifeq ($(ENABLE_VERBOSE),yes)
824 ifeq ($(ARG_MAX_HACK),yes)
825 $(file > [email protected],$^)
826 $(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) @[email protected] $(LDFLAGS)
827 $(RM_F) [email protected]
828 else
829 $(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) $^ $(LDFLAGS)
830 endif
831 else # ifeq ($(ENABLE_VERBOSE),no)
832 ifeq ($(ARG_MAX_HACK),yes)
833 @echo "Dynamically linking $@"
834 @$(file > [email protected],$^)
835 @$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) @[email protected] $(LDFLAGS)
836 @$(RM_F) [email protected]
837 else
838 @echo "Dynamically linking $@"
839 @$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) $^ $(LDFLAGS)
840 endif
841 endif
842
843 # Local symlink for shared library.
844 # NOTE: We use a '.loc' suffix to avoid filename collisions in case this
845 # rule is executed concurrently with the install-lib-symlinks rule, which
846 # also creates symlinks in the current directory (before installing them).
847 # NOTE: We don't create any symlinks during Windows builds.
848 $(LIBBLIS_SO_MAJ_PATH): $(LIBBLIS_SO_PATH)
849 ifeq ($(IS_WIN),no)
850 ifeq ($(ENABLE_VERBOSE),yes)
851 $(SYMLINK) $(<F) $(@F).loc
852 $(MV) $(@F).loc $(BASE_LIB_PATH)/$(@F)
853 else # ifeq ($(ENABLE_VERBOSE),no)
854 @echo "Creating symlink $@"
855 @$(SYMLINK) $(<F) $(@F).loc
856 @$(MV) $(@F).loc $(BASE_LIB_PATH)/$(@F)
857 endif
858 endif
859
860
861 # --- BLAS test suite rules ---
862
863 testblas: blastest-run
864
865 blastest-f2c: check-env $(BLASTEST_F2C_LIB)
866
867 blastest-bin: check-env blastest-f2c $(BLASTEST_DRV_BIN_PATHS)
868
869 blastest-run: $(BLASTEST_DRV_BINS_R)
870
871 # f2c object file rule.
872 $(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_F2C_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
873 ifeq ($(ENABLE_VERBOSE),yes)
874 $(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
875 else
876 @echo "Compiling $@"
877 @$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
878 endif
879
880 # driver object file rule.
881 $(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_DRV_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
882 ifeq ($(ENABLE_VERBOSE),yes)
883 $(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
884 else
885 @echo "Compiling $@"
886 @$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
887 endif
888
889 # libf2c library archive rule.
890 $(BLASTEST_F2C_LIB): $(BLASTEST_F2C_OBJS)
891 ifeq ($(ENABLE_VERBOSE),yes)
892 $(AR) $(ARFLAGS) $@ $?
893 $(RANLIB) $@
894 else
895 @echo "Archiving $@"
896 @$(AR) $(ARFLAGS) $@ $?
897 @$(RANLIB) $@
898 endif
899
900 $(BASE_OBJ_BLASTEST_PATH)/%.x: $(BASE_OBJ_BLASTEST_PATH)/%.o $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK)
901 ifeq ($(ENABLE_VERBOSE),yes)
902 $(LINKER) $< $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
903 else
904 @echo "Linking $@ against '$(notdir $(BLASTEST_F2C_LIB)) $(LIBBLIS_LINK) "$(LDFLAGS)"'"
905 @$(LINKER) $< $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
906 endif
907
908 # A rule to run ?blat1.x driver files.
909 define make-run-blat1-rule
910 run-$(1): $(BASE_OBJ_BLASTEST_PATH)/$(1).x
911 ifeq ($(ENABLE_VERBOSE),yes)
912 $(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x > out.$(1)
913 else
914 @echo "Running $(1).x > 'out.$(1)'"
915 @$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x > out.$(1)
916 endif
917 endef
918
919 # Instantiate the rule above for each level-1 driver file.
920 $(foreach name, $(BLASTEST_DRV1_BASES), $(eval $(call make-run-blat1-rule,$(name))))
921
922 # A rule to run ?blat2.x and ?blat3.x driver files.
923 define make-run-blat23-rule
924 run-$(1): $(BASE_OBJ_BLASTEST_PATH)/$(1).x
925 ifeq ($(ENABLE_VERBOSE),yes)
926 $(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x < $(BLASTEST_INPUT_PATH)/$(1).in
927 else
928 @echo "Running $(1).x < '$(BLASTEST_INPUT_PATH)/$(1).in' (output to 'out.$(1)')"
929 @$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x < $(BLASTEST_INPUT_PATH)/$(1).in
930 endif
931 endef
932
933 # Instantiate the rule above for each level-2 driver file.
934 $(foreach name, $(BLASTEST_DRV2_BASES), $(eval $(call make-run-blat23-rule,$(name))))
935
936 # Instantiate the rule above for each level-3 driver file.
937 $(foreach name, $(BLASTEST_DRV3_BASES), $(eval $(call make-run-blat23-rule,$(name))))
938
939 # Check the results of the BLAS test suite drivers.
940 checkblas: blastest-run
941 ifeq ($(ENABLE_VERBOSE),yes)
942 - $(BLASTEST_CHECK_PATH)
943 else
944 @- $(BLASTEST_CHECK_PATH)
945 endif
946
947 # --- BLIS test suite rules ---
948
949 testblis: testsuite
950
951 testblis-fast: testsuite-run-fast
952
953 testblis-md: testsuite-run-md
954
955 testblis-salt: testsuite-run-salt
956
957 testsuite: testsuite-run
958
959 testsuite-bin: check-env $(TESTSUITE_BIN)
960
961 # Object file rule.
962 $(BASE_OBJ_TESTSUITE_PATH)/%.o: $(TESTSUITE_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
963 ifeq ($(ENABLE_VERBOSE),yes)
964 $(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) -c $< -o $@
965 else
966 @echo "Compiling $@"
967 @$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) -c $< -o $@
968 endif
969
970 # Testsuite binary rule.
971 $(TESTSUITE_BIN): $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK)
972 ifeq ($(ENABLE_VERBOSE),yes)
973 $(LINKER) $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
974 else
975 @echo "Linking $@ against '$(LIBBLIS_LINK) "$(LDFLAGS)"'"
976 @$(LINKER) $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
977 endif
978
979 # Template rule for running the testsuite with given input files.
980 define make-run-testsuite-rule
981 $(1): testsuite-bin
982 ifeq ($(ENABLE_TEST_OUTPUT),yes)
983 ifeq ($(ENABLE_VERBOSE),yes)
984 $(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(2) -o $(3) \
985 | tee $(TESTSUITE_OUT_FILE)
986
987 else
988 @echo "Running $(TESTSUITE_BIN) with output echoed and redirected to '$(TESTSUITE_OUT_FILE)'"
989 @$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(2) -o $(3) \
990 | tee $(TESTSUITE_OUT_FILE)
991 endif
992 else
993 ifeq ($(ENABLE_VERBOSE),yes)
994 $(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(2) -o $(3) \
995 > $(TESTSUITE_OUT_FILE)
996
997 else
998 @echo "Running $(TESTSUITE_BIN) with output redirected to '$(TESTSUITE_OUT_FILE)'"
999 @$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(2) -o $(3) \
1000 > $(TESTSUITE_OUT_FILE)
1001 endif
1002 endif
1003 endef
1004
1005 # A rule to run the testsuite using the normal input.* files.
1006 $(eval $(call make-run-testsuite-rule, testsuite-run, $(TESTSUITE_CONF_GEN_PATH), $(TESTSUITE_CONF_OPS_PATH)))
1007
1008 # A rule to run the testsuite using the input.*.fast files, which
1009 # run a set of tests designed to finish much more quickly.
1010 $(eval $(call make-run-testsuite-rule, testsuite-run-fast, $(TESTSUITE_FAST_GEN_PATH), $(TESTSUITE_FAST_OPS_PATH)))
1011
1012 # A rule to run the testsuite using the input.*.md files, which
1013 # run a set of tests designed to only exercise mixed-datatype gemm.
1014 $(eval $(call make-run-testsuite-rule, testsuite-run-md, $(TESTSUITE_MIXD_GEN_PATH), $(TESTSUITE_MIXD_OPS_PATH)))
1015
1016 # A rule to run the testsuite using the input.*.salt files, which
1017 # simulates application-level threading across operation tests.
1018 $(eval $(call make-run-testsuite-rule, testsuite-run-salt, $(TESTSUITE_SALT_GEN_PATH), $(TESTSUITE_SALT_OPS_PATH)))
1019
1020 # Check the results of the BLIS testsuite.
1021 checkblis: testsuite-run
1022 ifeq ($(ENABLE_VERBOSE),yes)
1023 - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1024 else
1025 @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1026 endif
1027
1028 # Check the results of the BLIS testsuite (fast).
1029 checkblis-fast: testsuite-run-fast
1030 ifeq ($(ENABLE_VERBOSE),yes)
1031 - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1032 else
1033 @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1034 endif
1035
1036 # Check the results of the BLIS testsuite (mixed-datatype).
1037 checkblis-md: testsuite-run-md
1038 ifeq ($(ENABLE_VERBOSE),yes)
1039 - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1040 else
1041 @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1042 endif
1043
1044 # Check the results of the BLIS testsuite (salt).
1045 checkblis-salt: testsuite-run-salt
1046 ifeq ($(ENABLE_VERBOSE),yes)
1047 - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1048 else
1049 @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE)
1050 endif
1051
1052
1053 # --- AMD's C++ template header test rules ---
1054
1055 # NOTE: The targets below won't work as intended for an out-of-tree build,
1056 # and so it's disabled for now.
1057
1058 #testcpp: testvendcpp
1059
1060 # Recursively run the test for AMD's C++ template header.
1061 #testvendcpp:
1062 # $(MAKE) -C $(VEND_TESTCPP_PATH)
1063
1064
1065 # --- Install header rules ---
1066
1067 install-headers: check-env $(HEADERS_INSTALLED) install-helper-headers
1068
1069 # Rule for installing main headers.
1070 $(MK_INCL_DIR_INST)/%.h: $(BASE_INC_PATH)/%.h $(CONFIG_MK_FILE)
1071 ifeq ($(ENABLE_VERBOSE),yes)
1072 $(MKDIR) $(dir $(@))
1073 $(INSTALL) -m 0644 $(<) $(dir $(@))
1074 else
1075 @$(MKDIR) $(dir $(@))
1076 @echo "Installing $(notdir $(<)) into $(dir $(@))/"
1077 @$(INSTALL) -m 0644 $(<) $(dir $(@))
1078 endif
1079
1080 $(MK_INCL_DIR_INST)/%.hh: $(VEND_CPP_PATH)/%.hh $(CONFIG_MK_FILE)
1081 ifeq ($(ENABLE_VERBOSE),yes)
1082 $(MKDIR) $(dir $(@))
1083 $(INSTALL) -m 0644 $(<) $(dir $(@))
1084 else
1085 @$(MKDIR) $(dir $(@))
1086 @echo "Installing $(notdir $(<)) into $(dir $(@))/"
1087 @$(INSTALL) -m 0644 $(<) $(dir $(@))
1088 endif
1089
1090 install-helper-headers: check-env $(HELP_HEADERS_INSTALLED)
1091
1092 # A rule to install a helper header file.
1093 define make-helper-header-rule
1094 $(INSTALL_INCDIR)/$(notdir $(1)): $(BUILD_PATH)/$(notdir $(1)) $(CONFIG_MK_FILE)
1095 ifeq ($(ENABLE_VERBOSE),yes)
1096 $(MKDIR) $(INSTALL_INCDIR)
1097 $(INSTALL) -m 0644 $$(<) $$(@)
1098 else
1099 @$(MKDIR) $(INSTALL_INCDIR)
1100 @echo "Installing $$(@F) helper header into $(INSTALL_INCDIR)/"
1101 @$(INSTALL) -m 0644 $$(<) $$(@)
1102 endif
1103 endef
1104
1105 # Instantiate the rule above for each helper header file to install.
1106 $(foreach h, $(HELP_HEADERS_TO_INSTALL), $(eval $(call make-helper-header-rule,$(h))))
1107
1108 # --- Install share rules ---
1109
1110 install-share: check-env $(MK_SHARE_DIR_INST) $(PC_SHARE_DIR_INST)
1111
1112 $(MK_SHARE_DIR_INST): $(CONFIGURE_FILE) $(FRAGS_TO_INSTALL) $(PLUGIN_FRAGS_TO_INSTALL) $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE)
1113 ifeq ($(ENABLE_VERBOSE),yes)
1114 $(MKDIR) $(@)
1115 $(MKDIR) $(@)/plugin
1116 $(INSTALL) -m 0755 $(filter %.sh,$(FRAGS_TO_INSTALL)) $(@)
1117 $(INSTALL) -m 0644 $(filter-out %.sh,$(FRAGS_TO_INSTALL)) $(@)
1118 $(INSTALL) -m 0644 $(PLUGIN_FRAGS_TO_INSTALL) $(@)/plugin
1119 $(INSTALL) -m 0755 $(CONFIGURE_FILE) $(@)/configure-plugin
1120 # $(MKDIR) -p $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)
1121 # $(INSTALL) -m 0644 $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) \
1122 # $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)
1123 for THIS_CONFIG in $(FULL_CONFIG_LIST); do \
1124 $(MKDIR) -p $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1125 $(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) \
1126 $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1127 $(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h \
1128 $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1129 done
1130 else
1131 @$(MKDIR) $(@)
1132 @$(MKDIR) $(@)/plugin
1133 @echo "Installing $(notdir $(FRAGS_TO_INSTALL)) into $(@)/"
1134 @$(INSTALL) -m 0755 $(filter %.sh,$(FRAGS_TO_INSTALL)) $(@)
1135 @$(INSTALL) -m 0644 $(filter-out %.sh,$(FRAGS_TO_INSTALL)) $(@)
1136 @echo "Installing $(notdir $(PLUGIN_FRAGS_TO_INSTALL)) into $(@)/plugin/"
1137 @$(INSTALL) -m 0644 $(PLUGIN_FRAGS_TO_INSTALL) $(@)/plugin
1138 @echo "Installing $(CONFIGURE_FILE) into $(@)/configure-plugin"
1139 @$(INSTALL) -m 0755 $(CONFIGURE_FILE) $(@)/configure-plugin
1140 # @$(MKDIR) -p $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)#\
1141 # @echo "Installing $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) into $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)"
1142 # @$(INSTALL) -m 0644 $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) \
1143 # $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)/
1144 @for THIS_CONFIG in $(FULL_CONFIG_LIST); do \
1145 $(MKDIR) -p $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1146 echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) into $(@)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
1147 $(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) \
1148 $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1149 echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h into $(@)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
1150 $(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h \
1151 $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
1152 done
1153 endif
1154
1155 $(PC_SHARE_DIR_INST): $(PC_IN_FILE)
1156 ifeq ($(ENABLE_VERBOSE),yes)
1157 $(MKDIR) $(@)
1158 $(shell cat "$(PC_IN_FILE)" \
1159 | sed -e "s#@PACKAGE_VERSION@#$(VERSION)#g" \
1160 | sed -e "s#@prefix@#$(prefix)#g" \
1161 | sed -e "s#@exec_prefix@#$(exec_prefix)#g" \
1162 | sed -e "s#@libdir@#$(libdir)#g" \
1163 | sed -e "s#@includedir@#$(includedir)#g" \
1164 | sed -e "s#@LDFLAGS@#$(LDFLAGS)#g" \
1165 > "$(PC_OUT_FILE)" )
1166 $(INSTALL) -m 0644 $(PC_OUT_FILE) $(@)
1167 else
1168 @$(MKDIR) $(@)
1169 @echo "Installing $(PC_OUT_FILE) into $(@)/"
1170 @$(shell cat "$(PC_IN_FILE)" \
1171 | sed -e "s#@PACKAGE_VERSION@#$(VERSION)#g" \
1172 | sed -e "s#@prefix@#$(prefix)#g" \
1173 | sed -e "s#@exec_prefix@#$(exec_prefix)#g" \
1174 | sed -e "s#@libdir@#$(libdir)#g" \
1175 | sed -e "s#@includedir@#$(includedir)#g" \
1176 | sed -e "s#@LDFLAGS@#$(LDFLAGS)#g" \
1177 > "$(PC_OUT_FILE)" )
1178 @$(INSTALL) -m 0644 $(PC_OUT_FILE) $(@)
1179 endif
1180
1181 # --- Install library rules ---
1182
1183 install-libs: check-env $(MK_LIBS_INST)
1184
1185 # Install static library.
1186 $(INSTALL_LIBDIR)/%.a: $(BASE_LIB_PATH)/%.a $(CONFIG_MK_FILE)
1187 ifeq ($(ENABLE_VERBOSE),yes)
1188 $(MKDIR) $(@D)
1189 $(INSTALL) -m 0644 $< $@
1190 else
1191 @echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
1192 @$(MKDIR) $(@D)
1193 @$(INSTALL) -m 0644 $< $@
1194 endif
1195
1196 # Install shared library containing .so major, minor, and build versions.
1197 # Note: Installation rules for Windows does not include major, minor, and
1198 # build version numbers.
1199 ifeq ($(IS_WIN),no)
1200
1201 # Linux/OSX library (.so OR .dylib) installation rules.
1202 $(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MMB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT) $(CONFIG_MK_FILE)
1203 ifeq ($(ENABLE_VERBOSE),yes)
1204 $(MKDIR) $(@D)
1205 $(INSTALL) -m 0755 $< $@
1206 else
1207 @echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
1208 @$(MKDIR) $(@D)
1209 @$(INSTALL) -m 0755 $< $@
1210 endif
1211
1212 else # ifeq ($(IS_WIN),yes)
1213
1214 # Windows library (.dll and .lib) installation rules.
1215 $(INSTALL_LIBDIR)/%.$(SHLIB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT)
1216 ifeq ($(ENABLE_VERBOSE),yes)
1217 @$(MKDIR) $(@D)
1218 @$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
1219 else
1220 @echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
1221 @$(MKDIR) $(@D)
1222 @$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
1223 endif
1224
1225 $(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MAJ_EXT): $(BASE_LIB_PATH)/%.$(LIBBLIS_SO_MAJ_EXT)
1226 ifeq ($(ENABLE_VERBOSE),yes)
1227 @$(MKDIR) $(@D)
1228 @$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
1229 else
1230 @echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
1231 @$(MKDIR) $(@D)
1232 @$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
1233 endif
1234
1235 endif # ifeq ($(IS_WIN),no)
1236
1237 # --- Install-symlinks rules ---
1238
1239 install-lib-symlinks: check-env $(MK_LIBS_SYML)
1240
1241 # Note: Symlinks are not installed on Windows.
1242 ifeq ($(IS_WIN),no)
1243
1244 # Install generic shared library symlink.
1245 $(INSTALL_LIBDIR)/%.$(SHLIB_EXT): $(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MMB_EXT)
1246 ifeq ($(ENABLE_VERBOSE),yes)
1247 $(SYMLINK) $(<F) $(@F)
1248 $(MV) $(@F) $(INSTALL_LIBDIR)/
1249 else
1250 @echo "Installing symlink $(@F) into $(INSTALL_LIBDIR)/"
1251 @$(SYMLINK) $(<F) $(@F)
1252 @$(MV) $(@F) $(INSTALL_LIBDIR)/
1253 endif
1254
1255 # Install shared library symlink containing only .so major version.
1256 $(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MAJ_EXT): $(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MMB_EXT)
1257 ifeq ($(ENABLE_VERBOSE),yes)
1258 $(SYMLINK) $(<F) $(@F)
1259 $(MV) $(@F) $(INSTALL_LIBDIR)/
1260 else
1261 @echo "Installing symlink $(@F) into $(INSTALL_LIBDIR)/"
1262 @$(SYMLINK) $(<F) $(@F)
1263 @$(MV) $(@F) $(INSTALL_LIBDIR)/
1264 endif
1265
1266 endif # ifeq ($(IS_WIN),no)
1267
1268 # --- Query current configuration ---
1269
1270 showconfig: check-env
1271 @echo "configuration family: $(CONFIG_NAME)"
1272 @echo "sub-configurations: $(CONFIG_LIST)"
1273 @echo "requisite kernels sets: $(KERNEL_LIST)"
1274 @echo "kernel-to-config map: $(KCONFIG_MAP)"
1275 @echo "-------------------------"
1276 @echo "BLIS version string: $(VERSION)"
1277 @echo ".so major version: $(SO_MAJOR)"
1278 @echo ".so minor.build vers: $(SO_MINORB)"
1279 @echo "install libdir: $(INSTALL_LIBDIR)"
1280 @echo "install includedir: $(INSTALL_INCDIR)"
1281 @echo "install sharedir: $(INSTALL_SHAREDIR)"
1282 @echo "debugging status: $(DEBUG_TYPE)"
1283 @echo "enable AddressSanitizer? $(MK_ENABLE_ASAN)"
1284 @echo "enabled threading model(s): $(THREADING_MODEL)"
1285 @echo "enable BLAS API? $(MK_ENABLE_BLAS)"
1286 @echo "enable CBLAS API? $(MK_ENABLE_CBLAS)"
1287 @echo "build static library? $(MK_ENABLE_STATIC)"
1288 @echo "build shared library? $(MK_ENABLE_SHARED)"
1289 @echo "ARG_MAX hack enabled? $(ARG_MAX_HACK)"
1290
1291
1292 # --- Clean rules ---
1293
1294 cleanmk:
1295 ifeq ($(IS_CONFIGURED),yes)
1296 ifeq ($(ENABLE_VERBOSE),yes)
1297 - $(FIND) $(CONFIG_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1298 - $(FIND) $(FRAME_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1299 - $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1300 - $(FIND) $(KERNELS_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1301 ifneq ($(ADDON_LIST),)
1302 - $(FIND) $(ADDON_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1303 endif
1304 ifneq ($(SANDBOX),)
1305 - $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1306 endif
1307 else
1308 @echo "Removing makefile fragments from $(CONFIG_FRAG_PATH)"
1309 @- $(FIND) $(CONFIG_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1310 @echo "Removing makefile fragments from $(FRAME_FRAG_PATH)"
1311 @- $(FIND) $(FRAME_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1312 @echo "Removing makefile fragments from $(REFKERN_FRAG_PATH)"
1313 @- $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1314 @echo "Removing makefile fragments from $(KERNELS_FRAG_PATH)"
1315 @- $(FIND) $(KERNELS_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1316 ifneq ($(ADDON_LIST),)
1317 @echo "Removing makefile fragments from $(ADDON_FRAG_PATH)"
1318 @- $(FIND) $(ADDON_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1319 endif
1320 ifneq ($(SANDBOX),)
1321 @echo "Removing makefile fragments from $(SANDBOX_FRAG_PATH)"
1322 @- $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1323 endif
1324 endif
1325 endif
1326
1327 cleanh:
1328 ifeq ($(IS_CONFIGURED),yes)
1329 ifeq ($(ENABLE_VERBOSE),yes)
1330 $(RM_F) $(BLIS_H_FLAT)
1331 $(RM_F) $(CBLAS_H_FLAT)
1332 else
1333 @echo "Removing flattened header files from $(BASE_INC_PATH)"
1334 @$(RM_F) $(BLIS_H_FLAT)
1335 @$(RM_F) $(CBLAS_H_FLAT)
1336 endif
1337 endif
1338
1339 cleanlib:
1340 ifeq ($(IS_CONFIGURED),yes)
1341 ifeq ($(ENABLE_VERBOSE),yes)
1342 - $(FIND) $(BASE_OBJ_PATH) -name "*.o" | $(XARGS) $(RM_F)
1343 - $(RM_F) $(LIBBLIS_A_PATH)
1344 - $(RM_F) $(LIBBLIS_SO_PATH)
1345 else
1346 @echo "Removing object files from $(BASE_OBJ_PATH)"
1347 @- $(FIND) $(BASE_OBJ_PATH) -name "*.o" | $(XARGS) $(RM_F)
1348 @echo "Removing libraries from $(BASE_LIB_PATH)"
1349 @- $(RM_F) $(LIBBLIS_A_PATH)
1350 @- $(RM_F) $(LIBBLIS_SO_PATH)
1351 endif
1352 endif
1353
1354 cleantest: cleanblastest cleanblistest
1355
1356 ifeq ($(BUILDING_OOT),no)
1357 cleanblastest: cleanblastesttop cleanblastestdir
1358 else
1359 cleanblastest: cleanblastesttop
1360 endif
1361
1362 cleanblastesttop:
1363 ifeq ($(IS_CONFIGURED),yes)
1364 ifeq ($(ENABLE_VERBOSE),yes)
1365 - $(RM_F) $(BLASTEST_F2C_OBJS) $(BLASTEST_DRV_OBJS)
1366 - $(RM_F) $(BLASTEST_F2C_LIB)
1367 - $(RM_F) $(BLASTEST_DRV_BIN_PATHS)
1368 - $(RM_F) $(addprefix out.,$(BLASTEST_DRV_BASES))
1369 else
1370 @echo "Removing object files from $(BASE_OBJ_BLASTEST_PATH)"
1371 @- $(RM_F) $(BLASTEST_F2C_OBJS) $(BLASTEST_DRV_OBJS)
1372 @echo "Removing libf2c.a from $(BASE_OBJ_BLASTEST_PATH)"
1373 @- $(RM_F) $(BLASTEST_F2C_LIB)
1374 @echo "Removing binaries from $(BASE_OBJ_BLASTEST_PATH)"
1375 @- $(RM_F) $(BLASTEST_DRV_BIN_PATHS)
1376 @echo "Removing driver output files 'out.*'"
1377 @- $(RM_F) $(addprefix out.,$(BLASTEST_DRV_BASES))
1378 endif # ENABLE_VERBOSE
1379 endif # IS_CONFIGURED
1380
1381 cleanblastestdir:
1382 ifeq ($(IS_CONFIGURED),yes)
1383 ifeq ($(ENABLE_VERBOSE),yes)
1384 - $(FIND) $(BLASTEST_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
1385 - $(FIND) $(BLASTEST_DIR) -name "*.x" | $(XARGS) $(RM_F)
1386 - $(RM_F) $(BLASTEST_DIR)/$(BLASTEST_F2C_LIB_NAME)
1387 - $(RM_F) $(addprefix $(BLASTEST_DIR)/out.,$(BLASTEST_DRV_BASES))
1388 else
1389 @echo "Removing object files from ./$(BLASTEST_DIR)/$(OBJ_DIR)"
1390 @- $(FIND) $(BLASTEST_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
1391 @echo "Removing libf2c.a from ./$(BLASTEST_DIR)"
1392 @- $(RM_F) $(BLASTEST_DIR)/$(BLASTEST_F2C_LIB_NAME)
1393 @echo "Removing binaries from ./$(BLASTEST_DIR)"
1394 @- $(FIND) $(BLASTEST_DIR) -name "*.x" | $(XARGS) $(RM_F)
1395 @echo "Removing driver output files 'out.*' from ./$(BLASTEST_DIR)"
1396 @- $(RM_F) $(addprefix $(BLASTEST_DIR)/out.,$(BLASTEST_DRV_BASES))
1397 endif # ENABLE_VERBOSE
1398 endif # IS_CONFIGURED
1399
1400 ifeq ($(BUILDING_OOT),no)
1401 cleanblistest: cleanblistesttop cleanblistestdir
1402 else
1403 cleanblistest: cleanblistesttop
1404 endif
1405
1406 cleanblistesttop:
1407 ifeq ($(IS_CONFIGURED),yes)
1408 ifeq ($(ENABLE_VERBOSE),yes)
1409 - $(RM_F) $(MK_TESTSUITE_OBJS)
1410 - $(RM_F) $(TESTSUITE_BIN)
1411 - $(RM_F) $(TESTSUITE_OUT_FILE)
1412 else
1413 @echo "Removing object files from $(BASE_OBJ_TESTSUITE_PATH)"
1414 @- $(RM_F) $(MK_TESTSUITE_OBJS)
1415 @echo "Removing binary $(TESTSUITE_BIN)"
1416 @- $(RM_F) $(TESTSUITE_BIN)
1417 @echo "Removing $(TESTSUITE_OUT_FILE)"
1418 @- $(RM_F) $(TESTSUITE_OUT_FILE)
1419 endif # ENABLE_VERBOSE
1420 endif # IS_CONFIGURED
1421
1422 cleanblistestdir:
1423 ifeq ($(IS_CONFIGURED),yes)
1424 ifeq ($(ENABLE_VERBOSE),yes)
1425 - $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
1426 - $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN)
1427 # - $(MAKE) -C $(VEND_TESTCPP_DIR) clean
1428 else
1429 @echo "Removing object files from $(TESTSUITE_DIR)/$(OBJ_DIR)"
1430 @- $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F)
1431 @echo "Removing binary $(TESTSUITE_DIR)/$(TESTSUITE_BIN)"
1432 @- $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN)
1433 # @$(MAKE) -C $(VEND_TESTCPP_DIR) clean
1434 endif # ENABLE_VERBOSE
1435 endif # IS_CONFIGURED
1436
1437 distclean: cleanmk cleanh cleanlib cleantest
1438 ifeq ($(IS_CONFIGURED),yes)
1439 ifeq ($(ENABLE_VERBOSE),yes)
1440 - $(RM_F) $(BLIS_ADDON_H)
1441 - $(RM_F) $(BLIS_CONFIG_H)
1442 - $(RM_F) $(CONFIG_MK_FILE)
1443 - $(RM_F) $(PC_OUT_FILE)
1444 - $(RM_RF) $(OBJ_DIR)
1445 - $(RM_RF) $(LIB_DIR)
1446 - $(RM_RF) $(INCLUDE_DIR)
1447 else
1448 @echo "Removing $(BLIS_ADDON_H)"
1449 @$(RM_F) $(BLIS_ADDON_H)
1450 @echo "Removing $(BLIS_CONFIG_H)"
1451 @$(RM_F) $(BLIS_CONFIG_H)
1452 @echo "Removing $(CONFIG_MK_FILE)"
1453 @- $(RM_F) $(CONFIG_MK_FILE)
1454 @echo "Removing $(PC_OUT_FILE)"
1455 @- $(RM_F) $(PC_OUT_FILE)
1456 @echo "Removing $(OBJ_DIR)"
1457 @- $(RM_RF) $(OBJ_DIR)
1458 @echo "Removing $(LIB_DIR)"
1459 @- $(RM_RF) $(LIB_DIR)
1460 @echo "Removing $(INCLUDE_DIR)"
1461 @- $(RM_RF) $(INCLUDE_DIR)
1462 endif
1463 endif
1464
1465
1466 # --- CHANGELOG rules ---
1467
1468 changelog:
1469 @echo "Updating '$(DIST_PATH)/$(CHANGELOG)' via '$(GIT_LOG)'"
1470 @$(GIT_LOG) > $(DIST_PATH)/$(CHANGELOG)
1471
1472
1473 # --- Uninstall rules ---
1474
1475 # NOTE: We can't write these uninstall rules directly in terms of targets
1476 # $(MK_LIBS_VERS_CONF_INST), $(MK_LIBS_INST), and $(MK_INCL_DIR_INST)
1477 # because those targets are already defined in terms of rules that *build*
1478 # those products.
1479
1480 uninstall-libs: check-env
1481 ifeq ($(ENABLE_VERBOSE),yes)
1482 - $(RM_F) $(MK_LIBS_INST)
1483 else
1484 @echo "Uninstalling libraries $(notdir $(MK_LIBS_INST)) from $(dir $(firstword $(MK_LIBS_INST)))"
1485 @- $(RM_F) $(MK_LIBS_INST)
1486 endif
1487
1488 uninstall-lib-symlinks: check-env
1489 ifeq ($(ENABLE_VERBOSE),yes)
1490 - $(RM_F) $(MK_LIBS_SYML)
1491 else
1492 @echo "Uninstalling symlinks $(notdir $(MK_LIBS_SYML)) from $(dir $(firstword $(MK_LIBS_SYML)))"
1493 @- $(RM_F) $(MK_LIBS_SYML)
1494 endif
1495
1496 uninstall-headers: check-env
1497 ifeq ($(ENABLE_VERBOSE),yes)
1498 - $(RM_RF) $(MK_INCL_DIR_INST)
1499 - $(RM_RF) $(HELP_HEADERS_INSTALLED)
1500 else
1501 @echo "Uninstalling directory '$(notdir $(MK_INCL_DIR_INST))' from $(dir $(MK_INCL_DIR_INST))"
1502 @- $(RM_RF) $(MK_INCL_DIR_INST)
1503 @echo "Uninstalling $(notdir $(HELP_HEADERS_INSTALLED)) from $(dir $(INSTALL_INCDIR))"
1504 @- $(RM_RF) $(HELP_HEADERS_INSTALLED)
1505 endif
1506
1507 uninstall-share: check-env
1508 ifeq ($(ENABLE_VERBOSE),yes)
1509 - $(RM_RF) $(MK_SHARE_DIR_INST)
1510 else
1511 @echo "Uninstalling directory '$(notdir $(MK_SHARE_DIR_INST))' from $(dir $(MK_SHARE_DIR_INST))"
1512 @- $(RM_RF) $(MK_SHARE_DIR_INST)
1513 endif
1514
1515 # --- Uninstall old rules ---
1516
1517 uninstall-old-libs: $(UNINSTALL_OLD_LIBS) check-env
1518
1519 uninstall-old-symlinks: $(UNINSTALL_OLD_SYML) check-env
1520
1521 uninstall-old-headers: $(UNINSTALL_OLD_HEADERS) check-env
1522
1523 $(UNINSTALL_OLD_LIBS) $(UNINSTALL_OLD_SYML) $(UNINSTALL_OLD_HEADERS): check-env
1524 ifeq ($(ENABLE_VERBOSE),yes)
1525 - $(RM_F) $@
1526 else
1527 @echo "Uninstalling $(@F) from $(@D)/"
1528 @- $(RM_F) $@
1529 endif
1530