From owner-freebsd-questions@FreeBSD.ORG Thu Jun 7 05:18:22 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB789106566C for ; Thu, 7 Jun 2012 05:18:22 +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 A7BDC8FC12 for ; Thu, 7 Jun 2012 05:18:22 +0000 (UTC) X-Authority-Analysis: v=2.0 cv=eIiRfQV1 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=onTmk75lrT2WfxXp8uIA: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:63657] helo=localhost.hawaii.res.rr.com) by hrndva-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id EF/3B-15196-C9930DF4; Thu, 07 Jun 2012 05:18:21 +0000 Received: by localhost.hawaii.res.rr.com (Postfix, from userid 1000) id EB43A5C8D; Wed, 6 Jun 2012 19:19:01 -1000 (HST) Date: Wed, 6 Jun 2012 19:19:01 -1000 From: Parv To: Tim Daneliuk Message-ID: <20120607051901.GA2205@holstein.holy.cow> Mail-Followup-To: Tim Daneliuk , FreeBSD Mailing List References: <4FCF48AF.307@tundraware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FCF48AF.307@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: Thu, 07 Jun 2012 05:18:23 -0000 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` all: @printf "%s\n" ${shell} - parv --