help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read a source file with gnu make?


From: Philip Guenther
Subject: Re: read a source file with gnu make?
Date: Tue, 27 May 2014 15:24:33 -0700

On Tue, May 27, 2014 at 2:01 PM, patrick <address@hidden> wrote:

> Hello,
> I am begginer with gnu make and I am trying to implement the next:
> -I have a source file which contains include directive

-I have a make file with the next content:
>
> file_nam=demo_c0.txt
> file_content=$(shell cat ${file_nam})
> rez=$(word 1,$(file_content))
> f:
>         echo $(rez)
>
> When I am executing this nothing is displayed,
>

I doubt it.  I would bet you're either seeing this:
   echo #include
or maybe this:
   make: 'f' is up to date.

...or you didn't quote your Makefile accurately.  If your makefile actually
had this rule:

f:
        @echo $(rez)

*then* you would see nothing...and removing the '@' makes the problem more
clear: the $(rez) is expanded before the command is passed to the shell, so
any shell meta-characters in it will still be magic to the shell.  The
shell treats words starting with a '#' as the start of a comment, so from
there to the end of the line will be ignored.  To pass it through you'll
need to quote it either with single or double-quotes, ala:

f:
        @echo '$(rez)'


Philip Guenther


reply via email to

[Prev in Thread] Current Thread [Next in Thread]