+# termlib may be named explicitly via "--with-termlib=XXX", which overrides
+# any suffix. Temporarily override "suffix" to account for this.
+function termlib_end_of() {
+ termlib_save_suffix = suffix;
+ suffix = TermlibSuffix;
+ termlib_temp_result = end_name_of(TermlibRoot);
+ suffix = termlib_save_suffix;
+ return termlib_temp_result;
+}
+function shlib_build(directory) {
+ dst_libs = sprintf("%s/%s", directory, end_name);
+ printf "%s : \\\n", dst_libs
+ if (subset == "ticlib" && driver == "yes" ) {
+ base = name;
+ sub(/^tic/, "ncurses", base); # workaround for "w"
+ printf "\t\t%s/%s \\\n", directory, end_name_of(base);
+ }
+ if (subset ~ /^base/ || subset == "ticlib" ) {
+ save_suffix = suffix
+ sub(/^[^.]\./,".",suffix)
+ if (directory != "../lib") {
+ printf "\t\t%s/%s \\\n", "../lib", termlib_end_of();
+ }
+ printf "\t\t%s/%s \\\n", directory, termlib_end_of();
+ suffix = save_suffix
+ }
+ printf "\t\t$(RESULTING_SYMS) $(%s_OBJS)\n", OBJS
+ printf "\t@echo linking $@\n"
+ printf "\t@mkdir -p %s\n", directory
+ if ( ReLink != "yes" ) {
+ printf "\t@sleep 1\n"
+ }
+ if ( is_ticlib() ) {
+ make_shlib(OBJS, "TICS_LIST")
+ } else if ( is_termlib() ) {
+ make_shlib(OBJS, "TINFO_LIST")
+ } else {
+ make_shlib(OBJS, "SHLIB_LIST")
+ }
+ sharedlinks(directory)
+ }
+function shlib_install(directory) {
+ src_lib1 = sprintf("../lib/%s", end_name);
+ dst_lib1 = sprintf("%s/%s", directory, end_name);
+ printf "%s : \\\n", dst_lib1
+ printf "\t\t%s \\\n", directory
+ printf "\t\t%s\n", src_lib1
+ printf "\t@echo installing $@\n"
+ printf "\t$(INSTALL_LIB) %s %s\n", src_lib1, dst_lib1;
+ sharedlinks(directory)
+ }
+function install_dll(directory,filename) {
+ src_name = sprintf("../lib/%s", filename);
+ dst_name = sprintf("$(DESTDIR)%s/%s", directory, filename);
+ printf "\t@echo installing %s as %s\n", src_name, dst_name
+ if ( directory == "$(bindir)" ) {
+ program = "$(INSTALL) -m 755";
+ } else {
+ program = "$(INSTALL_LIB)";
+ }
+ printf "\t%s %s %s\n", program, src_name, dst_name
+ }
+function in_subset(value) {
+ value = " " value " ";
+ check = subset;
+ gsub("[+]", " ", check);
+ check = " " check " ";
+ return index(check,value);
+ }
+function trim_suffix(value) {
+ if (USE_LIB_SUFFIX != "" && length(value) > length(USE_LIB_SUFFIX)) {
+ check = substr(value, 1 + length(value) - length(USE_LIB_SUFFIX));
+ if (check == USE_LIB_SUFFIX) {
+ value = substr(value, 1, length(value) - length(USE_LIB_SUFFIX));
+ }
+ }
+ return value;
+}