List all make targets?

Chuck Swiger cswiger at mac.com
Mon Jul 4 20:13:35 GMT 2005


Michael Dexter wrote:
>> Michael Dexter wrote:
>>> Is there a 'make' flag to list all make targets for any given 
>>> directory containing Makefile* ?
>>
>> grep ':' Makefile  ...comes pretty close.
> 
> Another reader suggested I cat the file... I take it the answer is "no."

The answer is "it's probably not useful".

Make uses implied rules for suffix transformations, so for example there is an 
implied target for foo.o which depends on foo.c, which looks something like:

.c.o            :
         ${CC} ${CFLAGS} -c ${.IMPSRC}

These rules represent a few hundred lines worth of build rules which could be 
applied to any file as needed in order to build things without having these 
rules actually specified in the Makefile itself.

> Specifically I am looking for a quick way to see the make targets as 
> 'make' would accept them while hunting for 'uninstall' and other 
> surprises. I see that it gets complicated as i.e. "_legacy" is a 
> legitimate target along with "buildworld." More to investigate!

"make -n -d g1 | less"...?  Take a look at the main target and at the "parents" 
target at the top.

-- 
-Chuck


More information about the freebsd-questions mailing list