help-make
[Top][All Lists]
Advanced

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

first questions - which timestamp does make use & can someone explain th


From: Richard McLean
Subject: first questions - which timestamp does make use & can someone explain this old style syntax for phony target
Date: Mon, 29 Jul 2013 13:04:59 +1000

This is my first post so please excuse any stupidity on my part regarding make. 

I have read the make manual and the O'Reilly book but have not yet found clear 
answers to a couple of things :


1.  Can someone elaborate a little on the algorithm Make uses to determine when 
a file is out of date ?
        -in the manual and the book, it says the file's modification time
        -does this represent the ctime or the mtime ?
        -are there any other factors determining whether a file is out of date ?
        -I found on a web page somewhere (could have been about non-GNU make) 
that file size was also used... is that true ?


2. In the O'Reilly book "C In a Nutshell", in the Chapter "Using Make to Build 
C Programs", in the section on Phony Targets, page 527-8, there is a part that 
reads...


.PHONY:  bin
bin :  circle
        $(MKDIR)  $@
        $(CP)  $<  $@/
        $(CHMOD)  600  $@/$<

An old fashioned, slightly less intuitive way of producing the same effect (as 
declaring a target .PHONY) is to add another rule for the target with no 
prerequisites and no commands :

bin : circle
        $(MKDIR)  $@
        $(CP)  $<  $@/
        $(CHMOD)  600  $@/$<

bin:

 The .PHONY target is preferable if only because it is so explicit, but you may 
see the other technique in automatically generated dependency rules, for 
example.



I was under the impression that the final prerequisite list for a given target 
is the concatenation of all the prerequisites listed for that target which can 
appear in several rules.
Why doesn't the line "bin:", just add zero additional prerequisites to the list 
and do nothing else ?
Why does the "old fashioned" code have the same effect as the .PHONY code ?


Thank You

Richard

reply via email to

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