|
Home > Archive > Unix Programming > May 2005 > What's wrong with this bash/Makefile?
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 |
What's wrong with this bash/Makefile?
|
|
| Billy Patton 2005-05-13, 8:05 am |
| I'm trying to combin the functionality of makefile ( for the dependancies)
inside a bash, Without having a different file.
Here's my script:
#!/bin/bash
printf "In bash\n";
eval "/usr/local/bin/make -f - all DO_THIS=/bin/ls"<<!
DO_THIS := something
all :
@printf "In the make section\n"
@printf "DO_THIS = ${DO_THIS}\n"
!
printf "back in bash\n";
Here's the result:
In bash
In the make section
DO_THIS =
back in bash
It does execute the make and hit the all colon definition.
But it does not get the value of DO_THIS tat I pass in.
What is the problem?
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, b-patton@ti.com
| |
| T.M. Sommers 2005-05-14, 1:23 pm |
| Billy Patton wrote:
> I'm trying to combin the functionality of makefile ( for the dependancies)
> inside a bash, Without having a different file.
> Here's my script:
> #!/bin/bash
> printf "In bash\n";
>
> eval "/usr/local/bin/make -f - all DO_THIS=/bin/ls"<<!
> DO_THIS := something
> all :
> @printf "In the make section\n"
> @printf "DO_THIS = ${DO_THIS}\n"
The substitution for ${DO_THIS} is being done by the shell. For
make to see it, escape it:
@printf "DO_THIS = \${DO_THIS}\n"
--
Thomas M. Sommers -- tms@nj.net -- AB2SB
| |
| Måns Rullgård 2005-05-14, 1:23 pm |
| Billy Patton <bpatton@ti.com> writes:
> I'm trying to combin the functionality of makefile ( for the dependancies)
> inside a bash, Without having a different file.
> Here's my script:
> #!/bin/bash
> printf "In bash\n";
>
> eval "/usr/local/bin/make -f - all DO_THIS=/bin/ls"<<!
No need for that eval.
> DO_THIS := something
> all :
> @printf "In the make section\n"
> @printf "DO_THIS = ${DO_THIS}\n"
>
> !
>
> printf "back in bash\n";
>
> Here's the result:
> In bash
> In the make section
> DO_THIS =
> back in bash
>
> It does execute the make and hit the all colon definition.
> But it does not get the value of DO_THIS tat I pass in.
> What is the problem?
The shell expands variables in the here-doc. To prevent that, do
this, noting the backslash:
make -f - <<\END
makefile here
END
--
Måns Rullgård
mru@inprovide.com
|
|
|
|
|