[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make not expanding variables
From: |
Philip Guenther |
Subject: |
Re: make not expanding variables |
Date: |
Fri, 8 Aug 2014 21:07:18 -0700 |
Take 3! #(*$&(#*%$&
On Fri, Aug 8, 2014 at 8:55 PM, Philip Guenther <address@hidden> wrote:
> On Fri, Aug 8, 2014 at 7:43 AM, Vance Turnewitsch <address@hidden
> > wrote:
>>
>> I'm using Ubuntu 12.04 64bit with make version 3.81-8.1ubuntu1.1 and was
>> failing to build bitbake recipes. I narrowed it down to an odd problem
>> with
>> make not expanding variables. I've attached a sample make file (makefile)
>> with the "problem."
>>
>> When I use this makefile, I get a directory "{hi,hi2}" within TestMake but
>> instead there should be two directories within TestMake created: "hi" and
>> "hi2", correct?
>>
>
>
> Well, that depends on the behavior of the shell that your system's 'make'
> is compiled to use by default as ${SHELL}.
>
There are basically two possible explanations:
1) your system's 'make' doesn't think that it needs to invoke a shell at
all and is just exec'ing cp directly, OR
2) the ${SHELL} that your system's 'make' defaults to doesn't perform brace
expansion.
You can figure out what ${SHELL} is used by putting that in a rule; you can
then test *that* program to see if it does brace expansion. If it
*doesn't*, then you've confirmed the answer is (2). If it *does*, then
perhaps strace make to confirm whether it's exec'ing the shell or cp
directly.
HOWEVER, you should note that "brace expansion" is not part of the
POSIX/Single-Unix specification, so a Makefile using it is not portable and
you should consider doing the expansion yourself. The examples you gave
are trivially expanded (indeed, shorter and easier to type *without* the
braces); in the more complicated cases some careful use of variables should
be considered...
Philip Guenther