help-make
[Top][All Lists]
Advanced

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

Re: Troubles with makefile


From: VitalyP
Subject: Re: Troubles with makefile
Date: Tue, 10 Jun 2008 01:32:08 -0700 (PDT)



Philip Guenther-2 wrote:
> 
> On Sun, Jun 8, 2008 at 8:26 AM, VitalyP <address@hidden> wrote:
>> I am doing simple codegen with makefile. File gen.c is generated from
>> gensrc.c. The example below works correctly and gen.c is generated
>> when gensrc.c has more recent timestamp
> ...
>> However in the example below gen.c is generated even if gensrc.c is
>> older than gen.c. That is target 'prebuild' is always considered as
>> not up-to date. Why is it so?
>>
>> .PHONY: prebuild
>>
>> test: gen.c
>>    gcc -o $@ $<
>>
>> gen.c: prebuild
>>
>> prebuild: gensrc.c
>>    # here goes some codegen command
> 
> As Sam says, because .PHONY targets are always out-of-date.  But what
> are you trying to accomplish?  What is the 'prebuild' target supposed
> to do?  My guess is that you want "make prebuild" to build the
> generated source file(s).  To do that, you would make the generated
> file(s) like gen.c prerequisites of prebuild, not the other way
> around, ala:
> 
> prebuild: gen.c
> 
> 
> Philip Guenther
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
> 
> 

Thanks, I decide to get rid of prebuild phony target

-- 
View this message in context: 
http://www.nabble.com/Troubles-with-makefile-tp17719829p17750358.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.





reply via email to

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