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