Question about MINIX3.4 Build system

136 views
Skip to first unread message

Daniel Wang

unread,
Apr 20, 2017, 1:44:30 PM4/20/17
to minix3
Hi all,

I've become interested in the MINIX3.4 build system. I think I understood the most part of the build.sh and Makefile. However, there are some parts of the output information still puzzles me. It would be great if someone can help me shed light on the following outputs.

First I understood the build system call make and print out current build progress ('===>') uses the function MAKEDIRTARGET defined in bsd.own.mk.

I also understood that the build starts with release -> distribution -> build -> check-tools -> do-top-obj, etc. (one by one from ${BUILDTARGETS})

However, I do not know how 'do-top-obj ===> .' and 'do-tools-obj ===> .' and 'obj ===> tools/host-mkdep' etc. being printed out? I could not find if there is any call such as ${MAKEDIRTARGET} . do-top-obj. What I missed?


build ===> . (with: NOPOSTINSTALL=1)
Build started at: Wed Apr 19 22:42:11 EDT 2017
check-tools ===> .
do-top-obj ===> .
obj ===> . (with: NOSUBDIR=)
do-tools-obj ===> .
obj ===> tools
obj ===> tools/host-mkdep

Thank you very much!
-Dan

Jean-Baptiste Boric

unread,
Apr 21, 2017, 2:08:37 PM4/21/17
to minix3
Hi,

The MINIX build system in recent versions is in fact the NetBSD build system. Documentation might be easier to find under that name.

Daniel Wang

unread,
Apr 21, 2017, 3:25:58 PM4/21/17
to minix3
Thanks Jean-Baptiste do you have any documents you would recommend? I did some search on the NetBSD build system but I only found some info about how to use it, rather than the internal details.

Thanks
-Dan 

Sambuc Lionel

unread,
Apr 21, 2017, 3:56:19 PM4/21/17
to MINIX3 Google Group
Hello Dan, and welcome,

> On 20 Apr 2017, at 19:44, Daniel Wang <danielw...@gmail.com> wrote:
>
> Hi all,
>
> I've become interested in the MINIX3.4 build system. I think I understood the most part of the build.sh and Makefile. However, there are some parts of the output information still puzzles me. It would be great if someone can help me shed light on the following outputs.
>
> First I understood the build system call make and print out current build progress ('===>') uses the function MAKEDIRTARGET defined in bsd.own.mk.
>
> I also understood that the build starts with release -> distribution -> build -> check-tools -> do-top-obj, etc. (one by one from ${BUILDTARGETS})

That statement is slightly incorrect, "make" by design, builds a dependency tree, and once it has done so, re-orders each targets (which can be anything) in a sorted order* which guarantees that all the dependencies are available before trying to build a specific target.

*(this is a typical topological sort application, as we need to find an order among a tree)

>
> However, I do not know how 'do-top-obj ===> .' and 'do-tools-obj ===> .' and 'obj ===> tools/host-mkdep' etc. being printed out? I could not find if there is any call such as ${MAKEDIRTARGET} . do-top-obj. What I missed?
>

In src/Makefile:
501 do-tools: .PHONY .MAKE
502 >.......${MAKEDIRTARGET} tools build_install
503
504 do-lib: .PHONY .MAKE
505 >.......${MAKEDIRTARGET} lib build_install
506
507 do-compat-lib: .PHONY .MAKE
508 >.......${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
509
510 do-top-obj: .PHONY .MAKE
511 >.......${MAKEDIRTARGET} . obj NOSUBDIR=
512
513 do-tools-obj: .PHONY .MAKE
514 >.......${MAKEDIRTARGET} tools obj
515
516 do-build: .PHONY .MAKE
517 .for targ in dependall install
518 >.......${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
519 .endfor

>
> build ===> . (with: NOPOSTINSTALL=1)
> Build started at: Wed Apr 19 22:42:11 EDT 2017
> check-tools ===> .
> do-top-obj ===> .
> obj ===> . (with: NOSUBDIR=)
> do-tools-obj ===> .
> obj ===> tools
> obj ===> tools/host-mkdep
>
> Thank you very much!
> -Dan

Also some relevant information is available in /usr/share/mk/bsd.README.

I hope this helps.


Kind regards,

Lionel

Antoine LECA

unread,
Apr 22, 2017, 6:21:41 AM4/22/17
to min...@googlegroups.com
On 21/04/2017 19:25Z, Daniel Wang wrote:
> do you have any documents you would recommend?

Something you should definitively read is the manual for the BSD variant
of make; it was called Pmake when written by Adam de Boor almost 30
years ago, and that name has stuck for the "book"; it is available
online at https://www.freebsd.org/doc/en/books/pmake/book.html (there
are not much difference between all variants of BSD make; as you know,
MINIX3 use the NetBSD breed.)

Next, you should be aware of Simon Gerraty (main contributor for
NetBSD's make(1) and the *.mk, both for build.sh and pkgsrc), which has
a web site at http://www.crufty.net/help/sjg/bmake.htm with many
information and IMHO the most readable view of the up-to-date man page.

Another piece you should absolutely read too is src/share/mk/bsd.README
as Lionel pointed out; it is the pristine NetBSD version and as such
does not apply verbatim to MINIX, but it gives you a general view of the
various "knobs" you can act on, and as such of the key variables you
should care of while reading the various makefiles and *.mk.


Antoine

Daniel Wang

unread,
Apr 23, 2017, 5:35:11 PM4/23/17
to minix3
Thank you Antoine! This is exactly I was looking for thank you very much for pointing that out.

Daniel Wang

unread,
Apr 23, 2017, 5:36:19 PM4/23/17
to minix3
Thank you very much Lionel! That's explained a lot! Thank you for your help!
Reply all
Reply to author
Forward
0 new messages