Solved How to generate Makefile.depend?

zirias@

Developer
I'm preparing my first attempt to add something to FreeBSD base. Well, it works the way I want, all fine. My solution needs a new little suid-helper tool in libexec, so I had to create a new directory for it. Unfortunately, I can't figure out how to generate the Makefile.depend. What I understand so far is that there is a mechanism to generate them out of .meta files, and they are required to have correct dir dependencies...

Could anyone give me a hint what do to?

Some "getting started" documentation about the source tree (and especially the build system) would be quite nice as well ;)
 
Found this already and it didn't seem to do anything here :what:
Right now, I'm doing a complete rebuild of world and will then try again ...
 
I'm seriously at a loss here. Tried quite a few things, from using gendirdeps.mk directly as top-level Makefile (with -f option, does nothing...) to including several things like e.g. meta.sys.mk etc (not sure what this achieves, but not what I want), to including gendirdeps.mk, which gave me this output:
Code:
root@testbuilder:/usr/src/libexec/pam_unix-helper # make
echo pam_unix-helper: /usr/lib/libc.a /usr/lib/libcrypt.a >> .depend

All this after (again) building the whole "world" in meta-mode. I don't know where it created that .depend file, probably somewhere in the obj tree, but it really doesn't look like a valid Makefile.depend anyways...

Really hope someone can help me out here ;)
 
You already got your answer but perhaps you'll find the following context helpful.

I came across BSDCan 2014 FreeBSD bmake and meta mode[1]. In the accompanying video Simon Gerraty explains the origin of bmake as a derivitive of NetBSD's make in the early nineties, its entrance in Junos & NetBSD and the transformation process for FreeBSD's base (in FreeBSD 10) and ports as it replaced the then current /usr/bin/make. That then current one was fmake; both bmake and fmake have its origins in pmake[2].

Note that the slides in the video are not the same as the pdf slides: FreeBSD building with bmake (I found the added spoken context helpful). With the introduction of meta mode it was no longer necessary to manually do make depend in order to generate Makefile.depend [3] (top level make files in Junos, Netbsd and FreeBSD were greatly shortened and reduced in complexity with the introduction of meta mode). Dependencies[4] are handled by files like dirdeps.mk that uses many features of bmake. Makefile.depend-s can be generated manually but can also be generated by means of the meta mode[5].


[1] Also mentioned on the home page of Simon Gerraty
[2] PMake - A Tutorial by Adam de Boor
[3] Currently FreeBSD only seems to have mkdep(1); make depend may have morphed into mkdep as the latter still mentions that it generates a .depend file, I don't know the details.
[4] Optional DIRDEPS at A random collection of blatherings
[5] bmake: Meta Mode
Also, see for example the explanation at slides
"Why bmake" and 'FreeBSD bmake and meta mode" starting at ca. 5:18 min.
bmake & dirdeps starting at ca. 36:28 min.
Introducing meta mode starting at ca. 53:37 min; also: automated capture of dependency information & avoid make depend.
Extracting dependencies starting at ca. 1:05:39 hour.
 
Last edited:
Back
Top