-
Notifications
You must be signed in to change notification settings - Fork 369
/
Makefile
1535 lines (1285 loc) · 55.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2014, The University of Texas at Austin
# Copyright (C) 2022, Advanced Micro Devices, Inc.
#
# 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(s) of the copyright holder(s) 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
#
# Top-level makefile for libflame linear algebra library.
#
#
#
# --- Makefile PHONY target definitions ----------------------------------------
#
.PHONY: all \
libs libblis \
check-env check-env-mk check-env-fragments check-env-make-defs \
flat-header flat-cblas-header \
test \
testblas blastest-f2c blastest-bin blastest-run \
testsuite testsuite-bin \
testsuite-run testsuite-run-fast testsuite-run-md testsuite-run-salt \
testblis testblis-fast testblis-md testblis-salt \
check checkblas \
checkblis checkblis-fast checkblis-md checkblis-salt \
install-headers install-helper-headers install-libs install-lib-symlinks \
showconfig \
clean cleanmk cleanh cleanlib distclean \
cleantest cleanblastest cleanblistest \
changelog \
symbols \
install uninstall uninstall-old \
uninstall-libs uninstall-lib-symlinks uninstall-headers \
uninstall-old-libs uninstall-lib-symlinks uninstall-old-headers
#
# --- Determine makefile fragment location -------------------------------------
#
# Comments:
# - We don't need to define DIST_PATH, LIB_PATH, INC_PATH, or SHARE_PATH since
# the defaults in common.mk (and config.mk) are designed to work with the
# top-level Makefile.
#DIST_PATH := .
#LIB_PATH = ./lib/$(CONFIG_NAME)
#INC_PATH = ./include/$(CONFIG_NAME)
#SHARE_PATH := .
#
# --- Include common makefile definitions --------------------------------------
#
# Define the name of the common makefile.
COMMON_MK_FILE := common.mk
# Include the configuration file.
-include $(COMMON_MK_FILE)
# 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 $(COMMON_MK_INCLUDED)),yes)
COMMON_MK_PRESENT := yes
else
COMMON_MK_PRESENT := no
endif
#
# --- Main target variable definitions -----------------------------------------
#
# --- Object file paths ---
# Construct the base object file path for the current configuration.
BASE_OBJ_PATH := ./$(OBJ_DIR)/$(CONFIG_NAME)
# Construct base object file paths corresponding to the four locations
# of source code.
BASE_OBJ_CONFIG_PATH := $(BASE_OBJ_PATH)/$(CONFIG_DIR)
BASE_OBJ_FRAME_PATH := $(BASE_OBJ_PATH)/$(FRAME_DIR)
BASE_OBJ_REFKERN_PATH := $(BASE_OBJ_PATH)/$(REFKERN_DIR)
BASE_OBJ_KERNELS_PATH := $(BASE_OBJ_PATH)/$(KERNELS_DIR)
BASE_OBJ_ADDON_PATH := $(BASE_OBJ_PATH)/$(ADDON_DIR)
BASE_OBJ_SANDBOX_PATH := $(BASE_OBJ_PATH)/$(SANDBOX_DIR)
# --- Define install target names for static libraries ---
LIBBLIS_A_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_A)
# --- Define install target names for shared libraries ---
LIBBLIS_SO_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_SO)
LIBBLIS_SO_MAJ_INST := $(INSTALL_LIBDIR)/$(LIBBLIS_SONAME)
ifeq ($(IS_WIN),yes)
# The 'install' target does not create symlinks for Windows builds, so we don't
# bother defining LIBBLIS_SO_MMB_INST.
LIBBLIS_SO_MMB_INST :=
else
LIBBLIS_SO_MMB_INST := $(INSTALL_LIBDIR)/$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT)
endif
# --- Determine which libraries to build ---
MK_LIBS :=
MK_LIBS_INST :=
MK_LIBS_SYML :=
ifeq ($(MK_ENABLE_STATIC),yes)
MK_LIBS += $(LIBBLIS_A_PATH)
MK_LIBS_INST += $(LIBBLIS_A_INST)
MK_LIBS_SYML +=
endif
ifeq ($(MK_ENABLE_SHARED),yes)
MK_LIBS += $(LIBBLIS_SO_PATH) \
$(LIBBLIS_SO_MAJ_PATH)
MK_LIBS_INST += $(LIBBLIS_SO_MMB_INST)
MK_LIBS_SYML += $(LIBBLIS_SO_INST) \
$(LIBBLIS_SO_MAJ_INST)
endif
# Strip leading, internal, and trailing whitespace.
MK_LIBS_INST := $(strip $(MK_LIBS_INST))
MK_LIBS_SYML := $(strip $(MK_LIBS_SYML))
# --- Define install directory for headers ---
# Set the path to the subdirectory of the include installation directory.
MK_INCL_DIR_INST := $(INSTALL_INCDIR)/blis
# --- Define install directory for public makefile fragments ---
# Set the path to the subdirectory of the share installation directory.
MK_SHARE_DIR_INST := $(INSTALL_SHAREDIR)/blis
PC_SHARE_DIR_INST := $(INSTALL_SHAREDIR)/pkgconfig
#
# --- Library object definitions -----------------------------------------------
#
# In this section, we will isolate the relevant source code filepaths and
# convert them to lists of object filepaths. Relevant source code falls into
# four categories: configuration source; architecture-specific kernel source;
# reference kernel source; and general framework source.
# $(call gen-obj-paths-from-src file_exts, src_files, base_src_path, base_obj_path)
gen-obj-paths-from-src = $(foreach ch, $(1), \
$(patsubst $(3)/%.$(ch), \
$(4)/%.o, \
$(filter %.$(ch), $(2)) ) )
# Generate object file paths for source code found in the sub-configuration
# directories.
MK_CONFIG_OBJS := $(call gen-obj-paths-from-src,$(CONFIG_SRC_SUFS),$(MK_CONFIG_SRC),$(CONFIG_PATH),$(BASE_OBJ_CONFIG_PATH))
# Generate object file paths for architecture-specific kernel source code.
# We target only .c, .s, and .S files. Note that MK_KERNELS_SRC is already
# limited to the kernel source corresponding to the kernel sets in
# KERNEL_LIST. This is because the configure script only propogated makefile
# fragments into those specific kernel subdirectories.
MK_KERNELS_OBJS := $(call gen-obj-paths-from-src,$(KERNELS_SRC_SUFS),$(MK_KERNELS_SRC),$(KERNELS_PATH),$(BASE_OBJ_KERNELS_PATH))
# Generate object file paths for reference kernels, with one set of object
# files for each sub-configuration in CONFIG_LIST. Note that due to the
# nuances of naming the reference kernel files, we can't use the function
# gen-obj-paths-from-src as we do above and below.
MK_REFKERN_C := $(filter %.c, $(MK_REFKERN_SRC))
MK_REFKERN_OBJS := $(foreach arch, $(CONFIG_LIST), \
$(patsubst $(REFKERN_PATH)/%_$(REFNM).c, \
$(BASE_OBJ_REFKERN_PATH)/$(arch)/%_$(arch)_$(REFNM).o, \
$(MK_REFKERN_C) \
) \
)
# Generate object file paths for all of the portable framework source code.
MK_FRAME_OBJS := $(call gen-obj-paths-from-src,$(FRAME_SRC_SUFS),$(MK_FRAME_SRC),$(FRAME_PATH),$(BASE_OBJ_FRAME_PATH))
# Generate object file paths for the addon source code. If one or more addons
# were not enabled a configure-time, these variable will we empty.
# NOTE: We separate the source and objects into kernel and non-kernel lists.
MK_ADDON_KERS_SRC := $(foreach addon, $(ADDON_LIST), \
$(filter $(ADDON_PATH)/$(addon)/$(KERNELS_DIR)/%, \
$(MK_ADDON_SRC)) \
)
MK_ADDON_OTHER_SRC := $(foreach addon, $(ADDON_LIST), \
$(filter-out $(ADDON_PATH)/$(addon)/$(KERNELS_DIR)/%, \
$(MK_ADDON_SRC)) \
)
MK_ADDON_KERS_OBJS := $(call gen-obj-paths-from-src,$(ADDON_SRC_SUFS),$(MK_ADDON_KERS_SRC),$(ADDON_PATH),$(BASE_OBJ_ADDON_PATH))
MK_ADDON_OTHER_OBJS := $(call gen-obj-paths-from-src,$(ADDON_SRC_SUFS),$(MK_ADDON_OTHER_SRC),$(ADDON_PATH),$(BASE_OBJ_ADDON_PATH))
MK_ADDON_OBJS := $(MK_ADDON_KERS_OBJS) $(MK_ADDON_OTHER_OBJS)
# Generate object file paths for the sandbox source code. If a sandbox was not
# enabled a configure-time, this variable will we empty.
MK_SANDBOX_OBJS := $(call gen-obj-paths-from-src,$(SANDBOX_SRC_SUFS),$(MK_SANDBOX_SRC),$(SANDBOX_PATH),$(BASE_OBJ_SANDBOX_PATH))
# AMD has chosen to introduce AOCL-specific optimizations to certain BLIS
# framework files that are otherwise intended to remain generic. Upstream
# developers of vanilla BLIS have agreed to integrate some of these
# optimizations, but in a way that keeps the AOCL-specific code segregated
# in separate files containing the suffix '_amd'. For example, the BLAS
# compatibility layer in vanilla BLIS contains a generic file named
# 'bla_gemm.c'. AMD's version of this file is named 'bla_gemm_amd.c'.
# Only one or the other is ever built and included in libblis. Currently,
# these files are chosen automatically based on the target configuration.
ifeq ($(ENABLE_AMD_FRAME_TWEAKS),yes)
# Build is being done for AMD platforms; remove the objects which DO NOT have
# an "_amd" suffix.
MK_FRAME_AMD_OBJS := $(filter $(BASE_OBJ_FRAME_PATH)/%amd.o, $(MK_FRAME_OBJS))
FILES_TO_REMOVE := $(subst _amd.o,.o, $(MK_FRAME_AMD_OBJS))
MK_FRAME_OBJS := $(filter-out $(FILES_TO_REMOVE), $(MK_FRAME_OBJS))
else
# Build is being done for non-AMD platforms; remove the objects which DO have
# an "_amd" suffix.
MK_FRAME_AMD_OBJS := $(filter $(BASE_OBJ_FRAME_PATH)/%amd.o, $(MK_FRAME_OBJS))
MK_FRAME_OBJS := $(filter-out $(MK_FRAME_AMD_OBJS), $(MK_FRAME_OBJS))
endif
# Combine all of the object files into some readily-accessible variables.
MK_BLIS_OBJS := $(MK_CONFIG_OBJS) \
$(MK_KERNELS_OBJS) \
$(MK_REFKERN_OBJS) \
$(MK_FRAME_OBJS) \
$(MK_ADDON_OBJS) \
$(MK_SANDBOX_OBJS)
# Optionally filter out the BLAS and CBLAS compatibility layer object files.
# This is not actually necessary, since each affected file is guarded by C
# preprocessor macros, but it but prevents "empty" object files from being
# added into the library (and reduces compilation time).
BASE_OBJ_BLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat
BASE_OBJ_CBLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat/cblas
ifeq ($(MK_ENABLE_CBLAS),no)
MK_BLIS_OBJS := $(filter-out $(BASE_OBJ_CBLAS_PATH)/%.o, $(MK_BLIS_OBJS) )
endif
ifeq ($(MK_ENABLE_BLAS),no)
MK_BLIS_OBJS := $(filter-out $(BASE_OBJ_BLAS_PATH)/%.o, $(MK_BLIS_OBJS) )
endif
#
# --- Monolithic header definitions --------------------------------------------
#
# Define lists of headers to create/install. The default is to only
# create/install blis.h.
HEADERS_TO_BUILD := $(BLIS_H_FLAT)
HEADERS_TO_INSTALL := $(BLIS_H_FLAT)
# If CBLAS is enabled, we also create/install cblas.h. This allows the user to
# continue using #include "cblas.h" in their application, if they wish. (NOTE:
# The user can also access CBLAS definitions and function prototypes by
# #include'ing "blis.h".)
ifeq ($(MK_ENABLE_CBLAS),yes)
HEADERS_TO_BUILD += $(CBLAS_H_FLAT)
HEADERS_TO_INSTALL += $(CBLAS_H_FLAT)
endif
# If requested, include AMD's C++ template header files in the list of headers
# to install.
ifeq ($(INSTALL_HH),yes)
HEADERS_TO_INSTALL += $(wildcard $(VEND_CPP_PATH)/*.hh)
endif
# Define a list of so-called helper headers to install. These helper headers
# are very simple headers that go one directory up from INCDIR/blis (which
# by default is PREFIX/include/blis, where PREFIX is the install prefix). The
# default is to only install the blis.h helper header.
HELP_HEADERS_TO_INSTALL := $(HELP_BLIS_H_PATH)
HELP_HEADERS_INSTALLED := $(INSTALL_INCDIR)/$(BLIS_H)
# If CBLAS is enabled, we also install the cblas.h helper header.
ifeq ($(MK_ENABLE_CBLAS),yes)
HELP_HEADERS_TO_INSTALL += $(HELP_CBLAS_H_PATH)
HELP_HEADERS_INSTALLED += $(INSTALL_INCDIR)/$(CBLAS_H)
endif
#
# --- public makefile fragment definitions -------------------------------------
#
# Define a list of makefile fragments to install.
FRAGS_TO_INSTALL := $(CONFIG_MK_FILE) \
$(COMMON_MK_FILE) \
$(DIST_PATH)/build/gen-make-frags/gen-make-frag.sh \
$(DIST_PATH)/build/gen-make-frags/fragment.mk \
$(DIST_PATH)/build/gen-make-frags/ignore_list \
$(DIST_PATH)/build/gen-make-frags/special_list \
$(DIST_PATH)/build/gen-make-frags/suffix_list \
$(DIST_PATH)/build/flatten-headers.py \
$(DIST_PATH)/build/mirror-tree.sh \
$(DIST_PATH)/config_registry \
$(DIST_PATH)/build/detect/iset/avx.s \
$(DIST_PATH)/build/detect/iset/avx512dq.s \
$(DIST_PATH)/build/detect/iset/avx512f.s \
$(DIST_PATH)/build/detect/iset/fma3.s \
$(DIST_PATH)/build/detect/iset/fma4.s
# Define a list of plugin makefile fragments to install.
PLUGIN_FRAGS_TO_INSTALL := $(DIST_PATH)/build/plugin/bli_plugin_init_ref.c \
$(DIST_PATH)/build/plugin/bli_plugin_init_zen3.c \
$(DIST_PATH)/build/plugin/bli_plugin_register.c \
$(DIST_PATH)/build/plugin/my_kernel_1_ref.c \
$(DIST_PATH)/build/plugin/my_kernel_2_ref.c \
$(DIST_PATH)/build/plugin/my_kernel_1_zen3.c \
$(DIST_PATH)/build/plugin/bli_plugin.h.in \
$(DIST_PATH)/build/plugin/config.mk.in \
$(DIST_PATH)/build/plugin/Makefile
PC_IN_FILE := blis.pc.in
PC_OUT_FILE := blis.pc
#
# --- BLAS test drivers definitions --------------------------------------------
#
# The location of the BLAS test suite's input files.
BLASTEST_INPUT_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/input
# The location of the BLAS test suite object directory.
BASE_OBJ_BLASTEST_PATH := $(BASE_OBJ_PATH)/$(BLASTEST_DIR)
# The locations of the BLAS test suite source code (f2c and drivers).
BLASTEST_F2C_SRC_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/f2c
BLASTEST_DRV_SRC_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/src
# The paths to object files we will create (f2c and drivers).
BLASTEST_F2C_OBJS := $(sort \
$(patsubst $(BLASTEST_F2C_SRC_PATH)/%.c, \
$(BASE_OBJ_BLASTEST_PATH)/%.o, \
$(wildcard $(BLASTEST_F2C_SRC_PATH)/*.c)) \
)
BLASTEST_DRV_OBJS := $(sort \
$(patsubst $(BLASTEST_DRV_SRC_PATH)/%.c, \
$(BASE_OBJ_BLASTEST_PATH)/%.o, \
$(wildcard $(BLASTEST_DRV_SRC_PATH)/*.c)) \
)
# libf2c name and location.
BLASTEST_F2C_LIB_NAME := libf2c.a
BLASTEST_F2C_LIB := $(BASE_OBJ_BLASTEST_PATH)/$(BLASTEST_F2C_LIB_NAME)
# The base names of each driver source file (ie: filename minus suffix).
BLASTEST_DRV_BASES := $(basename $(notdir $(BLASTEST_DRV_OBJS)))
# The binary executable driver names.
BLASTEST_DRV_BINS := $(addsuffix .x,$(BLASTEST_DRV_BASES))
BLASTEST_DRV_BIN_PATHS := $(addprefix $(BASE_OBJ_BLASTEST_PATH)/,$(BLASTEST_DRV_BINS))
# Binary executable driver "run-" names
BLASTEST_DRV_BINS_R := $(addprefix run-,$(BLASTEST_DRV_BASES))
# Filter level-1, level-2, and level-3 names to different variables.
BLASTEST_DRV1_BASES := $(filter %1,$(BLASTEST_DRV_BASES))
BLASTEST_DRV2_BASES := $(filter %2,$(BLASTEST_DRV_BASES))
BLASTEST_DRV3_BASES := $(filter %3,$(BLASTEST_DRV_BASES))
# Define some CFLAGS that we'll only use when compiling BLAS test suite
# files.
BLAT_CFLAGS := -Wno-parentheses \
-I$(BLASTEST_F2C_SRC_PATH) \
-I. -DHAVE_BLIS_H
# Suppress warnings about possibly uninitialized variables for the BLAS
# test driver code (as output from f2c), which is riddled with such
# variables, but only if the option to do so is supported.
ifeq ($(CC_VENDOR),gcc)
BLAT_CFLAGS += -Wno-maybe-uninitialized
endif
# The location of the script that checks the BLAS test output.
BLASTEST_CHECK_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/$(BLASTEST_CHECK)
#
# --- BLIS testsuite definitions -----------------------------------------------
#
# The location of the test suite's general and operations-specific
# input/configuration files.
TESTSUITE_CONF_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CONF_GEN)
TESTSUITE_CONF_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CONF_OPS)
TESTSUITE_FAST_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_FAST_GEN)
TESTSUITE_FAST_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_FAST_OPS)
TESTSUITE_MIXD_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_MIXD_GEN)
TESTSUITE_MIXD_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_MIXD_OPS)
TESTSUITE_SALT_GEN_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_SALT_GEN)
TESTSUITE_SALT_OPS_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_SALT_OPS)
# The locations of the test suite source directory and the local object
# directory.
TESTSUITE_SRC_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/src
BASE_OBJ_TESTSUITE_PATH := $(BASE_OBJ_PATH)/$(TESTSUITE_DIR)
# Convert source file paths to object file paths by replacing the base source
# directories with the base object directories, and also replacing the source
# file suffix (eg: '.c') with '.o'.
MK_TESTSUITE_OBJS := $(sort \
$(patsubst $(TESTSUITE_SRC_PATH)/%.c, \
$(BASE_OBJ_TESTSUITE_PATH)/%.o, \
$(wildcard $(TESTSUITE_SRC_PATH)/*.c)) \
)
# The test suite binary executable filename.
# NOTE: The TESTSUITE_WRAPPER variable defaults to the empty string if it
# is not already set, in which case it has no effect lateron when the
# testsuite binary is executed via lines such as
#
# $(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) ... > $(TESTSUITE_OUT_FILE)
#
# The reason TESTSUITE_WRAPPER is employed in this way is so that some
# unusual environments (e.g. ARM) can run the testsuite through some other
# binary. See .travis.yml for details on how the variable is employed in
# practice.
TESTSUITE_BIN := test_$(LIBBLIS).x
TESTSUITE_WRAPPER ?=
# The location of the script that checks the BLIS testsuite output.
TESTSUITE_CHECK_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CHECK)
#
# --- Uninstall definitions ----------------------------------------------------
#
ifeq ($(IS_CONFIGURED),yes)
# These shell commands gather the filepaths to any library in the current
# LIBDIR that might be left over from an old installation. We start with
# including nothing for static libraries, since older static libraries are
# always overwritten by newer ones. Then we add shared libraries, which are
# named with three .so version numbers.
UNINSTALL_OLD_LIBS :=
UNINSTALL_OLD_LIBS += $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?.?.?))
# These shell commands gather the filepaths to any library symlink in the
# current LIBDIR that might be left over from an old installation. We start
# with symlinks named using the .so major version number.
UNINSTALL_OLD_SYML := $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS_SO).$(SO_MAJOR),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?))
# We also prepare to uninstall older-style symlinks whose names contain the
# BLIS version number and configuration family.
UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.a)
UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.$(SHLIB_EXT))
# This shell command grabs all files named "*.h" that are not blis.h or cblas.h
# in the installation directory. We consider this set of headers to be "old" and
# eligible for removal upon running of the uninstall-old-headers target.
UNINSTALL_OLD_HEADERS := $(filter-out $(BLIS_H),$(filter-out $(CBLAS_H),$(wildcard $(INSTALL_INCDIR)/blis/*.h)))
endif # IS_CONFIGURED
#
# --- Targets/rules ------------------------------------------------------------
#
# --- Primary targets ---
all: libs
libs: libblis
test: checkblis checkblas
check: checkblis-fast checkblas
install: libs install-libs install-lib-symlinks install-headers install-share
uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers uninstall-share
uninstall-old: uninstall-old-libs uninstall-old-symlinks uninstall-old-headers
clean: cleanh cleanlib
# --- 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 ($(ALL_MAKE_DEFS_MK_PRESENT),no)
$(error Cannot proceed: Some make_defs.mk files not found or mislabeled!)
endif
# --- Shared/dynamic libblis symbol file creation/refresh ---
symbols: check-env $(SYM_FILE)
$(SYM_FILE): $(HEADERS_TO_INSTALL)
ifeq ($(ENABLE_VERBOSE),yes)
$(GEN_SYMS) > $(SYM_FILE)
else
@echo "Updating $(SYM_FILE)"
@$(GEN_SYMS) > $(SYM_FILE)
endif
# --- Consolidated blis.h header creation ---
flat-header: check-env $(BLIS_H_FLAT)
$(BLIS_H_FLAT): $(ALL_H99_FILES)
ifeq ($(ENABLE_VERBOSE),yes)
$(FLATTEN_H) -l -v1 $(BLIS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
else
@echo -n "Generating monolithic blis.h"
@$(FLATTEN_H) -l -v1 $(BLIS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
@echo "Generated $@"
endif
# --- Consolidated cblas.h header creation ---
flat-cblas-header: check-env $(CBLAS_H_FLAT)
# Note that the flattened blis.h is a prerequisite of flattening cblas.h. This
# is done so that the two headers are built sequentially even when using
# 'make -j[n]'. Otherwise, the output from the two processes can become
# interleaved, which looks awkward/confusing.
$(CBLAS_H_FLAT): $(FRAME_H99_FILES) $(BLIS_H_FLAT)
ifeq ($(ENABLE_VERBOSE),yes)
$(FLATTEN_H) -l -v1 $(CBLAS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
else
@echo -n "Generating monolithic cblas.h"
@$(FLATTEN_H) -l -v1 $(CBLAS_H_SRC_PATH) $@ "./$(INCLUDE_DIR)" "$(ALL_H99_DIRPATHS)"
@echo "Generated $@"
endif
# --- General source code / object code rules ---
# FGVZ: Add support for compiling .s and .S files in 'config'/'kernels'
# directories.
# - May want to add an extra foreach loop around function eval/call.
# first argument: a configuration name from config_list, used to look up the
# CFLAGS to use during compilation.
define make-config-rule
$(BASE_OBJ_CONFIG_PATH)/$(1)/%.o: $(CONFIG_PATH)/$(1)/%.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-config-cflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-config-text-for,$(1))
@$(CC) $(call get-config-cflags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
define make-frame-rule
$(BASE_OBJ_FRAME_PATH)/%.o: $(FRAME_PATH)/%.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-frame-cflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-frame-text-for,$(1))
@$(CC) $(call get-frame-cflags-for,$(1)) -c $$< -o $$@
endif
ifneq ($(findstring hpx,$(THREADING_MODEL)),)
$(BASE_OBJ_FRAME_PATH)/%.o: $(FRAME_PATH)/%.cpp $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CXX) $(call get-frame-cxxflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-frame-cxxtext-for,$(1))
@$(CXX) $(call get-frame-cxxflags-for,$(1)) -c $$< -o $$@
endif
endif
endef
# first argument: a kernel set (name) being targeted (e.g. haswell).
define make-refinit-rule
$(BASE_OBJ_REFKERN_PATH)/$(1)/bli_cntx_$(1)_ref.o: $(REFKERN_PATH)/bli_cntx_ref.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-refinit-cflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-refinit-text-for,$(1))
@$(CC) $(call get-refinit-cflags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a kernel set (name) being targeted (e.g. haswell).
define make-refkern-rule
$(BASE_OBJ_REFKERN_PATH)/$(1)/%_$(1)_ref.o: $(REFKERN_PATH)/%_ref.c $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-refkern-cflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-refkern-text-for,$(1))
@$(CC) $(call get-refkern-cflags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a kernel set (name) being targeted (e.g. haswell).
# second argument: the configuration whose CFLAGS we should use in compilation.
# third argument: the kernel file suffix being considered.
define make-kernels-rule
$(BASE_OBJ_KERNELS_PATH)/$(1)/%.o: $(KERNELS_PATH)/$(1)/%.$(3) $(HEADERS_TO_BUILD) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-kernel-cflags-for,$(2)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-kernel-text-for,$(2))
@$(CC) $(call get-kernel-cflags-for,$(2)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
# second argument: the C99 addon file suffix being considered.
define make-c99-addon-rule
$(BASE_OBJ_ADDON_PATH)/%.o: $(ADDON_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_H99_FILES) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-addon-c99text-for,$(1))
@$(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
# second argument: the C99 addon file suffix being considered.
# third argument: the name of the addon being considered.
define make-c99-addon-kers-rule
$(BASE_OBJ_ADDON_PATH)/$(3)/$(KERNELS_DIR)/%.o: $(ADDON_PATH)/$(3)/$(KERNELS_DIR)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_H99_FILES) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-addon-kernel-text-for,$(1))
@$(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
# second argument: the C++ addon file suffix being considered.
define make-cxx-addon-rule
$(BASE_OBJ_ADDON_PATH)/%.o: $(ADDON_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(ADDON_HXX_FILES) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-addon-cxxtext-for,$(1))
@$(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
# second argument: the C99 sandbox file suffix being considered.
define make-c99-sandbox-rule
$(BASE_OBJ_SANDBOX_PATH)/%.o: $(SANDBOX_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(SANDBOX_H99_FILES) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-sandbox-c99flags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-sandbox-c99text-for,$(1))
@$(CC) $(call get-sandbox-c99flags-for,$(1)) -c $$< -o $$@
endif
endef
# first argument: a configuration name from the union of config_list and
# config_name, used to look up the CFLAGS to use during compilation.
# second argument: the C++ sandbox file suffix being considered.
define make-cxx-sandbox-rule
$(BASE_OBJ_SANDBOX_PATH)/%.o: $(SANDBOX_PATH)/%.$(2) $(HEADERS_TO_BUILD) $(SANDBOX_HXX_FILES) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CXX) $(call get-sandbox-cxxflags-for,$(1)) -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-sandbox-cxxtext-for,$(1))
@$(CXX) $(call get-sandbox-cxxflags-for,$(1)) -c $$< -o $$@
endif
endef
# Define functions to choose the correct sub-configuration name for the
# given kernel set. This function is called when instantiating the
# make-kernels-rule.
get-config-for-kset = $(lastword $(subst :, ,$(filter $(1):%,$(KCONFIG_MAP))))
# Instantiate the build rule for files in the configuration directory for
# each of the sub-configurations in CONFIG_LIST with the CFLAGS designated
# for that sub-configuration.
$(foreach conf, $(CONFIG_LIST), $(eval $(call make-config-rule,$(conf))))
# Instantiate the build rule for framework files. Use the CFLAGS for the
# configuration family, which exists in the directory whose name is equal to
# CONFIG_NAME. Note that this doesn't need to be in a loop since we expect
# CONFIG_NAME to only ever contain a single name. (BTW: If CONFIG_NAME refers
# to a singleton family, then CONFIG_LIST contains CONFIG_NAME as its only
# item.)
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-frame-rule,$(conf))))
# Instantiate the build rule for reference kernel initialization and
# reference kernels for each of the sub-configurations in CONFIG_LIST with
# the CFLAGS designated for that sub-configuration.
$(foreach conf, $(CONFIG_LIST), $(eval $(call make-refinit-rule,$(conf))))
$(foreach conf, $(CONFIG_LIST), $(eval $(call make-refkern-rule,$(conf))))
# Instantiate the build rule for optimized kernels for each of the kernel
# sets in KERNEL_LIST with the CFLAGS designated for the sub-configuration
# specified by the KCONFIG_MAP.
$(foreach suf, $(KERNELS_SRC_SUFS), \
$(foreach kset, $(KERNEL_LIST), $(eval $(call make-kernels-rule,$(kset),$(call get-config-for-kset,$(kset)),$(suf)))))
# Instantiate the build rule for C addon files. Use the CFLAGS for the
# configuration family.
$(foreach suf, $(ADDON_C99_SUFS), \
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-rule,$(conf),$(suf)))))
# Instantiate the build rule for C addon/kernels files. Use the CFLAGS for the
# configuration family.
$(foreach addon, $(ADDON_LIST), \
$(foreach suf, $(ADDON_C99_SUFS), \
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-kers-rule,$(conf),$(suf),$(addon))))))
# Instantiate the build rule for C++ addon files. Use the CFLAGS for the
# configuration family.
$(foreach suf, $(ADDON_CXX_SUFS), \
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-cxx-addon-rule,$(conf),$(suf)))))
# Instantiate the build rule for C sandbox files. Use the CFLAGS for the
# configuration family.
$(foreach suf, $(SANDBOX_C99_SUFS), \
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-sandbox-rule,$(conf),$(suf)))))
# Instantiate the build rule for C++ sandbox files. Use the CXXFLAGS for the
# configuration family.
$(foreach suf, $(SANDBOX_CXX_SUFS), \
$(foreach conf, $(CONFIG_NAME), $(eval $(call make-cxx-sandbox-rule,$(conf),$(suf)))))
# --- All-purpose library rule (static and shared) ---
libblis: check-env $(MK_LIBS)
# --- Static library archiver rules ---
$(LIBBLIS_A_PATH): $(MK_BLIS_OBJS)
ifeq ($(ENABLE_VERBOSE),yes)
ifeq ($(ARG_MAX_HACK),yes)
$(file > [email protected],$^)
$(AR) $(ARFLAGS) $@ @[email protected]
$(RM_F) [email protected]
$(RANLIB) $@
else
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
endif
else # ifeq ($(ENABLE_VERBOSE),no)
ifeq ($(ARG_MAX_HACK),yes)
@echo "Archiving $@"
@$(file > [email protected],$^)
@$(AR) $(ARFLAGS) $@ @[email protected]
@$(RM_F) [email protected]
@$(RANLIB) $@
else
@echo "Archiving $@"
@$(AR) $(ARFLAGS) $@ $?
@$(RANLIB) $@
endif
endif
# --- Shared library linker rules ---
$(LIBBLIS_SO_PATH): $(MK_BLIS_OBJS)
ifeq ($(ENABLE_VERBOSE),yes)
ifeq ($(ARG_MAX_HACK),yes)
$(file > [email protected],$^)
$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) @[email protected] $(LDFLAGS)
$(RM_F) [email protected]
else
$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) $^ $(LDFLAGS)
endif
else # ifeq ($(ENABLE_VERBOSE),no)
ifeq ($(ARG_MAX_HACK),yes)
@echo "Dynamically linking $@"
@$(file > [email protected],$^)
@$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) @[email protected] $(LDFLAGS)
@$(RM_F) [email protected]
else
@echo "Dynamically linking $@"
@$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) $^ $(LDFLAGS)
endif
endif
# Local symlink for shared library.
# NOTE: We use a '.loc' suffix to avoid filename collisions in case this
# rule is executed concurrently with the install-lib-symlinks rule, which
# also creates symlinks in the current directory (before installing them).
# NOTE: We don't create any symlinks during Windows builds.
$(LIBBLIS_SO_MAJ_PATH): $(LIBBLIS_SO_PATH)
ifeq ($(IS_WIN),no)
ifeq ($(ENABLE_VERBOSE),yes)
$(SYMLINK) $(<F) $(@F).loc
$(MV) $(@F).loc $(BASE_LIB_PATH)/$(@F)
else # ifeq ($(ENABLE_VERBOSE),no)
@echo "Creating symlink $@"
@$(SYMLINK) $(<F) $(@F).loc
@$(MV) $(@F).loc $(BASE_LIB_PATH)/$(@F)
endif
endif
# --- BLAS test suite rules ---
testblas: blastest-run
blastest-f2c: check-env $(BLASTEST_F2C_LIB)
blastest-bin: check-env blastest-f2c $(BLASTEST_DRV_BIN_PATHS)
blastest-run: $(BLASTEST_DRV_BINS_R)
# f2c object file rule.
$(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_F2C_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
else
@echo "Compiling $@"
@$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
endif
# driver object file rule.
$(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_DRV_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
else
@echo "Compiling $@"
@$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@
endif
# libf2c library archive rule.
$(BLASTEST_F2C_LIB): $(BLASTEST_F2C_OBJS)
ifeq ($(ENABLE_VERBOSE),yes)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
else
@echo "Archiving $@"
@$(AR) $(ARFLAGS) $@ $?
@$(RANLIB) $@
endif
$(BASE_OBJ_BLASTEST_PATH)/%.x: $(BASE_OBJ_BLASTEST_PATH)/%.o $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK)
ifeq ($(ENABLE_VERBOSE),yes)
$(LINKER) $< $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
else
@echo "Linking $@ against '$(notdir $(BLASTEST_F2C_LIB)) $(LIBBLIS_LINK) "$(LDFLAGS)"'"
@$(LINKER) $< $(BLASTEST_F2C_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
endif
# A rule to run ?blat1.x driver files.
define make-run-blat1-rule
run-$(1): $(BASE_OBJ_BLASTEST_PATH)/$(1).x
ifeq ($(ENABLE_VERBOSE),yes)
$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x > out.$(1)
else
@echo "Running $(1).x > 'out.$(1)'"
@$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x > out.$(1)
endif
endef
# Instantiate the rule above for each level-1 driver file.
$(foreach name, $(BLASTEST_DRV1_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): $(BASE_OBJ_BLASTEST_PATH)/$(1).x
ifeq ($(ENABLE_VERBOSE),yes)
$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x < $(BLASTEST_INPUT_PATH)/$(1).in
else
@echo "Running $(1).x < '$(BLASTEST_INPUT_PATH)/$(1).in' (output to 'out.$(1)')"
@$(TESTSUITE_WRAPPER) $(BASE_OBJ_BLASTEST_PATH)/$(1).x < $(BLASTEST_INPUT_PATH)/$(1).in
endif
endef
# Instantiate the rule above for each level-2 driver file.
$(foreach name, $(BLASTEST_DRV2_BASES), $(eval $(call make-run-blat23-rule,$(name))))
# Instantiate the rule above for each level-3 driver file.
$(foreach name, $(BLASTEST_DRV3_BASES), $(eval $(call make-run-blat23-rule,$(name))))
# Check the results of the BLAS test suite drivers.
checkblas: blastest-run
ifeq ($(ENABLE_VERBOSE),yes)
- $(BLASTEST_CHECK_PATH)
else
@- $(BLASTEST_CHECK_PATH)
endif
# --- BLIS test suite rules ---
testblis: testsuite
testblis-fast: testsuite-run-fast
testblis-md: testsuite-run-md
testblis-salt: testsuite-run-salt
testsuite: testsuite-run
testsuite-bin: check-env $(TESTSUITE_BIN)
# Object file rule.
$(BASE_OBJ_TESTSUITE_PATH)/%.o: $(TESTSUITE_SRC_PATH)/%.c $(HEADERS_TO_BUILD)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) -c $< -o $@
else
@echo "Compiling $@"
@$(CC) $(call get-user-cflags-for,$(CONFIG_NAME)) -c $< -o $@
endif
# Testsuite binary rule.
$(TESTSUITE_BIN): $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK)
ifeq ($(ENABLE_VERBOSE),yes)
$(LINKER) $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
else
@echo "Linking $@ against '$(LIBBLIS_LINK) "$(LDFLAGS)"'"
@$(LINKER) $(MK_TESTSUITE_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@
endif
# A rule to run the testsuite using the normal input.* files.
testsuite-run: testsuite-bin
ifeq ($(ENABLE_VERBOSE),yes)
$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(TESTSUITE_CONF_GEN_PATH) \
-o $(TESTSUITE_CONF_OPS_PATH) \
> $(TESTSUITE_OUT_FILE)
else
@echo "Running $(TESTSUITE_BIN) with output redirected to '$(TESTSUITE_OUT_FILE)'"
@$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(TESTSUITE_CONF_GEN_PATH) \
-o $(TESTSUITE_CONF_OPS_PATH) \
> $(TESTSUITE_OUT_FILE)
endif
# A rule to run the testsuite using the input.*.fast files, which
# run a set of tests designed to finish much more quickly.
testsuite-run-fast: testsuite-bin
ifeq ($(ENABLE_VERBOSE),yes)
$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(TESTSUITE_FAST_GEN_PATH) \
-o $(TESTSUITE_FAST_OPS_PATH) \
> $(TESTSUITE_OUT_FILE)
else
@echo "Running $(TESTSUITE_BIN) (fast) with output redirected to '$(TESTSUITE_OUT_FILE)'"
@$(TESTSUITE_WRAPPER) ./$(TESTSUITE_BIN) -g $(TESTSUITE_FAST_GEN_PATH) \