1 # $Id: mk-hdr.awk,v 1.8 2021/06/17 21:20:30 tom Exp $
2 ##############################################################################
3 # Copyright 2020,2021 Thomas E. Dickey #
4 # Copyright 2007-2010,2013 Free Software Foundation, Inc. #
6 # Permission is hereby granted, free of charge, to any person obtaining a #
7 # copy of this software and associated documentation files (the "Software"), #
8 # to deal in the Software without restriction, including without limitation #
9 # the rights to use, copy, modify, merge, publish, distribute, distribute #
10 # with modifications, sublicense, and/or sell copies of the Software, and to #
11 # permit persons to whom the Software is furnished to do so, subject to the #
12 # following conditions: #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
20 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
23 # DEALINGS IN THE SOFTWARE. #
25 # Except as contained in this notice, the name(s) of the above copyright #
26 # holders shall not be used in advertising or otherwise to promote the sale, #
27 # use or other dealings in this Software without prior written #
29 ##############################################################################
31 # Author: Thomas E. Dickey 2007
33 # Generate install/uninstall rules for header files
35 # subset ("none", "base", "base+ext_funcs" or "termlib", etc.)
36 # compat ("yes" or "no", flag to add link to curses.h
38 function basename(path) {
42 function in_subset(value) {
43 value = " " value " ";
45 gsub("[+]", " ", check);
46 check = " " check " ";
47 return index(check,value);
56 if (subset == "none") {
58 } else if (in_subset($2) > 0) {
68 if (using && NF != 0) {
71 print "# generated by mk-hdr.awk"
72 printf "# subset: %s\n", subset
73 printf "# compat: %s\n", compat
84 print "${INCLUDEDIR} :"
88 print "install.libs \\"
89 print "install.includes :: ${AUTO_SRC} ${INCLUDEDIR} \\"
91 for (i = 0; i < count - 1; ++i) {
92 printf " %s \\\n", data[i]
94 printf " %s\n", data[count - 1]
96 for (i = 0; i < count; ++i) {
97 printf " @ (cd ${INCLUDEDIR} && rm -f %s) ; ../headers.sh ${INSTALL_DATA} ${INCLUDEDIR} ${srcdir} %s\n", basename(data[i]), data[i]
98 if (data[i] == "curses.h" && compat == "yes") {
99 printf " @ (cd ${INCLUDEDIR} && rm -f ncurses.h && ${LN_S} %s ncurses.h)\n", data[i]
104 print "uninstall.libs \\"
105 print "uninstall.includes ::"
107 for (i = 0; i < count; ++i) {
108 printf " -@ (cd ${INCLUDEDIR} && rm -f %s)\n", basename(data[i])
109 if (data[i] == "curses.h" && compat == "yes") {
110 printf " -@ (cd ${INCLUDEDIR} && rm -f ncurses.h)\n"