Unix Programming - Re: another makefile question got it no i didn't

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2004 > Re: another makefile question got it no i didn't





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: another makefile question got it no i didn't
Trent Buck

2004-11-17, 5:51 pm

Quoth Billy Patton on or about 2004-11-17:
> Tried this but must have had my conditional part wrong, always returned the
> then part.
> had $(if file=$(origin CELL_SIZE),1,0)
>

Please read the above paragraph. The $(if) function's CONDITION operand
works something like C's #ifdef -- if CONDITION does not evaluate to
*nothing*, the THEN-PART operand will be evaluated / returned.
[vbcol=seagreen]
> The multi line for is what I originally had.
> Problem is, I need to set IS_DEFAULT in 40+ targets and didn't want to use 40
> different variables.
> I would up just passing in the output of original in string form.
> That worked out ok.


From the information you've provided I can't suggest a way to avoid this.

> On another post I had stated that I needed to put a 1 or a 0 into a .status
> file and mke it part of my dependancies of a target.
> ${TARGET}: ${LAFF} ${OPTIONS} $(shell grep -s '^1' ${OUTDIR}/.status)
>
> Works perfectly.
> I need to modify this.
> I have 4 different status possibilities
>
> ${TARGET}: ${LAFF} ${OPTIONS} $(shell grep -c -s '^fail|^unknown'


The above technique will work for any number of different values in
..status, but it can only perform two different behaviours (i.e. include
or don't include). The regular expression should be

grep -c -s '^fail\|^unknown'

or

grep -c -s '^\(fail\|unknown\)'

Since you only have two conditions, the former form is probably preferable.

-trent
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com