2010-01-10 09:50:23 +08:00
|
|
|
# $Id: mk-0th.awk,v 1.18 2010/01/09 21:45:41 tom Exp $
|
1998-03-01 12:21:12 +08:00
|
|
|
##############################################################################
|
2010-01-10 09:50:23 +08:00
|
|
|
# Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. #
|
1998-03-01 12:21:12 +08:00
|
|
|
# #
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a #
|
|
|
|
# copy of this software and associated documentation files (the "Software"), #
|
|
|
|
# to deal in the Software without restriction, including without limitation #
|
|
|
|
# the rights to use, copy, modify, merge, publish, distribute, distribute #
|
|
|
|
# with modifications, sublicense, and/or sell copies of the Software, and to #
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to the #
|
|
|
|
# following conditions: #
|
|
|
|
# #
|
|
|
|
# The above copyright notice and this permission notice shall be included in #
|
|
|
|
# all copies or substantial portions of the Software. #
|
|
|
|
# #
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
|
|
|
|
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
|
|
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
|
|
|
|
# DEALINGS IN THE SOFTWARE. #
|
|
|
|
# #
|
|
|
|
# Except as contained in this notice, the name(s) of the above copyright #
|
|
|
|
# holders shall not be used in advertising or otherwise to promote the sale, #
|
|
|
|
# use or other dealings in this Software without prior written #
|
|
|
|
# authorization. #
|
|
|
|
##############################################################################
|
|
|
|
#
|
2010-01-10 09:50:23 +08:00
|
|
|
# Author: Thomas E. Dickey 1996-on
|
1998-03-01 12:21:12 +08:00
|
|
|
#
|
1997-05-15 12:00:00 +08:00
|
|
|
# Generate list of sources for a library, together with lint/lintlib rules
|
|
|
|
#
|
|
|
|
# Variables:
|
2002-10-13 11:35:53 +08:00
|
|
|
# libname (library name, e.g., "ncurses", "panel", "forms", "menus")
|
2005-10-10 02:41:57 +08:00
|
|
|
# subsets (is used here to decide if wide-character code is used)
|
1997-05-15 12:00:00 +08:00
|
|
|
#
|
|
|
|
BEGIN {
|
2010-01-10 09:50:23 +08:00
|
|
|
which = libname;
|
2005-10-10 02:41:57 +08:00
|
|
|
using = 0;
|
1997-05-15 12:00:00 +08:00
|
|
|
found = 0;
|
|
|
|
}
|
2010-01-10 09:50:23 +08:00
|
|
|
/^@/ {
|
|
|
|
which = $0;
|
|
|
|
}
|
1998-03-01 12:21:12 +08:00
|
|
|
!/^[@#]/ {
|
2005-10-10 02:41:57 +08:00
|
|
|
if (using == 0)
|
|
|
|
{
|
|
|
|
print ""
|
|
|
|
print "# generated by mk-0th.awk"
|
|
|
|
printf "# libname: %s\n", libname
|
|
|
|
printf "# subsets: %s\n", subsets
|
|
|
|
print ""
|
|
|
|
print ".SUFFIXES: .c .cc .h .i .ii"
|
|
|
|
print ".c.i :"
|
|
|
|
printf "\t$(CPP) $(CPPFLAGS) $< >$@\n"
|
|
|
|
print ".cc.ii :"
|
|
|
|
printf "\t$(CPP) $(CPPFLAGS) $< >$@\n"
|
|
|
|
print ".h.i :"
|
|
|
|
printf "\t$(CPP) $(CPPFLAGS) $< >$@\n"
|
|
|
|
print ""
|
|
|
|
using = 1;
|
|
|
|
}
|
2010-01-10 09:50:23 +08:00
|
|
|
if (which ~ /port_/ )
|
|
|
|
{
|
|
|
|
# skip win32 source
|
|
|
|
}
|
|
|
|
else if ( $0 != "" && $1 != "link_test" )
|
1997-05-15 12:00:00 +08:00
|
|
|
{
|
|
|
|
if ( found == 0 )
|
|
|
|
{
|
2002-10-13 11:35:53 +08:00
|
|
|
if ( subsets ~ /widechar/ )
|
|
|
|
widechar = 1;
|
|
|
|
else
|
|
|
|
widechar = 0;
|
1997-05-15 12:00:00 +08:00
|
|
|
printf "C_SRC ="
|
1998-03-01 12:21:12 +08:00
|
|
|
if ( $2 == "lib" )
|
|
|
|
found = 1
|
|
|
|
else
|
|
|
|
found = 2
|
1997-05-15 12:00:00 +08:00
|
|
|
}
|
2002-10-13 11:35:53 +08:00
|
|
|
if ( libname == "c++" || libname == "c++w" ) {
|
|
|
|
printf " \\\n\t%s/%s.cc", $3, $1
|
|
|
|
} else if ( widechar == 1 || $3 != "$(wide)" ) {
|
|
|
|
printf " \\\n\t%s/%s.c", $3, $1
|
|
|
|
}
|
1997-05-15 12:00:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
END {
|
|
|
|
print ""
|
1998-03-01 12:21:12 +08:00
|
|
|
if ( found == 1 )
|
1997-05-15 12:00:00 +08:00
|
|
|
{
|
|
|
|
print ""
|
2002-10-13 11:35:53 +08:00
|
|
|
printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname
|
1997-05-15 12:00:00 +08:00
|
|
|
print "# it in the lintlib rule. We'll only remove in the cleanest setup."
|
|
|
|
print "clean ::"
|
2002-10-13 11:35:53 +08:00
|
|
|
printf "\trm -f llib-l%s.*\n", libname
|
1997-05-15 12:00:00 +08:00
|
|
|
print ""
|
|
|
|
print "realclean ::"
|
2002-10-13 11:35:53 +08:00
|
|
|
printf "\trm -f llib-l%s\n", libname
|
1997-05-15 12:00:00 +08:00
|
|
|
print ""
|
2002-10-13 11:35:53 +08:00
|
|
|
printf "llib-l%s : $(C_SRC)\n", libname
|
2005-10-10 02:41:57 +08:00
|
|
|
printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@\n"
|
1997-05-15 12:00:00 +08:00
|
|
|
print ""
|
|
|
|
print "lintlib :"
|
2002-10-13 11:35:53 +08:00
|
|
|
printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)", libname
|
1997-05-15 12:00:00 +08:00
|
|
|
print ""
|
|
|
|
print "lint :"
|
|
|
|
print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-03-01 12:21:12 +08:00
|
|
|
print ""
|
1997-05-15 12:00:00 +08:00
|
|
|
print "lintlib :"
|
|
|
|
print "\t@echo no action needed"
|
|
|
|
}
|
|
|
|
}
|