1166124Srafan# $Id: mk-0th.awk,v 1.17 2005/01/22 16:31:40 tom Exp $ 250276Speter############################################################################## 3166124Srafan# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # 450276Speter# # 550276Speter# Permission is hereby granted, free of charge, to any person obtaining a # 650276Speter# copy of this software and associated documentation files (the "Software"), # 750276Speter# to deal in the Software without restriction, including without limitation # 850276Speter# the rights to use, copy, modify, merge, publish, distribute, distribute # 950276Speter# with modifications, sublicense, and/or sell copies of the Software, and to # 1050276Speter# permit persons to whom the Software is furnished to do so, subject to the # 1150276Speter# following conditions: # 1250276Speter# # 1350276Speter# The above copyright notice and this permission notice shall be included in # 1450276Speter# all copies or substantial portions of the Software. # 1550276Speter# # 1650276Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 1750276Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 1850276Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 1950276Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 2050276Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 2150276Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 2250276Speter# DEALINGS IN THE SOFTWARE. # 2350276Speter# # 2450276Speter# Except as contained in this notice, the name(s) of the above copyright # 2550276Speter# holders shall not be used in advertising or otherwise to promote the sale, # 2650276Speter# use or other dealings in this Software without prior written # 2750276Speter# authorization. # 2850276Speter############################################################################## 2950276Speter# 3050276Speter# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 3150276Speter# 3250276Speter# Generate list of sources for a library, together with lint/lintlib rules 3350276Speter# 3450276Speter# Variables: 3597049Speter# libname (library name, e.g., "ncurses", "panel", "forms", "menus") 36166124Srafan# subsets (is used here to decide if wide-character code is used) 3750276Speter# 3850276SpeterBEGIN { 39166124Srafan using = 0; 4050276Speter found = 0; 4150276Speter } 4250276Speter !/^[@#]/ { 43166124Srafan if (using == 0) 4450276Speter { 45166124Srafan print "" 46166124Srafan print "# generated by mk-0th.awk" 47166124Srafan printf "# libname: %s\n", libname 48166124Srafan printf "# subsets: %s\n", subsets 49166124Srafan print "" 50166124Srafan print ".SUFFIXES: .c .cc .h .i .ii" 51166124Srafan print ".c.i :" 52166124Srafan printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" 53166124Srafan print ".cc.ii :" 54166124Srafan printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" 55166124Srafan print ".h.i :" 56166124Srafan printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" 57166124Srafan print "" 58166124Srafan using = 1; 59166124Srafan } 60166124Srafan if ( $0 != "" && $1 != "link_test" ) 61166124Srafan { 6250276Speter if ( found == 0 ) 6350276Speter { 6497049Speter if ( subsets ~ /widechar/ ) 6597049Speter widechar = 1; 6697049Speter else 6797049Speter widechar = 0; 6850276Speter printf "C_SRC =" 6950276Speter if ( $2 == "lib" ) 7050276Speter found = 1 7150276Speter else 7250276Speter found = 2 7350276Speter } 7497049Speter if ( libname == "c++" || libname == "c++w" ) { 7597049Speter printf " \\\n\t%s/%s.cc", $3, $1 7697049Speter } else if ( widechar == 1 || $3 != "$(wide)" ) { 7797049Speter printf " \\\n\t%s/%s.c", $3, $1 7897049Speter } 7950276Speter } 8050276Speter } 8150276SpeterEND { 8250276Speter print "" 8350276Speter if ( found == 1 ) 8450276Speter { 8550276Speter print "" 8697049Speter printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname 8750276Speter print "# it in the lintlib rule. We'll only remove in the cleanest setup." 8850276Speter print "clean ::" 8997049Speter printf "\trm -f llib-l%s.*\n", libname 9050276Speter print "" 9150276Speter print "realclean ::" 9297049Speter printf "\trm -f llib-l%s\n", libname 9350276Speter print "" 9497049Speter printf "llib-l%s : $(C_SRC)\n", libname 95166124Srafan printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@\n" 9650276Speter print "" 9750276Speter print "lintlib :" 9897049Speter printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)", libname 9950276Speter print "" 10050276Speter print "lint :" 10150276Speter print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)" 10250276Speter } 10350276Speter else 10450276Speter { 10550276Speter print "" 10650276Speter print "lintlib :" 10750276Speter print "\t@echo no action needed" 10850276Speter } 10950276Speter } 110