Re: How to generate a Makefile.depend?

From: Warner Losh <imp_at_bsdimp.com>
Date: Fri, 18 Feb 2022 17:19:27 UTC
On Fri, Feb 18, 2022 at 9:58 AM Felix Palmen <felix@palmen-it.de> wrote:

> * Kyle Evans <kevans@freebsd.org> [20220218 09:44]:
> > Makefile.depend falls in "do not worry about it" territory; they're
> > only used for dirdeps mode, which to my understanding will tolerate
> > and generate the missing Makefile.depend as it goes anyways. bdrewery
> > or sjg periodically commit/update .depend files.
>
> Oh, that's really good to know, thanks!
>
> I guess I was confused because I found some old slides and other stuff
> about meta mode suggesting you had to generate them somehow, but lacking
> clear instructions. Could be worth mentioning in the developers
> handbook!
>
> So, to phab we go soon I guess, thanks again.
>

So, Makefile.depend is used only for dirdep mode. It is not used for
normal META mode. In dirdep mode, you can cd src/bin/ls and type
make from a clean tree. It will rebuild libc, csu, compiler_rt and whatever
else ls might depend on. Unless you are using dirdep and have mostly
clean trees, you won't notice if it's missing. There is an out-of-tree
python
script that generates these from time to time quickly. There's a make target
'make bootstrap-this' which will generate it for the current directory (I
believe, I'm reading code here). There's also a 'make bootstrap-empty'
that might be needed depending on the bootstrap method.

I *think* from the comments you could do a meta mode build, which
would populate the objdir with all the artifacts that the above targets use
to generate Makefile.depend and then use the above target to generate
the Makefile.depend for the one directory.

I usually don't bother, as I know these are regenerated from time to
time, but I'm always happy to change my workflow if there's enough
hassle to people from it.

Warner