help-make
[Top][All Lists]
Advanced

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

Re: How to expand computed variable names within for script command?


From: Larry Evans
Subject: Re: How to expand computed variable names within for script command?
Date: Mon, 27 Jul 2015 16:57:57 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

On 07/27/2015 03:39 PM, Paul Smith wrote:
> On Mon, 2015-07-27 at 13:50 -0500, Larry Evans wrote:
>> Thanks Paul.  It works; however, what I really
>> want is to use the compiler to compile a source file to
>> and object file.
> 
> Well, it usually works best to ask the question you want the answer to,
> rather than a different question :-).
> 
>> How should I modify this 2nd version of the Makefile to make it compile
>> to produce the .o and not the a.out file?  BTW, I'd rather not
>> hardcode the -c into compile command because the actual args to the
>> compile command depend on the compiler.  Also, I'd like the output
>> object file name to be $(MAIN).gcc.o instead of just $(MAIN).o.
> 
> I don't really understand this, at all.  Why do you have a loop in your
> recipe?  Can you provide a more realistic example?  Or else maybe
> provide some higher-level explanation of what you're trying to do?
> 
> In your original question I thought maybe you have multiple compilers
> and you wanted to write a "show info" type rule to show the paths to all
> of them.  But in this version of the makefile you're actually trying to
> compile code, so I don't understand why you're trying to loop through
> multiple compilers...?
> 
> Are you trying to compile the same file with different compilers, or
> something?
>


Yes.  I also have some macro values inside the code which I want
to change; hence, I'll have a nested for loop to change the macro
from defined to undefined.

Currently, I've clang and g++, for the clang compiler, I've got to
have a different -I; hence, there will be spaces in the compile
command.

Sorry I wasn't clear.  I was trying to simplify.

I've tried this before where I was trying to compare the speed
of different compilers and different implementations.  I finally
resorted to using python scripts.  My current problem is I'm
trying to compare g++ and clang++ diagnostics on some code.  g++
compiles the code without complaint; however, clang++ complains.
I was hoping to just run this whole script to do it all at
once, and report the result to clang users group, but I'm thinking it
maybe just easier to just unroll the loop myself instead of have a for
script :(

-regards,
Larry





reply via email to

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