ncurses 4.1
[ncurses.git] / mk-0th.awk
1 # $Id: mk-0th.awk,v 1.3 1996/12/01 00:27:23 tom Exp $
2 ################################################################################
3 # Copyright 1996 by Thomas E. Dickey <dickey@clark.net>                        #
4 # All Rights Reserved.                                                         #
5 #                                                                              #
6 # Permission to use, copy, modify, and distribute this software and its        #
7 # documentation for any purpose and without fee is hereby granted, provided    #
8 # that the above copyright notice appear in all copies and that both that      #
9 # copyright notice and this permission notice appear in supporting             #
10 # documentation, and that the name of the above listed copyright holder(s) not #
11 # be used in advertising or publicity pertaining to distribution of the        #
12 # software without specific, written prior permission. THE ABOVE LISTED        #
13 # COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
14 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
15 # SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
16 # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
17 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
18 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
19 # PERFORMANCE OF THIS SOFTWARE.                                                #
20 ################################################################################
21 # Generate list of sources for a library, together with lint/lintlib rules
22 #
23 # Variables:
24 #       name (library name, e.g., "ncurses", "panel", "forms", "menus")
25 #
26 BEGIN   {
27                 print  ""
28                 print  "# generated by mk-0th.awk"
29                 print  ""
30                 found = 0;
31         }
32         !/^#/ {
33                 if ( $2 == "lib" )
34                 {
35                         if ( found == 0 )
36                         {
37                                 printf "C_SRC ="
38                                 found = 1
39                         }
40                         printf " \\\n\t%s/%s.c", $3, $1
41                 }
42         }
43 END     {
44                 print  ""
45                 if ( found != 0 )
46                 {
47                         print  ""
48                         printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", name
49                         print  "# it in the lintlib rule.  We'll only remove in the cleanest setup."
50                         print  "clean ::"
51                         printf "\trm -f llib-l%s.*\n", name
52                         print  ""
53                         print  "realclean ::"
54                         printf "\trm -f llib-l%s\n", name
55                         print  ""
56                         printf "llib-l%s : $(C_SRC)\n", name
57                         printf "\tcproto -a -l -DLINT $(CPPFLAGS) $(C_SRC) >$@\n"
58                         print  ""
59                         print  "lintlib :"
60                         printf "\t$(srcdir)/../misc/makellib %s $(CPPFLAGS)", name
61                         print ""
62                         print "lint :"
63                         print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)"
64                 }
65                 else
66                 {
67                         print  "lintlib :"
68                         print  "\t@echo no action needed"
69                 }
70         }