複数の buildworld2006年07月27日 11時18分26秒

FreeBSD の標準的なソースコードの置場は /usr/src だ。しかし、ここになければいけない訳ではない。複数のソースを同時に展開したり、コンパイルすることもできる。

例えば、/usr/src-currnet、 /usr/src-stable /usr/src/src-5.1 と /usr/src-6.1 などと置ける。これらのソースのそれぞれの位置に移動し make buildworld をすると、/usr/obj/usr/src-current や/usr/obj/usr/src-stable などとなる。

man make をすると、


     .OBJDIR         A path to the directory where the targets are built.  At
                     startup, make searches for an alternate directory to
                     place target files.  It will attempt to change into this
                     special directory and will search this directory for
                     makefiles not found in the current directory.  The fol-
                     lowing directories are tried in order:

                     1.   ${MAKEOBJDIRPREFIX}/`pwd`
                     2.   ${MAKEOBJDIR}
                     3.   obj.${MACHINE}
                     4.   obj
                     5.   /usr/obj/`pwd`


と出てくる。Makefile* を覗く。

%grep MAKEOBJ Makefile*
Makefile:MAKEOBJDIRPREFIX?=     /usr/obj
...
Makefile.inc1:MAKEOBJDIRPREFIX?=        /usr/obj
...

MAKEOBJDIRPREFIX を設定して、最初の .OBJDIR の条件の場所が使われる。

滅多に複数のソースを使うことも無いが、やはり便利だ。