]> ncurses.scripts.mit.edu Git - ncurses.git/blob - mk-1st.awk
ncurses 6.4 - patch 20240414
[ncurses.git] / mk-1st.awk
1 # $Id: mk-1st.awk,v 1.123 2021/08/15 20:01:44 tom Exp $
2 ##############################################################################
3 # Copyright 2018-2020,2021 Thomas E. Dickey                                  #
4 # Copyright 1998-2016,2017 Free Software Foundation, Inc.                    #
5 #                                                                            #
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:                                                      #
13 #                                                                            #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software.                        #
16 #                                                                            #
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.                                                  #
24 #                                                                            #
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               #
28 # authorization.                                                             #
29 ##############################################################################
30 #
31 # Author: Thomas E. Dickey
32 #
33 # Generate list of objects for a given model library
34 # Variables:
35 #       name              (library name, e.g., "ncurses", "panel", "forms", "menus")
36 #       traces            ("all" or "DEBUG", to control whether tracing is compiled in)
37 #       MODEL             (e.g., "DEBUG", uppercase; toupper is not portable)
38 #       CXX_MODEL         (e.g., "DEBUG", uppercase)
39 #       LIB_SUFFIX        (e.g., "", "w", "t", "tw")
40 #       USE_LIB_SUFFIX (e.g., "", "w", "t", "tw")
41 #       model             (directory into which we compile, e.g., "obj")
42 #       prefix            (e.g., "lib", for Unix-style libraries)
43 #       suffix            (e.g., "_g.a", for debug libraries)
44 #       subset            ("none", "base", "base+ext_funcs" or "termlib", etc.)
45 #       driver            ("yes" or "no", depends on --enable-term-driver)
46 #       ShlibVer          ("rel", "abi" or "auto", to augment DoLinks variable)
47 #       ShlibVerInfix ("yes" or "no", determines location of version #)
48 #       SymLink           ("ln -s", etc)
49 #       TermlibRoot       ("tinfo" or other root for libterm.so)
50 #       TermlibSuffix (".so" or other suffix for libterm.so)
51 #       ReLink            ("yes", or "no", flag to rebuild shared libs on install)
52 #       ReRanlib          ("yes", or "no", flag to rerun ranlib for installing static)
53 #       DoLinks           ("yes", "reverse" or "no", flag to add symbolic links)
54 #       rmSoLocs          ("yes" or "no", flag to add extra clean target)
55 #       ldconfig          (path for this tool, if used)
56 #       make_phony    ("yes" if the make-program accepts ".PHONY" directive.
57 #       overwrite         ("yes" or "no", flag to add link to libcurses.a
58 #       depend            (optional dependencies for all objects, e.g, ncurses_cfg.h)
59 #       host              (cross-compile host, if any)
60 #       libtool_version (libtool "-version-info" or "-version-number")
61 #
62 # Notes:
63 #       CLIXs nawk does not like underscores in command-line variable names.
64 #       Mixed-case variable names are ok.
65 #       HP-UX requires shared libraries to have executable permissions.
66 #
67 function is_ticlib() {
68                 return ( subset ~ /^ticlib$/ );
69         }
70 function is_termlib() {
71                 return ( subset ~ /^(ticlib\+)?termlib((\+[^+ ]+)*\+[a-z_]+_tinfo)?$/ );
72         }
73 # see lib_name
74 function lib_name_of(a_name) {
75                 return sprintf("%s%s%s", prefix, a_name, suffix)
76         }
77 # see imp_name
78 function imp_name_of(a_name) {
79                 if (ShlibVerInfix == "cygdll" || ShlibVerInfix == "msysdll" || ShlibVerInfix == "mingw") {
80                         result = sprintf("%s%s%s.a", prefix, a_name, suffix);
81                 } else if (ShlibVerInfix == "msvcdll") {
82                         result = sprintf("%s%s%s.lib", prefix, a_name, suffix);
83                 } else{
84                         result = "";
85                 }
86                 return result;
87         }
88 # see abi_name
89 function abi_name_of(a_name) {
90                 if (ShlibVerInfix == "cygdll") {
91                         result = sprintf("%s%s$(ABI_VERSION)%s", "cyg", a_name, suffix);
92                 } else if (ShlibVerInfix == "msysdll") {
93                         result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix);
94                 } else if (ShlibVerInfix == "mingw" || ShlibVerInfix == "msvcdll") {
95                         result = sprintf("%s%s$(ABI_VERSION)%s", prefix, a_name, suffix);
96                 } else if (ShlibVerInfix == "yes") {
97                         result = sprintf("%s%s.$(ABI_VERSION)%s", prefix, a_name, suffix);
98                 } else {
99                         result = sprintf("%s.$(ABI_VERSION)", lib_name_of(a_name));
100                 }
101                 return result;
102         }
103 # see rel_name
104 function rel_name_of(a_name) {
105                 if (ShlibVerInfix == "cygdll") {
106                         result = sprintf("%s%s$(REL_VERSION)%s", "cyg", a_name, suffix);
107                 } else if (ShlibVerInfix == "msysdll") {
108                         result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix);
109                 } else if (ShlibVerInfix == "mingw" || ShlibVerInfix == "msvcdll") {
110                         result = sprintf("%s%s$(REL_VERSION)%s", prefix, a_name, suffix);
111                 } else if (ShlibVerInfix == "yes") {
112                         result = sprintf("%s%s.$(REL_VERSION)%s", prefix, a_name, suffix);
113                 } else {
114                         result = sprintf("%s.$(REL_VERSION)", lib_name_of(a_name));
115                 }
116                 return result;
117         }
118 # see end_name
119 function end_name_of(a_name) {
120                 if ( MODEL != "SHARED" ) {
121                         result = lib_name_of(a_name);
122                 } else if ( DoLinks == "reverse") {
123                         result = lib_name_of(a_name);
124                 } else {
125                         if ( ShlibVer == "rel" ) {
126                                 result = rel_name_of(a_name);
127                         } else if ( ShlibVer == "abi" || ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll" ) {
128                                 result = abi_name_of(a_name);
129                         } else {
130                                 result = lib_name_of(a_name);
131                         }
132                 }
133                 return result
134         }
135 function symlink(src,dst) {
136                 if ( src != dst ) {
137                         if ( SymLink !~ /.*-f.*/ ) {
138                                 printf "rm -f %s; ", dst
139                         }
140                         printf "$(LN_S) %s %s; ", src, dst
141                 }
142         }
143 function rmlink(directory, dst) {
144                 if ( dst != "" ) {
145                         printf "\t-rm -f %s/%s\n", directory, dst
146                 }
147         }
148 function removelinks(directory) {
149                 nlinks = 0;
150                 links[nlinks++] = end_name;
151                 if ( DoLinks == "reverse" ) {
152                         if ( ShlibVer == "rel" ) {
153                                 links[nlinks++] = abi_name;
154                                 links[nlinks++] = rel_name;
155                         } else if ( ShlibVer == "abi" ) {
156                                 links[nlinks++] = abi_name;
157                         }
158                 } else {
159                         if ( ShlibVer == "rel" ) {
160                                 links[nlinks++] = abi_name;
161                                 links[nlinks++] = lib_name;
162                         } else if ( ShlibVer == "abi" ) {
163                                 links[nlinks++] = lib_name;
164                         }
165                 }
166                 for (j = 0; j < nlinks; ++j) {
167                         found = 0;
168                         for (k = 0; k < j; ++k ) {
169                                 if ( links[j] == links[k] ) {
170                                         found = 1;
171                                         break;
172                                 }
173                         }
174                         if ( !found ) {
175                                 rmlink(directory, links[j]);
176                         }
177                 }
178         }
179 function make_shlib(objs, shlib_list) {
180                 printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(%s)\n", objs, shlib_list
181         }
182 function sharedlinks(directory) {
183                 if ( ShlibVer != "auto" && ShlibVer != "cygdll" && ShlibVer != "msysdll" && ShlibVer != "mingw" && ShlibVer != "msvcdll" ) {
184                         printf "\tcd %s && (", directory
185                         if ( DoLinks == "reverse" ) {
186                                 if ( ShlibVer == "rel" ) {
187                                         symlink(lib_name, abi_name);
188                                         symlink(abi_name, rel_name);
189                                 } else if ( ShlibVer == "abi" ) {
190                                         symlink(lib_name, abi_name);
191                                 }
192                         } else {
193                                 if ( ShlibVer == "rel" ) {
194                                         symlink(rel_name, abi_name);
195                                         symlink(abi_name, lib_name);
196                                 } else if ( ShlibVer == "abi" ) {
197                                         symlink(abi_name, lib_name);
198                                 }
199                         }
200                         printf ")\n"
201                 }
202         }
203 # termlib may be named explicitly via "--with-termlib=XXX", which overrides
204 # any suffix.  Temporarily override "suffix" to account for this.
205 function termlib_end_of() {
206         termlib_save_suffix = suffix;
207         suffix = TermlibSuffix;
208         termlib_temp_result = end_name_of(TermlibRoot);
209         suffix = termlib_save_suffix;
210         return termlib_temp_result;
211 }
212 function shlib_build(directory) {
213                 dst_libs = sprintf("%s/%s", directory, end_name);
214                 printf "%s : \\\n", dst_libs
215                 if (subset == "ticlib" && driver == "yes" ) {
216                         base = name;
217                         sub(/^tic/, "ncurses", base); # workaround for "w"
218                         printf "\t\t%s/%s \\\n", directory, end_name_of(base);
219                 }
220                 if (subset ~ /^base/ || subset == "ticlib" ) {
221                         save_suffix = suffix
222                         sub(/^[^.]\./,".",suffix)
223                         if (directory != "../lib") {
224                                 printf "\t\t%s/%s \\\n", "../lib", termlib_end_of();
225                         }
226                         printf "\t\t%s/%s \\\n", directory, termlib_end_of();
227                         suffix = save_suffix
228                 }
229                 printf "\t\t$(RESULTING_SYMS) $(%s_OBJS)\n", OBJS
230                 printf "\t@echo linking $@\n"
231                 printf "\t@mkdir -p %s\n", directory
232                 if ( ReLink != "yes" ) {
233                         printf "\t@sleep 1\n"
234                 }
235                 if ( is_ticlib() ) {
236                         make_shlib(OBJS, "TICS_LIST")
237                 } else if ( is_termlib() ) {
238                         make_shlib(OBJS, "TINFO_LIST")
239                 } else {
240                         make_shlib(OBJS, "SHLIB_LIST")
241                 }
242                 sharedlinks(directory)
243         }
244 function shlib_install(directory) {
245                 src_lib1 = sprintf("../lib/%s", end_name);
246                 dst_lib1 = sprintf("%s/%s", directory, end_name);
247                 printf "%s : \\\n", dst_lib1
248                 printf "\t\t%s \\\n", directory
249                 printf "\t\t%s\n", src_lib1
250                 printf "\t@echo installing $@\n"
251                 printf "\t$(INSTALL_LIB) %s %s\n", src_lib1, dst_lib1;
252                 sharedlinks(directory)
253         }
254 function install_dll(directory,filename) {
255                 src_name = sprintf("../lib/%s", filename);
256                 dst_name = sprintf("$(DESTDIR)%s/%s", directory, filename);
257                 printf "\t@echo installing %s as %s\n", src_name, dst_name
258                 if ( directory == "$(bindir)" ) {
259                         program = "$(INSTALL) -m 755";
260                 } else {
261                         program = "$(INSTALL_LIB)";
262                 }
263                 printf "\t%s %s %s\n", program, src_name, dst_name
264         }
265 function in_subset(value) {
266                 value = " " value " ";
267                 check = subset;
268                 gsub("[+]", " ", check);
269                 check = " " check " ";
270                 return index(check,value);
271         }
272 function trim_suffix(value) {
273         if (USE_LIB_SUFFIX != "" && length(value) > length(USE_LIB_SUFFIX)) {
274                 check = substr(value, 1 + length(value) - length(USE_LIB_SUFFIX));
275                 if (check == USE_LIB_SUFFIX) {
276                         value = substr(value, 1, length(value) - length(USE_LIB_SUFFIX));
277                 }
278         }
279         return value;
280 }
281 BEGIN   {
282                 TOOL_PREFIX = "";
283                 found = 0;
284                 using = 0;
285         }
286         /^@/ {
287                 using = 0
288                 if (subset == "none") {
289                         using = 1
290                         print  ""
291                         print "# generated by mk-1st.awk"
292                 } else if (in_subset($2) > 0) {
293                         if (using == 0) {
294                                 if (found == 0) {
295                                         if ( name ~ /^.*\+\+.*/ ) {
296                                                 if ( CXX_MODEL == "NORMAL" && MODEL == "SHARED" ) {
297                                                         print  ""
298                                                         printf "# overriding model from %s to match CXX_MODEL\n", MODEL;
299                                                         MODEL = "NORMAL";
300                                                         suffix = ".a";
301                                                         DoLinks = "no";
302                                                 }
303                                         }
304                                         print  ""
305                                         printf "# generated by mk-1st.awk (subset=%s)\n", subset
306                                         printf "#  name:            %s\n", name
307                                         printf "#  traces:          %s\n", traces
308                                         printf "#  MODEL:           %s\n", MODEL
309                                         printf "#  CXX_MODEL:       %s\n", CXX_MODEL
310                                         printf "#  LIB_SUFFIX:      %s\n", LIB_SUFFIX
311                                         printf "#  USE_LIB_SUFFIX:  %s\n", USE_LIB_SUFFIX
312                                         printf "#  model:           %s\n", model
313                                         printf "#  prefix:          %s\n", prefix
314                                         printf "#  suffix:          %s\n", suffix
315                                         printf "#  subset:          %s\n", subset
316                                         printf "#  driver:          %s\n", driver
317                                         printf "#  ShlibVer:        %s\n", ShlibVer
318                                         printf "#  ShlibVerInfix:   %s\n", ShlibVerInfix
319                                         printf "#  SymLink:         %s\n", SymLink
320                                         printf "#  TermlibRoot:     %s\n", TermlibRoot
321                                         printf "#  TermlibSuffix:   %s\n", TermlibSuffix
322                                         printf "#  ReLink:          %s\n", ReLink
323                                         printf "#  ReRanlib:        %s\n", ReRanlib
324                                         printf "#  DoLinks:         %s\n", DoLinks
325                                         printf "#  rmSoLocs:        %s\n", rmSoLocs
326                                         printf "#  ldconfig:        %s\n", ldconfig
327                                         printf "#  make_phony:      %s\n", make_phony
328                                         printf "#  overwrite:       %s\n", overwrite
329                                         printf "#  depend:          %s\n", depend
330                                         printf "#  host:            %s\n", host
331                                         printf "#  libtool_version: %s\n", libtool_version
332                                         print  ""
333                                 }
334                                 using = 1
335                         }
336                         if ( is_ticlib() ) {
337                                 OBJS  = MODEL "_P"
338                         } else if ( is_termlib() ) {
339                                 OBJS  = MODEL "_T"
340                         } else {
341                                 OBJS  = MODEL
342                         }
343                 }
344         }
345         /^[@#]/ {
346                 next
347         }
348         $1 ~ /trace/ {
349                 if (traces != "all" && traces != MODEL && $1 != "lib_trace")
350                         next
351         }
352         {
353                 if (using \
354                  && ( $1 != "link_test" ) \
355                  && ( $2 == "lib" \
356                    || $2 == "progs" \
357                    || $2 == "c++" \
358                    || $2 == "tack" ))
359                 {
360                         if ( found == 0 )
361                         {
362                                 printf "%s_OBJS =", OBJS
363                                 if ( $2 == "lib" ) {
364                                         found = 1;
365                                 } else if ( $2 == "c++" ) {
366                                         TOOL_PREFIX = "CXX_";
367                                         found = 1;
368                                 } else {
369                                         found = 2;
370                                 }
371                                 if ( $2 == "c++" ) {
372                                         CC_NAME="CXX"
373                                         CC_FLAG="CXXFLAGS"
374                                 } else {
375                                         CC_NAME="CC"
376                                         CC_FLAG="CFLAGS"
377                                 }
378                         }
379                         printf " \\\n\t../%s/%s$o", model, $1;
380                 }
381         }
382 END     {
383                 print  ""
384                 if ( found != 0 )
385                 {
386                         printf "\n$(%s_OBJS) : %s\n", OBJS, depend
387                 }
388                 if ( found == 1 )
389                 {
390                         print  ""
391                         lib_name = lib_name_of(name);
392                         if ( MODEL == "SHARED" )
393                         {
394                                 abi_name = abi_name_of(name);
395                                 rel_name = rel_name_of(name);
396                                 imp_name = imp_name_of(name);
397                                 end_name = end_name_of(name);
398
399                                 shlib_build("../lib")
400
401                                 print  ""
402                                 print  "install \\"
403                                 print  "install.libs \\"
404
405                                 if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") {
406
407                                         dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)";
408                                         printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs
409                                         install_dll("$(bindir)",end_name);
410                                         install_dll("$(libdir)",imp_name);
411
412                                 } else {
413
414                                         lib_dir = "$(DESTDIR)$(libdir)";
415                                         printf "install.%s :: %s/%s\n", name, lib_dir, end_name
416                                         print ""
417                                         if ( ReLink == "yes" ) {
418                                                 shlib_build(lib_dir)
419                                         } else {
420                                                 shlib_install(lib_dir)
421                                         }
422                                 }
423
424                                 if ( overwrite == "yes" && name == "ncurses" )
425                                 {
426                                         if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || SlibVer == "msvcdll") {
427                                                 if (ShlibVer == "msvcdll") {
428                                                         curses_prefix = ""
429                                                 } else {
430                                                         curses_prefix = "lib"
431                                                 }
432                                                 ovr_name = sprintf("%scurses%s.a", curses_prefix, suffix)
433                                                 printf "\t@echo linking %s to %s\n", imp_name, ovr_name
434                                                 printf "\tcd $(DESTDIR)$(libdir) && ("
435                                                 symlink(imp_name, ovr_name)
436                                                 printf ")\n"
437                                         } else {
438                                                 ovr_name = sprintf("libcurses%s", suffix)
439                                                 printf "\t@echo linking %s to %s\n", end_name, ovr_name
440                                                 printf "\tcd $(DESTDIR)$(libdir) && ("
441                                                 symlink(end_name, ovr_name)
442                                                 printf ")\n"
443                                         }
444                                 }
445                                 if ( ldconfig != "" && ldconfig != ":" ) {
446                                         printf "\t- test -z \"$(DESTDIR)\" && %s\n", ldconfig
447                                 }
448                                 print  ""
449                                 print  "uninstall \\"
450                                 print  "uninstall.libs \\"
451                                 printf "uninstall.%s ::\n", name
452                                 if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") {
453
454                                         printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name
455                                         printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name
456
457                                         printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", imp_name
458                                         printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", imp_name
459
460                                 } else {
461                                         printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", end_name
462                                         removelinks("$(DESTDIR)$(libdir)")
463                                         if ( overwrite == "yes" && name == "ncurses" )
464                                         {
465                                                 ovr_name = sprintf("libcurses%s", suffix)
466                                                 printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", ovr_name
467                                         }
468                                 }
469                                 if ( rmSoLocs == "yes" ) {
470                                         print  ""
471                                         print  "mostlyclean \\"
472                                         print  "clean ::"
473                                         printf "\t-@rm -f so_locations\n"
474                                 }
475                         }
476                         else if ( MODEL == "LIBTOOL" )
477                         {
478                                 end_name = lib_name;
479                                 use_name = trim_suffix(TermlibRoot) USE_LIB_SUFFIX
480                                 printf "# FIXME\n";
481                                 printf "# name '%s'\n", name;
482                                 printf "# end_name '%s'\n", end_name;
483                                 printf "# use_name '%s'\n", use_name;
484                                 printf "../lib/%s : \\\n", lib_name
485                                 if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) {
486                                         printf "\t\t../lib/lib%s.la \\\n", use_name;
487                                         if ( index(name, "tic") == 1 && index(TermlibRoot, "ncurses") != 1 ) {
488                                                 printf "\t\t../lib/lib%s%s.la \\\n", "ncurses", USE_LIB_SUFFIX;
489                                         }
490                                 }
491                                 printf "\t\t$(%s_OBJS)\n", OBJS
492                                 if ( is_ticlib() ) {
493                                         which_list = "TICS_LIST";
494                                 } else if ( is_termlib() ) {
495                                         which_list = "TINFO_LIST";
496                                 } else {
497                                         which_list = "SHLIB_LIST";
498                                 }
499                                 printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) $(%s) \\\n", CC_NAME, CC_FLAG;
500                                 printf "\t\t-o %s $(%s_OBJS:$o=.lo) \\\n", lib_name, OBJS;
501                                 printf "\t\t-rpath $(libdir) \\\n";
502                                 printf "\t\t%s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(%s) $(LDFLAGS)\n", libtool_version, which_list;
503                                 if ( make_phony == "yes" ) {
504                                         print  ""
505                                         printf ".PHONY :\tinstall.%s\n", trim_suffix(name);
506                                 }
507                                 print  ""
508                                 print  "install \\"
509                                 print  "install.libs \\"
510                                 printf "install.%s :: \\\n", trim_suffix(name);
511                                 printf "\t\t$(DESTDIR)$(libdir) \\\n";
512                                 use_name = TermlibRoot USE_LIB_SUFFIX
513                                 if ( (name != use_name ) && ( index(name, "++") == 0 ) && ( index(name, "tic") == 1 || index(name, "ncurses") == 1 ) ) {
514                                         printf "\t\tinstall.%s \\\n", trim_suffix(TermlibRoot);
515                                         if ( index(name, "tic") == 1 && index(TermlibRoot, "ncurses") != 1 ) {
516                                                 printf "\t\tinstall.%s \\\n", "ncurses";
517                                         }
518                                 }
519                                 printf "\t\t../lib/%s\n", lib_name
520                                 printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name
521                                 printf "\tcd ../lib; $(LIBTOOL_INSTALL) $(INSTALL) %s $(DESTDIR)$(libdir)\n", lib_name
522                                 print  ""
523                                 print  "uninstall \\"
524                                 print  "uninstall.libs \\"
525                                 printf "uninstall.%s ::\n", trim_suffix(name)
526                                 printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name
527                                 printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name
528                         }
529                         else
530                         {
531                                 end_name = lib_name;
532                                 printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS
533                                 # workaround: binutils' ranlib tries to be clever with
534                                 # timestamps, by pretending its update took no time, confusing
535                                 # the make utility.
536                                 if ( ReLink != "yes" ) {
537                                         printf "\t@sleep 1\n"
538                                 }
539                                 printf "\t$(%sAR) $(%sARFLAGS) $@ $?\n", TOOL_PREFIX, TOOL_PREFIX;
540                                 printf "\t$(RANLIB) $@\n"
541                                 if ( host == "vxworks" )
542                                 {
543                                         printf "\t$(LD) $(LD_OPTS) $? -o $(@:.a=$o)\n"
544                                 }
545                                 print  ""
546                                 print  "install \\"
547                                 print  "install.libs \\"
548                                 printf "install.%s :: $(DESTDIR)$(libdir) ../lib/%s\n", name, lib_name
549                                 printf "\t@echo installing ../lib/%s as $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name
550                                 printf "\t$(INSTALL_DATA) ../lib/%s $(DESTDIR)$(libdir)/%s\n", lib_name, lib_name
551                                 if ( overwrite == "yes" && lib_name == "libncurses.a" )
552                                 {
553                                         printf "\t@echo linking libcurses.a to libncurses.a\n"
554                                         printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n"
555                                         printf "\t(cd $(DESTDIR)$(libdir) && "
556                                         symlink("libncurses.a", "libcurses.a")
557                                         printf ")\n"
558                                 }
559                                 if ( ReRanlib == "yes" )
560                                 {
561                                         printf "\t$(RANLIB) $(DESTDIR)$(libdir)/%s\n", lib_name
562                                 }
563                                 if ( host == "vxworks" )
564                                 {
565                                         printf "\t@echo installing ../lib/lib%s$o as $(DESTDIR)$(libdir)/lib%s$o\n", name, name
566                                         printf "\t$(INSTALL_DATA) ../lib/lib%s$o $(DESTDIR)$(libdir)/lib%s$o\n", name, name
567                                 }
568                                 print  ""
569                                 print  "uninstall \\"
570                                 print  "uninstall.libs \\"
571                                 printf "uninstall.%s ::\n", name
572                                 printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name
573                                 printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", lib_name
574                                 if ( overwrite == "yes" && lib_name == "libncurses.a" )
575                                 {
576                                         printf "\t@echo linking libcurses.a to libncurses.a\n"
577                                         printf "\t-@rm -f $(DESTDIR)$(libdir)/libcurses.a\n"
578                                 }
579                                 if ( host == "vxworks" )
580                                 {
581                                         printf "\t@echo uninstalling $(DESTDIR)$(libdir)/lib%s$o\n", name
582                                         printf "\t-@rm -f $(DESTDIR)$(libdir)/lib%s$o\n", name
583                                 }
584                         }
585                         print ""
586                         print "clean ::"
587                         removelinks("../lib");
588                         print ""
589                         print "mostlyclean::"
590                         printf "\t-rm -f $(%s_OBJS)\n", OBJS
591                         if ( MODEL == "LIBTOOL" ) {
592                                 printf "\t-$(LIBTOOL_CLEAN) rm -f $(%s_OBJS:$o=.lo)\n", OBJS
593                         }
594                 }
595                 else if ( found == 2 )
596                 {
597                         print ""
598                         print "mostlyclean::"
599                         printf "\t-rm -f $(%s_OBJS)\n", OBJS
600                         if ( MODEL == "LIBTOOL" ) {
601                                 printf "\t-$(LIBTOOL_CLEAN) rm -f $(%s_OBJS:$o=.lo)\n", OBJS
602                         }
603                         print ""
604                         print "clean ::"
605                         printf "\t-rm -f $(%s_OBJS)\n", OBJS
606                         if ( MODEL == "LIBTOOL" ) {
607                                 printf "\t-$(LIBTOOL_CLEAN) rm -f $(%s_OBJS:$o=.lo)\n", OBJS
608                         }
609                 }
610         }
611 # vile:ts=4 sw=4