@@ -116,6 +116,7 @@ BASE_OBJ_FRAME_PATH := $(BASE_OBJ_PATH)/$(FRAME_DIR)
116116BASE_OBJ_AOCLDTL_PATH := $(BASE_OBJ_PATH ) /$(AOCLDTL_DIR )
117117BASE_OBJ_REFKERN_PATH := $(BASE_OBJ_PATH ) /$(REFKERN_DIR )
118118BASE_OBJ_KERNELS_PATH := $(BASE_OBJ_PATH ) /$(KERNELS_DIR )
119+ BASE_OBJ_ADDON_PATH := $(BASE_OBJ_PATH ) /$(ADDON_DIR )
119120BASE_OBJ_SANDBOX_PATH := $(BASE_OBJ_PATH ) /$(SANDBOX_DIR )
120121
121122# --- Define install target names for static libraries ---
@@ -212,6 +213,20 @@ MK_REFKERN_OBJS := $(foreach arch, $(CONFIG_LIST), \
212213# Generate object file paths for all of the portable framework source code.
213214MK_FRAME_OBJS := $(call gen-obj-paths-from-src,$(FRAME_SRC_SUFS ) ,$(MK_FRAME_SRC ) ,$(FRAME_PATH ) ,$(BASE_OBJ_FRAME_PATH ) )
214215
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 )
215230# AMD has optimized some of the framework files, these optimizations
216231# may not be compatible with other platforms.
217232#
@@ -236,8 +251,6 @@ endif
236251# Generate object file paths for all of the debgu and trace logger.
237252MK_AOCLDTL_OBJS := $(call gen-obj-paths-from-src,$(AOCLDTL_SRC_SUFS ) ,$(MK_AOCLDTL_SRC ) ,$(AOCLDTL_PATH ) ,$(BASE_OBJ_AOCLDTL_PATH ) )
238253
239-
240-
241254# Generate object file paths for the sandbox source code. If a sandbox was not
242255# enabled a configure-time, this variable will we empty.
243256MK_SANDBOX_OBJS := $(call gen-obj-paths-from-src,$(SANDBOX_SRC_SUFS ) ,$(MK_SANDBOX_SRC ) ,$(SANDBOX_PATH ) ,$(BASE_OBJ_SANDBOX_PATH ) )
@@ -248,6 +261,7 @@ MK_BLIS_OBJS := $(MK_CONFIG_OBJS) \
248261 $(MK_REFKERN_OBJS ) \
249262 $(MK_FRAME_OBJS ) \
250263 $(MK_AOCLDTL_OBJS ) \
264+ $(MK_ADDON_OBJS ) \
251265 $(MK_SANDBOX_OBJS )
252266
253267# Optionally filter out the BLAS and CBLAS compatibility layer object files.
@@ -590,6 +604,47 @@ endef
590604
591605# first argument: a configuration name from the union of config_list and
592606# config_name, used to look up the CFLAGS to use during compilation.
607+ # second argument: the C99 addon file suffix being considered.
608+ define make-c99-addon-rule
609+ $(BASE_OBJ_ADDON_PATH ) /%.o: $(ADDON_PATH ) /%.$(2 ) $(BLIS_H_FLAT ) $(ADDON_H99_FILES ) $(MAKE_DEFS_MK_PATHS )
610+ ifeq ($(ENABLE_VERBOSE ) ,yes)
611+ $(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
612+ else
613+ @echo "Compiling $$@" $(call get-addon-c99text-for,$(1))
614+ @$(CC) $(call get-addon-c99flags-for,$(1)) -c $$< -o $$@
615+ endif
616+ endef
617+
618+ # first argument: a configuration name from the union of config_list and
619+ # config_name, used to look up the CFLAGS to use during compilation.
620+ # second argument: the C99 addon file suffix being considered.
621+ # third argument: the name of the addon being considered.
622+ define make-c99-addon-kers-rule
623+ $(BASE_OBJ_ADDON_PATH ) /$(3 ) /$(KERNELS_DIR ) /%.o: $(ADDON_PATH ) /$(3 ) /$(KERNELS_DIR ) /%.$(2 ) $(BLIS_H_FLAT ) $(ADDON_H99_FILES ) $(MAKE_DEFS_MK_PATHS )
624+ ifeq ($(ENABLE_VERBOSE ) ,yes)
625+ $(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
626+ else
627+ @echo "Compiling $$@" $(call get-addon-kernel-text-for,$(1))
628+ @$(CC) $(call get-addon-kernel-c99flags-for,$(1)) -c $$< -o $$@
629+ endif
630+ endef
631+
632+ # first argument: a configuration name from the union of config_list and
633+ # config_name, used to look up the CFLAGS to use during compilation.
634+ # second argument: the C++ addon file suffix being considered.
635+ define make-cxx-addon-rule
636+ $(BASE_OBJ_ADDON_PATH ) /%.o: $(ADDON_PATH ) /%.$(2 ) $(BLIS_H_FLAT ) $(ADDON_HXX_FILES ) $(MAKE_DEFS_MK_PATHS )
637+ ifeq ($(ENABLE_VERBOSE ) ,yes)
638+ $(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
639+ else
640+ @echo "Compiling $$@" $(call get-addon-cxxtext-for,$(1))
641+ @$(CXX) $(call get-addon-cxxflags-for,$(1)) -c $$< -o $$@
642+ endif
643+ endef
644+
645+ # first argument: a configuration name from the union of config_list and
646+ # config_name, used to look up the CFLAGS to use during compilation.
647+ # second argument: the C99 sandbox file suffix being considered.
593648define make-c99-sandbox-rule
594649$(BASE_OBJ_SANDBOX_PATH ) /%.o: $(SANDBOX_PATH ) /%.$(2 ) $(BLIS_H_FLAT ) $(SANDBOX_H99_FILES ) $(MAKE_DEFS_MK_PATHS )
595650ifeq ($(ENABLE_VERBOSE ) ,yes)
600655endif
601656endef
602657
658+ # first argument: a configuration name from the union of config_list and
659+ # config_name, used to look up the CFLAGS to use during compilation.
660+ # second argument: the C++ sandbox file suffix being considered.
603661define make-cxx-sandbox-rule
604662$(BASE_OBJ_SANDBOX_PATH ) /%.o: $(SANDBOX_PATH ) /%.$(2 ) $(BLIS_H_FLAT ) $(SANDBOX_HXX_FILES ) $(MAKE_DEFS_MK_PATHS )
605663ifeq ($(ENABLE_VERBOSE ) ,yes)
@@ -648,6 +706,22 @@ $(foreach conf, $(CONFIG_LIST), $(eval $(call make-refkern-rule,$(conf))))
648706$(foreach suf, $(KERNELS_SRC_SUFS), \
649707$(foreach kset, $(KERNEL_LIST), $(eval $(call make-kernels-rule,$(kset),$(call get-config-for-kset,$(kset)),$(suf)))))
650708
709+ # Instantiate the build rule for C addon files. Use the CFLAGS for the
710+ # configuration family.
711+ $(foreach suf, $(ADDON_C99_SUFS), \
712+ $(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-rule,$(conf),$(suf)))))
713+
714+ # Instantiate the build rule for C addon/kernels files. Use the CFLAGS for the
715+ # configuration family.
716+ $(foreach addon, $(ADDON_LIST), \
717+ $(foreach suf, $(ADDON_C99_SUFS), \
718+ $(foreach conf, $(CONFIG_NAME), $(eval $(call make-c99-addon-kers-rule,$(conf),$(suf),$(addon))))))
719+
720+ # Instantiate the build rule for C++ addon files. Use the CFLAGS for the
721+ # configuration family.
722+ $(foreach suf, $(ADDON_CXX_SUFS), \
723+ $(foreach conf, $(CONFIG_NAME), $(eval $(call make-cxx-addon-rule,$(conf),$(suf)))))
724+
651725# Instantiate the build rule for C sandbox files. Use the CFLAGS for the
652726# configuration family.
653727$(foreach suf, $(SANDBOX_C99_SUFS), \
@@ -1141,6 +1215,9 @@ ifeq ($(ENABLE_VERBOSE),yes)
11411215 - $(FIND) $(AOCLDTL_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
11421216 - $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
11431217 - $(FIND) $(KERNELS_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1218+ ifneq ($(ADDON_LIST ) ,)
1219+ - $(FIND) $(ADDON_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1220+ endif
11441221ifneq ($(SANDBOX ) ,)
11451222 - $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
11461223endif
@@ -1155,6 +1232,10 @@ else
11551232 @- $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
11561233 @echo "Removing makefile fragments from $(KERNELS_FRAG_PATH)"
11571234 @- $(FIND) $(KERNELS_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1235+ ifneq ($(ADDON_LIST ) ,)
1236+ @echo "Removing makefile fragments from $(ADDON_FRAG_PATH)"
1237+ @- $(FIND) $(ADDON_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
1238+ endif
11581239ifneq ($(SANDBOX ) ,)
11591240 @echo "Removing makefile fragments from $(SANDBOX_FRAG_PATH)"
11601241 @- $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
@@ -1275,13 +1356,16 @@ endif # IS_CONFIGURED
12751356distclean : cleanmk cleanh cleanlib cleantest
12761357ifeq ($(IS_CONFIGURED ) ,yes)
12771358ifeq ($(ENABLE_VERBOSE ) ,yes)
1359+ - $(RM_F) $(BLIS_ADDON_H)
12781360 - $(RM_F) $(BLIS_CONFIG_H)
12791361 - $(RM_F) $(CONFIG_MK_FILE)
12801362 - $(RM_F) $(PC_OUT_FILE)
12811363 - $(RM_RF) $(OBJ_DIR)
12821364 - $(RM_RF) $(LIB_DIR)
12831365 - $(RM_RF) $(INCLUDE_DIR)
12841366else
1367+ @echo "Removing $(BLIS_ADDON_H)"
1368+ @$(RM_F) $(BLIS_ADDON_H)
12851369 @echo "Removing $(BLIS_CONFIG_H)"
12861370 @$(RM_F) $(BLIS_CONFIG_H)
12871371 @echo "Removing $(CONFIG_MK_FILE)"
0 commit comments