Le 02/11/2019 à 12:01, Robert P. J. Day a écrit :
> 
>   junior colleague who is just learning make and is going through make
> manual asked me the other day (regarding section 2.3 in manual) about
> this passage:
> 
> "By default, make starts with the first target (not targets whose
> names start with ‘.’). This is called the default goal. (Goals are the
> targets that make strives ultimately to update ..."
> 
>   the question was, "what is the difference between a 'goal' and a
> 'target'?"
> 
>   i wasn't quite sure ... i didn't think there was any substantive
> difference. the best i could come up is that targets define what *can*
> be invoked, while the goal is the target you're currently *trying* to
> update, but that sounded pretty lame.
> 
>   is there a better explanation? or am i overthinking this?

As far as I understand the make parlance, a "goal" is passed to make on the 
command line:

    make GOAL1 GOAL2...

It is what we really want, not the intermediate targets that make may also 
build to reach the goals. If make is invoked without a goal a default one is 
selected, based on the rules you already know.

Remarks:

* A goal must be a target, else you get an error because make does not know how 
to reach the goal.
* A target is not necessarily a goal for a given make invocation. Indeed, 
usually, most targets are not goals.
* Any target can be a goal if make is invoked with this target as the specified 
goal (or if it is the default goal and make is invoked without a specified 
goal).

> 
> rday
> 


-- 
Renaud Pacalet
Télécom Paris
Campus SophiaTech
450 Route des Chappes, CS 50193
06904 Biot Sophia Antipolis cedex, FRANCE
Tel : +33 (0) 4 9300 8402
Web : http://www.telecom-paris.fr/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to