Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ config.mk
bli_config.h
bli_addon.h
blis.pc
.dist_path
.install_libdir
.install_incdir
.install_sharedir

# -- monolithic headers --

Expand Down
81 changes: 46 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
check checkblas \
checkblis checkblis-fast checkblis-md checkblis-salt \
install-headers install-helper-headers install-libs install-lib-symlinks \
make-symlinks make-install-symlinks \
showconfig \
clean cleanmk cleanh cleanlib distclean \
cleantest cleanblastest cleanblistest \
Expand Down Expand Up @@ -524,7 +525,7 @@ clean: cleanh cleanlib

# --- Environment check rules ---

check-env: check-env-make-defs check-env-fragments check-env-mk
check-env: check-env-make-defs check-env-fragments check-env-mk make-symlinks

check-env-mk:
ifeq ($(CONFIG_MK_PRESENT),no)
Expand All @@ -541,6 +542,23 @@ ifeq ($(ALL_MAKE_DEFS_MK_PRESENT),no)
$(error Cannot proceed: Some make_defs.mk files not found or mislabeled!)
endif

make-symlinks:
# @rm -f .dist_path
# @ln -s "$(DIST_PATH_REAL)" .dist_path

make-install-symlinks:
# @rm -f .install_libdir
# @rm -f .install_incdir
# @rm -f .install_shredir
# @ln -s "$(INSTALL_LIBDIR_REAL)" .install_libdir
# @ln -s "$(INSTALL_INCDIR_REAL)" .install_incdir
# @ln -s "$(INSTALL_SHAREDIR_REAL)" .install_sharedir
@mkdir -p "$(INSTALL_LIBDIR_REAL)"
@mkdir -p "$(INSTALL_INCDIR_REAL)"
@mkdir -p "$(INSTALL_SHAREDIR_REAL)"

$(CONFIG_MK_FILE) $(ALL_H99_FILES): check-env


# --- Shared/dynamic libblis symbol file creation/refresh ---

Expand Down Expand Up @@ -1085,37 +1103,35 @@ endif
install-headers: check-env $(HEADERS_INSTALLED) install-helper-headers

