From owner-freebsd-questions@FreeBSD.ORG Fri Jun 8 05:02:37 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 107791065763 for ; Fri, 8 Jun 2012 05:02:37 +0000 (UTC) (envelope-from parv@pair.com) Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com [71.74.56.122]) by mx1.freebsd.org (Postfix) with ESMTP id C071E8FC0C for ; Fri, 8 Jun 2012 05:02:36 +0000 (UTC) X-Authority-Analysis: v=2.0 cv=D8PF24tj c=1 sm=0 a=lLOF/jpPrR0dcgWXP1EvZg==:17 a=xCuMbNp8hPoA:10 a=OA0Fmnw7F14A:10 a=R5FhY6rjjCMA:10 a=kj9zAlcOel0A:10 a=Ymsr-CWnAAAA:8 a=MnkTnmICAAAA:8 a=ii_shwsMCsRNDqDar5QA:9 a=CjuIK1q_8ugA:10 a=VAeyC-Qft3gA:10 a=lLOF/jpPrR0dcgWXP1EvZg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 204.210.114.114 Received: from [204.210.114.114] ([204.210.114.114:26954] helo=localhost.hawaii.res.rr.com) by hrndva-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id EB/99-13336-B6781DF4; Fri, 08 Jun 2012 05:02:35 +0000 Received: by localhost.hawaii.res.rr.com (Postfix, from userid 1000) id B1C9D5C91; Thu, 7 Jun 2012 19:03:16 -1000 (HST) Date: Thu, 7 Jun 2012 19:03:16 -1000 From: parv@pair.com To: Tim Daneliuk Message-ID: <20120608050316.GA2190@holstein.holy.cow> Mail-Followup-To: Tim Daneliuk , FreeBSD Mailing List References: <4FCF48AF.307@tundraware.com> <20120607051901.GA2205@holstein.holy.cow> <4FD0ADFB.8030508@tundraware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FD0ADFB.8030508@tundraware.com> Cc: FreeBSD Mailing List Subject: Re: Somewhat OT - A Makefile Question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 05:02:37 -0000 in message <4FD0ADFB.8030508@tundraware.com>, wrote Tim Daneliuk thusly... > > On 06/07/2012 12:19 AM, Parv wrote: > > in message<4FCF48AF.307@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 --