diff options
Diffstat (limited to 'mk-1st.awk')
| -rw-r--r-- | mk-1st.awk | 105 |
1 files changed, 51 insertions, 54 deletions
diff --git a/mk-1st.awk b/mk-1st.awk index 6a5eafab26cf..5b2c8b8d8a32 100644 --- a/mk-1st.awk +++ b/mk-1st.awk @@ -1,6 +1,6 @@ -# $Id: mk-1st.awk,v 1.125 2023/04/22 15:49:59 tom Exp $ +# $Id: mk-1st.awk,v 1.131 2025/10/04 20:34:43 Branden.Robinson Exp $ ############################################################################## -# Copyright 2018-2021,2023 Thomas E. Dickey # +# Copyright 2018-2024,2025 Thomas E. Dickey # # Copyright 1998-2016,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -32,36 +32,35 @@ # # Generate list of objects for a given model library # Variables: -# name (library name, e.g., "ncurses", "panel", "forms", "menus") +# name (library name, e.g., "ncurses", "panel", "form", "menu") # traces ("all" or "DEBUG", to control whether tracing is compiled in) # MODEL (e.g., "DEBUG", uppercase; toupper is not portable) # CXX_MODEL (e.g., "DEBUG", uppercase) # LIB_SUFFIX (e.g., "", "w", "t", "tw") -# USE_LIB_SUFFIX (e.g., "", "w", "t", "tw") +# ABI_SUFFIX (e.g., "", "w", "t", "tw") # model (directory into which we compile, e.g., "obj") # prefix (e.g., "lib", for Unix-style libraries) # suffix (e.g., "_g.a", for debug libraries) +# o (object suffix) (e.g., ".o") # subset ("none", "base", "base+ext_funcs" or "termlib", etc.) # driver ("yes" or "no", depends on --enable-term-driver) # ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable) -# ShlibVerInfix ("yes" or "no", determines location of version #) +# ShlibVerInfix ("yes" or "no", determines location of version #) # SymLink ("ln -s", etc) # TermlibRoot ("tinfo" or other root for libterm.so) -# TermlibSuffix (".so" or other suffix for libterm.so) +# TermlibSuffix (".so" or other suffix for libterm.so) # ReLink ("yes", or "no", flag to rebuild shared libs on install) # ReRanlib ("yes", or "no", flag to rerun ranlib for installing static) # DoLinks ("yes", "reverse" or "no", flag to add symbolic links) # rmSoLocs ("yes" or "no", flag to add extra clean target) # ldconfig (path for this tool, if used) -# make_phony ("yes" if the make-program accepts ".PHONY" directive. +# make_phony ("yes" if the make-program accepts ".PHONY" directive. # overwrite ("yes" or "no", flag to add link to libcurses.a # depend (optional dependencies for all objects, e.g, ncurses_cfg.h) # host (cross-compile host, if any) -# libtool_version (libtool "-version-info" or "-version-number") +# libtool_version (libtool "-version-info" or "-version-number") # # Notes: -# CLIXs nawk does not like underscores in command-line variable names. -# Mixed-case variable names are ok. # HP-UX requires shared libraries to have executable permissions. # function is_ticlib() { @@ -253,9 +252,9 @@ function shlib_install(directory) { } function install_dll(directory,filename) { src_name = sprintf("../lib/%s", filename); - dst_name = sprintf("$(DESTDIR)%s/%s", directory, filename); + dst_name = sprintf("%s/%s", directory, filename); printf "\t@echo installing %s as %s\n", src_name, dst_name - if ( directory == "$(bindir)" ) { + if ( directory == "$(BINDIR)" ) { program = "$(INSTALL) -m 755"; } else { program = "$(INSTALL_LIB)"; @@ -270,10 +269,10 @@ function in_subset(value) { 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)); + if (ABI_SUFFIX != "" && length(value) > length(ABI_SUFFIX)) { + check = substr(value, 1 + length(value) - length(ABI_SUFFIX)); + if (check == ABI_SUFFIX) { + value = substr(value, 1, length(value) - length(ABI_SUFFIX)); } } return value; @@ -308,7 +307,7 @@ BEGIN { printf "# MODEL: %s\n", MODEL printf "# CXX_MODEL: %s\n", CXX_MODEL printf "# LIB_SUFFIX: %s\n", LIB_SUFFIX - printf "# USE_LIB_SUFFIX: %s\n", USE_LIB_SUFFIX + printf "# ABI_SUFFIX: %s\n", ABI_SUFFIX printf "# model: %s\n", model printf "# prefix: %s\n", prefix printf "# suffix: %s\n", suffix @@ -368,10 +367,8 @@ BEGIN { found = 2; } if ( $2 == "c++" ) { - CC_NAME="CXX" CC_FLAG="CXXFLAGS" } else { - CC_NAME="CC" CC_FLAG="CFLAGS" } } @@ -403,14 +400,14 @@ END { if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)"; + dst_dirs = "$(BINDIR) $(LIBDIR)"; printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs - install_dll("$(bindir)",end_name); - install_dll("$(libdir)",imp_name); + install_dll("$(BINDIR)",end_name); + install_dll("$(LIBDIR)",imp_name); } else { - lib_dir = "$(DESTDIR)$(libdir)"; + lib_dir = "$(LIBDIR)"; printf "install.%s :: %s/%s\n", name, lib_dir, end_name print "" if ( ReLink == "yes" ) { @@ -430,13 +427,13 @@ END { } ovr_name = sprintf("%scurses%s.a", curses_prefix, suffix) printf "\t@echo linking %s to %s\n", imp_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" + printf "\tcd $(LIBDIR) && (" symlink(imp_name, ovr_name) printf ")\n" } else { ovr_name = sprintf("libcurses%s", suffix) printf "\t@echo linking %s to %s\n", end_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" + printf "\tcd $(LIBDIR) && (" symlink(end_name, ovr_name) printf ")\n" } @@ -450,19 +447,19 @@ END { printf "uninstall.%s ::\n", name if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name - printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name + printf "\t@echo uninstalling $(BINDIR)/%s\n", end_name + printf "\t-@rm -f $(BINDIR)/%s\n", end_name - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", imp_name - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", imp_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", imp_name + printf "\t-@rm -f $(LIBDIR)/%s\n", imp_name } else { - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", end_name - removelinks("$(DESTDIR)$(libdir)") + printf "\t@echo uninstalling $(LIBDIR)/%s\n", end_name + removelinks("$(LIBDIR)") if ( overwrite == "yes" && name == "ncurses" ) { ovr_name = sprintf("libcurses%s", suffix) - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", ovr_name + printf "\t-@rm -f $(LIBDIR)/%s\n", ovr_name } } if ( rmSoLocs == "yes" ) { @@ -475,12 +472,12 @@ END { else if ( MODEL == "LIBTOOL" ) { end_name = lib_name; - use_name = trim_suffix(TermlibRoot) USE_LIB_SUFFIX + use_name = trim_suffix(TermlibRoot) ABI_SUFFIX printf "../lib/%s : \\\n", lib_name if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) { printf "\t\t../lib/lib%s.la \\\n", use_name; if ( index(name, "tic") == 1 && index(TermlibRoot, "ncurses") != 1 ) { - printf "\t\t../lib/lib%s%s.la \\\n", "ncurses", USE_LIB_SUFFIX; + printf "\t\t../lib/lib%s%s.la \\\n", "ncurses", ABI_SUFFIX; } } printf "\t\t$(%s_OBJS)\n", OBJS @@ -491,7 +488,7 @@ END { } else { which_list = "SHLIB_LIST"; } - printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) $(%s) \\\n", CC_NAME, CC_FLAG; + printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) \\\n", CC_FLAG; printf "\t\t-o %s $(%s_OBJS:$o=.lo) \\\n", lib_name, OBJS; printf "\t\t-rpath $(libdir) \\\n"; printf "\t\t%s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(%s) $(LDFLAGS)\n", libtool_version, which_list; @@ -503,8 +500,8 @@ END { print "install \\" print "install.libs \\" printf "install.%s :: \\\n", trim_suffix(name); - printf "\t\t$(DESTDIR)$(libdir) \\\n"; - use_name = TermlibRoot USE_LIB_SUFFIX + printf "\t\t$(LIBDIR) \\\n"; + use_name = TermlibRoot ABI_SUFFIX if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) { if ( trim_suffix(TermlibRoot) != trim_suffix(name) ) { printf "\t\tinstall.%s \\\n", trim_suffix(TermlibRoot); @@ -514,14 +511,14 @@ END { } } printf "\t\t../lib/%s\n", lib_name - printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name - printf "\tcd ../lib; $(LIBTOOL_INSTALL) $(INSTALL) %s $(DESTDIR)$(libdir)\n", lib_name + printf "\t@echo installing ../lib/%s as $(LIBDIR)/%s\n", lib_name, lib_name + printf "\tcd ../lib; $(LIBTOOL_INSTALL) $(INSTALL) %s $(LIBDIR)\n", lib_name print "" print "uninstall \\" print "uninstall.libs \\" printf "uninstall.%s ::\n", trim_suffix(name) - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name - printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", lib_name + printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(LIBDIR)/%s\n", lib_name } else { @@ -542,41 +539,41 @@ END { print "" print "install \\" print "install.libs \\" - printf "install.%s :: $(DESTDIR)$(libdir) ../lib/%s\n", name, lib_name - printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name - printf "\t$(INSTALL_DATA) ../lib/%s $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name + printf "install.%s :: $(LIBDIR) ../lib/%s\n", name, lib_name + printf "\t@echo installing ../lib/%s as $(LIBDIR)/%s\n", lib_name, lib_name + printf "\t$(INSTALL_DATA) ../lib/%s $(LIBDIR)/%s\n", lib_name, lib_name if ( overwrite == "yes" && lib_name == "libncurses.a" ) { printf "\t@echo linking libcurses.a to libncurses.a\n" - printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n" - printf "\t(cd $(DESTDIR)$(libdir) && " + printf "\t-@rm -f $(LIBDIR)/libcurses.a\n" + printf "\t(cd $(LIBDIR) && " symlink("libncurses.a", "libcurses.a") printf ")\n" } if ( ReRanlib == "yes" ) { - printf "\t$(RANLIB) $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t$(RANLIB) $(LIBDIR)/%s\n", lib_name } if ( host == "vxworks" ) { - printf "\t@echo installing ../lib/lib%s$o as $(DESTDIR)$(libdir)/lib%s$o\n", name, name - printf "\t$(INSTALL_DATA) ../lib/lib%s$o $(DESTDIR)$(libdir)/lib%s$o\n", name, name + printf "\t@echo installing ../lib/lib%s$o as $(LIBDIR)/lib%s$o\n", name, name + printf "\t$(INSTALL_DATA) ../lib/lib%s$o $(LIBDIR)/lib%s$o\n", name, name } print "" print "uninstall \\" print "uninstall.libs \\" printf "uninstall.%s ::\n", name - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name - printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t@echo uninstalling $(LIBDIR)/%s\n", lib_name + printf "\t-@rm -f $(LIBDIR)/%s\n", lib_name if ( overwrite == "yes" && lib_name == "libncurses.a" ) { printf "\t@echo linking libcurses.a to libncurses.a\n" - printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n" + printf "\t-@rm -f $(LIBDIR)/libcurses.a\n" } if ( host == "vxworks" ) { - printf "\t@echo uninstalling $(DESTDIR)$(libdir)/lib%s$o\n", name - printf "\t-@rm -f $(DESTDIR)$(libdir)/lib%s$o\n", name + printf "\t@echo uninstalling $(LIBDIR)/lib%s$o\n", name + printf "\t-@rm -f $(LIBDIR)/lib%s$o\n", name } } print "" |