# Rule for installing main headers.
$(MK_INCL_DIR_INST)/%.h: $(BASE_INC_PATH)/%.h $(CONFIG_MK_FILE)
$(MK_INCL_DIR_INST)/%.h: $(BASE_INC_PATH)/%.h $(CONFIG_MK_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(dir $(@))
$(INSTALL) -m 0644 $(<) $(dir $(@))
else
@$(MKDIR) $(dir $(@))
@echo "Installing $(notdir $(<)) into $(dir $(@))/"
@echo "Installing $(notdir $(<)) into $(subst .install_incdir,$(INSTALL_INCDIR_REAL),$(dir $(@)))"
@$(INSTALL) -m 0644 $(<) $(dir $(@))
endif

$(MK_INCL_DIR_INST)/%.hh: $(VEND_CPP_PATH)/%.hh $(CONFIG_MK_FILE)
$(MK_INCL_DIR_INST)/%.hh: $(VEND_CPP_PATH)/%.hh $(CONFIG_MK_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(dir $(@))
$(INSTALL) -m 0644 $(<) $(dir $(@))
else
@$(MKDIR) $(dir $(@))
@echo "Installing $(notdir $(<)) into $(dir $(@))/"
@echo "Installing $(notdir $(<)) into $(subst .install_incdir,$(INSTALL_INCDIR_REAL),$(dir $(@)))"
@$(INSTALL) -m 0644 $(<) $(dir $(@))
endif

install-helper-headers: check-env $(HELP_HEADERS_INSTALLED)

# A rule to install a helper header file.
define make-helper-header-rule
$(INSTALL_INCDIR)/$(notdir $(1)): $(BUILD_PATH)/$(notdir $(1)) $(CONFIG_MK_FILE)
$(INSTALL_INCDIR)/$(notdir $(1)): $(BUILD_PATH)/$(notdir $(1)) $(CONFIG_MK_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(INSTALL_INCDIR)
$(INSTALL) -m 0644 $$(<) $$(@)
else
@$(MKDIR) $(INSTALL_INCDIR)
@echo "Installing $$(@F) helper header into $(INSTALL_INCDIR)/"
@echo "Installing $$(@F) helper header into $(INSTALL_INCDIR_REAL)/"
@$(INSTALL) -m 0644 $$(<) $$(@)
endif
endef
Expand All @@ -1127,7 +1143,7 @@ $(foreach h, $(HELP_HEADERS_TO_INSTALL), $(eval $(call make-helper-header-rule,$

install-share: check-env $(MK_SHARE_DIR_INST) $(PC_SHARE_DIR_INST)

$(MK_SHARE_DIR_INST): $(CONFIGURE_FILE) $(FRAGS_TO_INSTALL) $(PLUGIN_FRAGS_TO_INSTALL) $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE)
$(MK_SHARE_DIR_INST): $(CONFIGURE_FILE) $(FRAGS_TO_INSTALL) $(PLUGIN_FRAGS_TO_INSTALL) $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(@)
$(MKDIR) $(@)/plugin
Expand All @@ -1148,29 +1164,29 @@ ifeq ($(ENABLE_VERBOSE),yes)
else
@$(MKDIR) $(@)
@$(MKDIR) $(@)/plugin
@echo "Installing $(notdir $(FRAGS_TO_INSTALL)) into $(@)/"
@echo "Installing $(notdir $(FRAGS_TO_INSTALL)) into $(INSTALL_SHAREDIR_REAL)/"
@$(INSTALL) -m 0755 $(filter %.sh,$(FRAGS_TO_INSTALL)) $(@)
@$(INSTALL) -m 0644 $(filter-out %.sh,$(FRAGS_TO_INSTALL)) $(@)
@echo "Installing $(notdir $(PLUGIN_FRAGS_TO_INSTALL)) into $(@)/plugin/"
@echo "Installing $(notdir $(PLUGIN_FRAGS_TO_INSTALL)) into $(INSTALL_SHAREDIR_REAL)/plugin/"
@$(INSTALL) -m 0644 $(PLUGIN_FRAGS_TO_INSTALL) $(@)/plugin
@echo "Installing $(CONFIGURE_FILE) into $(@)/configure-plugin"
@echo "Installing $(CONFIGURE_FILE) into $(INSTALL_SHAREDIR_REAL)/configure-plugin"
@$(INSTALL) -m 0755 $(CONFIGURE_FILE) $(@)/configure-plugin
# @$(MKDIR) -p $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)#\
# @echo "Installing $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) into $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)"
# @$(INSTALL) -m 0644 $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) \
# $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)/
@for THIS_CONFIG in $(FULL_CONFIG_LIST); do \
$(MKDIR) -p $(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) into $(@)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) into $(INSTALL_SHAREDIR_REAL)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
$(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/$(MAKE_DEFS_FILE) \
$(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h into $(@)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
echo "Installing $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h into $(INSTALL_SHAREDIR_REAL)/$(CONFIG_DIR)/$$THIS_CONFIG"; \
$(INSTALL) -m 0644 $(CONFIG_DIR)/$$THIS_CONFIG/bli_kernel_defs_$$THIS_CONFIG.h \
$(@)/$(CONFIG_DIR)/$$THIS_CONFIG; \
done
endif

$(PC_SHARE_DIR_INST): $(PC_IN_FILE)
$(PC_SHARE_DIR_INST): $(PC_IN_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(@)
$(shell cat "$(PC_IN_FILE)" \
Expand All @@ -1184,7 +1200,7 @@ ifeq ($(ENABLE_VERBOSE),yes)
$(INSTALL) -m 0644 $(PC_OUT_FILE) $(@)
else
@$(MKDIR) $(@)
@echo "Installing $(PC_OUT_FILE) into $(@)/"
@echo "Installing $(PC_OUT_FILE) into $(subst .install_sharedir,$(INSTALL_SHAREDIR_REAL),$(@))"
@$(shell cat "$(PC_IN_FILE)" \
| sed -e "s#@PACKAGE_VERSION@#$(VERSION)#g" \
| sed -e "s#@prefix@#$(prefix)#g" \
Expand All @@ -1201,13 +1217,11 @@ endif
install-libs: check-env $(MK_LIBS_INST)

# Install static library.
$(INSTALL_LIBDIR)/%.a: $(BASE_LIB_PATH)/%.a $(CONFIG_MK_FILE)
$(INSTALL_LIBDIR)/%.a: $(BASE_LIB_PATH)/%.a $(CONFIG_MK_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(@D)
$(INSTALL) -m 0644 $< $@
else
@echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
@$(MKDIR) $(@D)
@echo "Installing $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(INSTALL) -m 0644 $< $@
endif

Expand All @@ -1217,36 +1231,30 @@ endif
ifeq ($(IS_WIN),no)

# Linux/OSX library (.so OR .dylib) installation rules.
$(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MMB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT) $(CONFIG_MK_FILE)
$(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MMB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT) $(CONFIG_MK_FILE) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
$(MKDIR) $(@D)
$(INSTALL) -m 0755 $< $@
else
@echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
@$(MKDIR) $(@D)
@echo "Installing $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(INSTALL) -m 0755 $< $@
endif

else # ifeq ($(IS_WIN),yes)

# Windows library (.dll and .lib) installation rules.
$(INSTALL_LIBDIR)/%.$(SHLIB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT)
$(INSTALL_LIBDIR)/%.$(SHLIB_EXT): $(BASE_LIB_PATH)/%.$(SHLIB_EXT) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
@$(MKDIR) $(@D)
@$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
else
@echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
@$(MKDIR) $(@D)
@echo "Installing $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
endif

$(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MAJ_EXT): $(BASE_LIB_PATH)/%.$(LIBBLIS_SO_MAJ_EXT)
$(INSTALL_LIBDIR)/%.$(LIBBLIS_SO_MAJ_EXT): $(BASE_LIB_PATH)/%.$(LIBBLIS_SO_MAJ_EXT) make-install-symlinks
ifeq ($(ENABLE_VERBOSE),yes)
@$(MKDIR) $(@D)
@$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
else
@echo "Installing $(@F) into $(INSTALL_LIBDIR)/"
@$(MKDIR) $(@D)
@echo "Installing $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(INSTALL) -m 0644 $(BASE_LIB_PATH)/$(@F) $@
endif

Expand All @@ -1265,7 +1273,7 @@ ifeq ($(ENABLE_VERBOSE),yes)
$(SYMLINK) $(<F) $(@F)
$(MV) $(@F) $(INSTALL_LIBDIR)/
else
@echo "Installing symlink $(@F) into $(INSTALL_LIBDIR)/"
@echo "Installing symlink $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(SYMLINK) $(<F) $(@F)
@$(MV) $(@F) $(INSTALL_LIBDIR)/
endif
Expand All @@ -1276,7 +1284,7 @@ ifeq ($(ENABLE_VERBOSE),yes)
$(SYMLINK) $(<F) $(@F)
$(MV) $(@F) $(INSTALL_LIBDIR)/
else
@echo "Installing symlink $(@F) into $(INSTALL_LIBDIR)/"
@echo "Installing symlink $(@F) into $(INSTALL_LIBDIR_REAL)/"
@$(SYMLINK) $(<F) $(@F)
@$(MV) $(@F) $(INSTALL_LIBDIR)/
endif
Expand Down Expand Up @@ -1312,6 +1320,7 @@ showconfig: check-env
cleanmk:
ifeq ($(IS_CONFIGURED),yes)
ifeq ($(ENABLE_VERBOSE),yes)
- $(RM_F) .dist_path .install_libdir .install_incdir .install_sharedir
- $(FIND) $(CONFIG_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
- $(FIND) $(FRAME_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
- $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
Expand All @@ -1323,6 +1332,8 @@ ifneq ($(SANDBOX),)
- $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
endif
else
@echo "Removing helper symlinks"
@- $(RM_F) .dist_path .install_libdir .install_incdir .install_sharedir
@echo "Removing makefile fragments from $(CONFIG_FRAG_PATH)"
@- $(FIND) $(CONFIG_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F)
@echo "Removing makefile fragments from $(FRAME_FRAG_PATH)"
Expand Down
32 changes: 16 additions & 16 deletions build/gen-make-frags/gen-make-frag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ gen_mkfile()


# Make sure the target directory exists
mkdir -p $this_frag_dir
mkdir -p "$this_frag_dir"


# Strip the leading path from the template makefile path to get its
Expand All @@ -168,7 +168,7 @@ gen_mkfile()
local_src_files=""

# Get a listing of the items in $this_dir
sub_items=$(ls $this_dir)
sub_items=$(ls "$this_dir")

# Generate a list of the source files we've chosen
for item in $sub_items; do
Expand All @@ -194,7 +194,7 @@ gen_mkfile()
cur_frag_sub_dirs=""

# Capture the relative path listing of items in $this_dir.
sub_items=$(ls $this_dir)
sub_items=$(ls "$this_dir")

# Determine the fragment's subdirectory names, if any exist
for item in $sub_items; do
Expand All @@ -204,8 +204,8 @@ gen_mkfile()

# If item is a directory, and it's not in the ignore list, descend into it.
#if [ -d $item_path ] && ! should_ignore $item; then
if [ "$recursive_flag" = "1" ] && [ -d $item_path ] && ! is_in_list $item "$ignore_dirs" ; then
cur_frag_sub_dirs=$cur_frag_sub_dirs" "$item
if [ "$recursive_flag" = "1" ] && [ -d "$item_path" ] && ! is_in_list $item "$ignore_dirs" ; then
cur_frag_sub_dirs="$cur_frag_sub_dirs $item"
fi
done

Expand All @@ -230,11 +230,11 @@ gen_mkfile()
# Copy the template makefile to the directory given, using the new
# makefile name we just created above.
if [ -z "$dry_run_flag" ]; then
cat $mkfile_frag_tmpl_path | sed -e s/"$mkfile_fragment_cur_dir_name_anchor"/"$cur_frag_dir"/g \
| sed -e s/"$mkfile_fragment_sub_dir_names_anchor"/"$cur_frag_sub_dirs"/g \
| sed -e s/"$mkfile_fragment_local_src_files_anchor"/"$local_src_files"/g \
| sed -e s/"$mkfile_fragment_src_var_name_anchor"/"$mkfile_frag_var_name"/g \
> $mkfile_frag_path
cat "$mkfile_frag_tmpl_path" | sed -e s/"$mkfile_fragment_cur_dir_name_anchor"/"$cur_frag_dir"/g \
| sed -e s/"$mkfile_fragment_sub_dir_names_anchor"/"$cur_frag_sub_dirs"/g \
| sed -e s/"$mkfile_fragment_local_src_files_anchor"/"$local_src_files"/g \
| sed -e s/"$mkfile_fragment_src_var_name_anchor"/"$mkfile_frag_var_name"/g \
> "$mkfile_frag_path"
fi


Expand Down Expand Up @@ -275,11 +275,11 @@ gen_mkfiles()


# Call our function to generate a makefile in the directory given.
gen_mkfile "${src_var_name}_$SRC" $cur_dir $this_frag_dir
gen_mkfile "${src_var_name}_$SRC" "$cur_dir" "$this_frag_dir"


# Get a listing of the directories in $directory
sub_items=$(ls $cur_dir)
sub_items=$(ls "$cur_dir")

# Descend into the contents of root_dir to generate the subdirectories'
# makefile fragments.
Expand All @@ -288,7 +288,7 @@ gen_mkfiles()
# If item is a directory, and it's not in the ignore list, descend into it.
#if [ -d "$cur_dir/$item" ] && ! should_ignore $item; then
if [ -d "$cur_dir/$item" ] && ! is_in_list $item "$ignore_dirs" ; then
gen_mkfiles $cur_dir/$item $this_frag_dir/$item
gen_mkfiles "$cur_dir/$item" "$this_frag_dir/$item"
fi
done

Expand Down Expand Up @@ -533,15 +533,15 @@ main()


# Call our function to generate a makefile in the root directory given.
gen_mkfile "${src_var_name}_$SRC" $root_dir $frag_dir
gen_mkfile "${src_var_name}_$SRC" "$root_dir" "$frag_dir"


# If we were asked to act recursively, then continue processing
# root_dir's contents.
if [ -n "$recursive_flag" ]; then

# Get a listing of the directories in $directory.
sub_items=$(ls $root_dir)
sub_items=$(ls "$root_dir")

# Descend into the contents of root_dir to generate the makefile
# fragments.
Expand All @@ -551,7 +551,7 @@ main()
#if [ -d "$root_dir/$item" ] && ! should_ignore $item ; then
if [ -d "$root_dir/$item" ] && ! is_in_list $item "$ignore_dirs" ; then

gen_mkfiles $root_dir/$item $frag_dir/$item
gen_mkfiles "$root_dir/$item" "$frag_dir/$item"
fi
done
fi
Expand Down
Loading