|
|
|
|
|
|
| Author |
Message |
Cyrille Lefevre *nix forums beginner
Joined: 12 Jun 2002
Posts: 48
|
Posted: Fri Jul 26, 2002 1:37 pm Post subject:
Re: Standardized make options (or no doesn't always mean no)
|
|
|
On Fri, Jul 26, 2002 at 03:59:23PM +0200, Cyrille Lefevre wrote:
[snip]
| Quote: | find . -name 'Makefile*' -o -name 'bsd.*.mk' |
egrep -v '[./](new|old)[/:]' |
xargs egrep '(^\. *if(n?def)|defined) *\(?NO[^_]' /dev/null >| /tmp/no1
sed -E -e 's/\.if(n?def)? //;s/exists *([^)]+)//g;s/ *[|&=][|&=] *//g' \
-e 's/!? *defined//g;s/[()\\"]/ /g;s/\${MACHINE_ARCH}//g' \
-e 's/ i386//g;s/alpha//g;s/:/ /g;s/ +/ /g;s|^\./||' /tmp/no1 >| /tmp/no2
awk '{for(i=2;i<=NF;i++)if($i~/^NO[^_]/)print $1,$i}' /tmp/no2 |
sort -u >| /tmp/no3
awk '{for(i=2;i<=NF;i++)if($i~/^NO[^_]/)print $i,$1}' /tmp/no2 |
sort -u >| /tmp/no4
awk '$1!=f{if(f)print f;f=$1;printf "sed -E -i.bak"}
{v=$2;sub("NO","&_",v);
printf " -e %cs/%s([^A-Z_]|$)/%s\\1/g%c ", 39, $2, v, 39}
END{print f}' /tmp/no3 >| /tmp/no5
awk '$1!=v{if(v){sub("NO","",v);print "_NO_VARS+=\t"v};v=$1}
{print "#", $2}
END{sub("NO","",v);print "_NO_VARS+=\t"v}' /tmp/no4 >| /tmp/no6
sed -E -e 's/([^A-Z_])(ALIAS|I4B|KLDLOAD|NAT|NETGRAPH|RADIUS|SUID)([^A-Z_]|$)/\1NO\2 PPP_NO\2\3/' \
-e 't e' -e b -e :e -e 's/_NO_VARS/_ASSOC_VARS/' /tmp/no6 >| /tmp/no7
no5 contains the sed commands to replace every occurences of NOFOO
to NO_FOO in every files
no6 contains the list (_NO_VARS) of NO variables for the above knob
no7 same a no6 except that NOFOO ppp variables have been renamed to PPP_NOFOO
and put in _ASSOC_VARS
|
forgive me about no7, let's PPP vars as they are.
oops! forgot about var assignments...
egrep -v '[./](new|old|obsolete|bak[1-9])[/:]' |
xargs egrep "^( *# *)?NO[^_]+" /dev/null |
# NOINSTALLLIB is obsolete -- found in ./lib/libpam/modules/Makefile.inc
egrep -v 'NORMAL|NOTES?:|NOLIGFLAG|NOVARARGS|NONAP|NOLOG|NOASM|NOINSTALLLIB|NOTYET|NOPUSH' >| /tmp/no11
sed -E -e 's|^\./||;s/[+?:!]?=.*//;s/[#:]/ /g;s/ +/ /g' /tmp/no11 >| /tmp/no22
awk '{for(i=2;i<=NF;i++)if($i~/^NO[^_]/)print $1,$i}' /tmp/no22 |
sort -u >| /tmp/no33
awk '{for(i=2;i<=NF;i++)if($i~/^NO[^_]/)print $i,$1}' /tmp/no22 |
sort -u >| /tmp/no44
awk '$1!=f{if(f)print f;f=$1;printf "sed -E -i.bak2"}
{v=$2;sub("NO","&_",v);
printf " -e %cs/%s([^A-Z_]|$)/%s\\1/g%c ", 39, $2, v, 39}
END{print f}' /tmp/no33 >| /tmp/no55
awk '$1!=v{if(v){sub("NO","",v);print "_NO_VARS+=\t"v};v=$1}
{print "#", $2}
END{sub("NO","",v);print "_NO_VARS+=\t"v}' /tmp/no44 >| /tmp/no66
no55 contains the sed commands to replace every occurences of NOFOO=
to NO_FOO in every files
no66 same as no6 but, for info only
wait some time the build world finish... and I'll send you THE diff :)
Cyrille.
--
Cyrille Lefevre mailto:cyrille.lefevre@laposte.net
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message |
|
| Back to top |
|
 |
Cyrille Lefevre *nix forums beginner
Joined: 12 Jun 2002
Posts: 48
|
Posted: Fri Jul 26, 2002 1:43 pm Post subject:
Re: Standardized make options (or no doesn't always mean no)
|
|
|
On Fri, Jul 26, 2002 at 08:25:27AM -0700, Juli Mallett wrote:
| Quote: | * De: Cyrille Lefevre <cyrille.lefevre@laposte.net> [ Data: 2002-07-26 ]
[ Subjecte: Re: Standardized make options (or no doesn't always mean no) ]
On Thu, Jul 25, 2002 at 08:09:40PM +0300, Ruslan Ermilov wrote:
On Thu, Jul 25, 2002 at 06:59:40PM +0200, Cyrille Lefevre wrote:
On Thu, Jul 25, 2002 at 10:01:45AM +0300, Ruslan Ermilov wrote:
[snip]
We'd provide the compatibility knobs that would also trigger a warning
(a .warning to be added to make(1)) that NO_FOO should now be used
instead of NOFOO (or vice versa, if we decide to go that way).
.warning isn't needed, let's try w/ .BEGIN :)
well, il fact, a .warning is needed for the newer knob because
it seems you can't do something like this :
Can't you use a double-colon rule to accomplish that?
|
I've also tried w/o success.
| Quote: | Also, the diff seems reasonable, but you really do want to keep in mind
that most places where make(1) substitutes/expands variables, it will be
allocating memory. Leaks bad.
|
re you saying that almost all occurences of :
cp = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE);
should really be :
cp2 = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE);
free(cp);
cp = cp2;
| Quote: | - /* use fprintf/exit instead of Parse_Error to terminate immediately */
- fprintf(stderr, "\"%s\", line %d: %s\n", fname, lineno, errmsg);
+ Parse_Error(PARSE_FATAL, "%s", errmsg);
exit(1);
This seems like a regression.
|
looking at Parse_Error, there is no reason here to use fprintf instead ?
Cyrille.
--
Cyrille Lefevre mailto:cyrille.lefevre@laposte.net
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message |
|
| Back to top |
|
 |
Juli Mallett *nix forums beginner
Joined: 12 Jun 2002
Posts: 22
|
Posted: Fri Jul 26, 2002 7:30 pm Post subject:
Re: Standardized make options (or no doesn't always mean no)
|
|
|
* De: Cyrille Lefevre <cyrille.lefevre@laposte.net> [ Data: 2002-07-26 ]
[ Subjecte: Re: Standardized make options (or no doesn't always mean no) ]
| Quote: | Also, the diff seems reasonable, but you really do want to keep in mind
that most places where make(1) substitutes/expands variables, it will be
allocating memory. Leaks bad.
re you saying that almost all occurences of :
cp = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE);
should really be :
cp2 = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE);
free(cp);
cp = cp2;
|
No.
imagine...
static void
Parse_PrintLineWithSubst(cp)
char *cp;
{
cp = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE);
fprintf(stderr, "%s\n", cp);
free(cp);
}
No need for a place-holder, sometimes.
| Quote: | - /* use fprintf/exit instead of Parse_Error to terminate immediately */
- fprintf(stderr, "\"%s\", line %d: %s\n", fname, lineno, errmsg);
+ Parse_Error(PARSE_FATAL, "%s", errmsg);
exit(1);
This seems like a regression.
looking at Parse_Error, there is no reason here to use fprintf instead ?
|
You're right. I was thinking Parse_Error was slightly more heavyweight.
--
Juli Mallett <jmallett@FreeBSD.org> | FreeBSD: The Power To Serve
Will break world for fulltime employment. | finger jmallett@FreeBSD.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 5:59 am | All times are GMT
|
|
Free SMS | Credit Cards | Magazine Subscriptions | Mortgage insurance | Internet Advertising
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|