Re: Somewhat OT - A Makefile Question

2012-06-07 Thread Tim Daneliuk

On 06/07/2012 12:19 AM, Parv wrote:

in message4fcf48af@tundraware.com,
wrote Tim Daneliuk thusly...



...

Within a makefile, I need to assign the name of a program as in:

FOO = bar.

The problem is that 'bar' may also be know as, say, bar.sh.

...

Is there a simple way to determine which form bar or bar.sh on
on a given system *at the time the make is run*?  If both exist, I
will pick one arbitrarily,

...

  For example I don't think this works when both are there:

FOO = $(shell `which bar bar.sh)


Modify the subshell command to ...

   which bar bar.sh | head -n 1


... as in (for FreeBSD make) ...

   shell=`which zsh sh tcsh csh 2/dev/null | fgrep -v 'not found' | head -n 3`

   all:
 @printf %s\n ${shell}



   - parv



Thanks.  I came up with something similar, but I think your recipe is a bit
more elegant ...

--

Tim Daneliuk tun...@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Somewhat OT - A Makefile Question

2012-06-07 Thread parv
in message 4fd0adfb.8030...@tundraware.com,
wrote Tim Daneliuk thusly...

 On 06/07/2012 12:19 AM, Parv wrote:
  in message4fcf48af@tundraware.com,
  wrote Tim Daneliuk thusly...
 
  ...
  Within a makefile, I need to assign the name of a program as
  in:
 
  FOO = bar.
 
  The problem is that 'bar' may also be know as, say, bar.sh.
  ...
  Is there a simple way to determine which form bar or bar.sh
  on on a given system *at the time the make is run*?  If both
  exist, I will pick one arbitrarily,
  ...
For example I don't think this works when both are there:
 
  FOO = $(shell `which bar bar.sh)
 
  Modify the subshell command to ...
 
 which bar bar.sh | head -n 1
 
 
  ... as in (for FreeBSD make) ...
 
 shell=`which zsh sh tcsh csh 2/dev/null | fgrep -v 'not found' | head 
  -n 3`
...
 Thanks.

Happy to help.


 I came up with something similar, but I think your recipe is a bit
 more elegant ...

It was If both exist, I will pick one arbitrarily ...  that
helped much in modification of the original.


  - parv

-- 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Somewhat OT - A Makefile Question

2012-06-06 Thread Tim Daneliuk

Not strictly FBSD, but ...

Within a makefile, I need to assign the name of a program as in:

FOO = bar.

The problem is that 'bar' may also be know as, say, bar.sh.  Worse still
both bar and bar.sh can exist with one linked to the other.  Is there
a simple way to determine which form bar or bar.sh on on a given
system *at the time the make is run*?  If both exist, I will pick
one arbitrarily, I just don't want the detection mechanism to fail when
this is the case.  For example I don't think this works when both
are there:

FOO = $(shell `which bar bar.sh)

Thanks,
--

Tim Daneliuk tun...@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Somewhat OT - A Makefile Question

2012-06-06 Thread Parv
in message 4fcf48af@tundraware.com,
wrote Tim Daneliuk thusly...

...
 Within a makefile, I need to assign the name of a program as in:

 FOO = bar.

 The problem is that 'bar' may also be know as, say, bar.sh.
...
 Is there a simple way to determine which form bar or bar.sh on
 on a given system *at the time the make is run*?  If both exist, I
 will pick one arbitrarily,
...
  For example I don't think this works when both are there:

 FOO = $(shell `which bar bar.sh)

Modify the subshell command to ...

  which bar bar.sh | head -n 1


... as in (for FreeBSD make) ...

  shell=`which zsh sh tcsh csh 2/dev/null | fgrep -v 'not found' | head -n 3`

  all:
@printf %s\n ${shell}



  - parv

-- 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org