mk-0th.awk revision 50276
1164032Srwatson# $Id: mk-0th.awk,v 1.7 1998/02/11 12:13:52 tom Exp $
2164032Srwatson##############################################################################
3164032Srwatson# Copyright (c) 1998 Free Software Foundation, Inc.                          #
4164032Srwatson#                                                                            #
5164032Srwatson# Permission is hereby granted, free of charge, to any person obtaining a    #
6164032Srwatson# copy of this software and associated documentation files (the "Software"), #
7164032Srwatson# to deal in the Software without restriction, including without limitation  #
8164032Srwatson# the rights to use, copy, modify, merge, publish, distribute, distribute    #
9164032Srwatson# with modifications, sublicense, and/or sell copies of the Software, and to #
10164032Srwatson# permit persons to whom the Software is furnished to do so, subject to the  #
11164032Srwatson# following conditions:                                                      #
12164032Srwatson#                                                                            #
13164032Srwatson# The above copyright notice and this permission notice shall be included in #
14164032Srwatson# all copies or substantial portions of the Software.                        #
15164032Srwatson#                                                                            #
16164032Srwatson# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17164032Srwatson# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
18164032Srwatson# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
19164032Srwatson# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
20164032Srwatson# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
21164032Srwatson# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
22164032Srwatson# DEALINGS IN THE SOFTWARE.                                                  #
23164032Srwatson#                                                                            #
24164032Srwatson# Except as contained in this notice, the name(s) of the above copyright     #
25164032Srwatson# holders shall not be used in advertising or otherwise to promote the sale, #
26164032Srwatson# use or other dealings in this Software without prior written               #
27164032Srwatson# authorization.                                                             #
28164032Srwatson##############################################################################
29164032Srwatson#
30164032Srwatson# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997
31164032Srwatson#
32164032Srwatson# Generate list of sources for a library, together with lint/lintlib rules
33164032Srwatson#
34164032Srwatson# Variables:
35164032Srwatson#	name (library name, e.g., "ncurses", "panel", "forms", "menus")
36164032Srwatson#
37164032SrwatsonBEGIN	{
38164032Srwatson		print  ""
39164032Srwatson		print  "# generated by mk-0th.awk"
40164032Srwatson		print  ""
41164032Srwatson		found = 0;
42164032Srwatson	}
43164032Srwatson	!/^[@#]/ {
44164032Srwatson		if ( $0 != "" )
45164032Srwatson		{
46164032Srwatson			if ( found == 0 )
47164032Srwatson			{
48164032Srwatson				printf "C_SRC ="
49164032Srwatson				if ( $2 == "lib" )
50164032Srwatson					found = 1
51164032Srwatson				else
52164032Srwatson					found = 2
53164032Srwatson			}
54164032Srwatson			printf " \\\n\t%s/%s.c", $3, $1
55164032Srwatson		}
56164032Srwatson	}
57164032SrwatsonEND	{
58164032Srwatson		print  ""
59164032Srwatson		if ( found == 1 )
60164032Srwatson		{
61164032Srwatson			print  ""
62164032Srwatson			printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", name
63164032Srwatson			print  "# it in the lintlib rule.  We'll only remove in the cleanest setup."
64164032Srwatson			print  "clean ::"
65			printf "\trm -f llib-l%s.*\n", name
66			print  ""
67			print  "realclean ::"
68			printf "\trm -f llib-l%s\n", name
69			print  ""
70			printf "llib-l%s : $(C_SRC)\n", name
71			printf "\tcproto -a -l -DLINT $(CPPFLAGS) $(C_SRC) >$@\n"
72			print  ""
73			print  "lintlib :"
74			printf "\t$(srcdir)/../misc/makellib %s $(CPPFLAGS)", name
75			print ""
76			print "lint :"
77			print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)"
78		}
79		else
80		{
81			print  ""
82			print  "lintlib :"
83			print  "\t@echo no action needed"
84		}
85	}
86