Discussion:
make buildworld: build changes only?
Geert Hendrickx
2004-07-01 22:54:53 UTC
Permalink
Hi,

I'm keeping track of -STABLE on semi-regular basis. But when I cvsup to
the latest sources and do make buildworld, it always starts to rebuild
the world entirely from scratch. That's somewhat frustrating,
especially if cvsup showed only a screenful of changes.

Is it possible to rebuild these changes only? I know I could cd to the
directory of each changed file and do a make install there, but that is
of course not quite practical. I suppose this could be automated, since
this was exactly the design principle of make: rebuild changed sources
only.

I know this might brake some dependencies in some cases, but I expect
this to be rare. I could still do a "full" buildworld when necessary.

Any suggestions?

GH
Kris Kennaway
2004-07-02 23:11:40 UTC
Permalink
Post by Geert Hendrickx
Hi,
I'm keeping track of -STABLE on semi-regular basis. But when I cvsup to
the latest sources and do make buildworld, it always starts to rebuild
the world entirely from scratch. That's somewhat frustrating,
especially if cvsup showed only a screenful of changes.
Is it possible to rebuild these changes only? I know I could cd to the
directory of each changed file and do a make install there, but that is
of course not quite practical. I suppose this could be automated, since
this was exactly the design principle of make: rebuild changed sources
only.
I know this might brake some dependencies in some cases, but I expect
this to be rare. I could still do a "full" buildworld when necessary.
Any suggestions?
The only safe way to rebuild is with the full documented cycle that
includes a buildworld. "Unsafe" means "may leave you with an unusable
system". If you want to play around with other make targets you can
indeed short-cut the build process a lot of the time, but you're
expected to be advanced enough to recover your system on your own when
you damage something, and that pretty much means being able to figure
out how to use the make shortcuts on your own :-)

Kris
Giorgos Keramidas
2004-07-02 23:18:36 UTC
Permalink
Post by Geert Hendrickx
Is it possible to rebuild these changes only? I know I could cd to the
directory of each changed file and do a make install there, but that is
of course not quite practical. I suppose this could be automated, since
this was exactly the design principle of make: rebuild changed sources
only.
I know this might brake some dependencies in some cases, but I expect
this to be rare. I could still do a "full" buildworld when necessary.
Not if the 'partial build' produces a system that's not working good
enough to do a full buildworld though :(

If you know what you're doing, it's possible -- most of the time -- to
get away with something like this:

$ cd /usr/src
$ cvs -qR up -APd
$ cd usr.bin/foo/
$ make clean all install

But this isn't guaranteed to always work and it cannot be automated in
the way that you might be thinking of (i.e. run a couple of commands
and let everything magically fall into place). The most automated way
of building stuff is practically a crontab script that runs:

if [ ! -f /root/.noautobuildworld ]; then
cvsup -g -L 2 -h cvsup-server.example.net /root/supfile
cd /usr/src && \
make buildworld
fi

Output shall be mailed to root, since this is called from crontab, and
you'll be able to `touch /root/.noautobuildworld' to inhibit automatic
buildworlds and use the last known good build from /usr/obj to install
your system with `make installworld' as usual.

HTH,
Giorgos
Conrad J. Sabatier
2004-07-02 23:51:42 UTC
Permalink
Post by Geert Hendrickx
Hi,
I'm keeping track of -STABLE on semi-regular basis. But when I cvsup
to the latest sources and do make buildworld, it always starts to
rebuild the world entirely from scratch. That's somewhat frustrating,
especially if cvsup showed only a screenful of changes.
Is it possible to rebuild these changes only? I know I could cd to
the directory of each changed file and do a make install there, but
that is of course not quite practical. I suppose this could be
rebuild changed sources only.
make -DNOCLEAN buildworld

See /usr/src/Makefile.inc1 for all the various switches that are
available. You may want to set some of them permanently in
/etc/make.conf.

Just do be aware that doing this can lead to trouble sometimes.
--
Conrad J. Sabatier <***@cox.net> -- "In Unix veritas"
Geert Hendrickx
2004-07-03 09:19:37 UTC
Permalink
Post by Conrad J. Sabatier
make -DNOCLEAN buildworld
See /usr/src/Makefile.inc1 for all the various switches that are
available. You may want to set some of them permanently in
/etc/make.conf.
Just do be aware that doing this can lead to trouble sometimes.
Ok, I think this is what I was looking for. But what's the difference
between these: ?

# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
# -DNOCLEAN do not clean at all

GH
Conrad J. Sabatier
2004-07-03 11:31:01 UTC
Permalink
Post by Geert Hendrickx
Post by Conrad J. Sabatier
make -DNOCLEAN buildworld
See /usr/src/Makefile.inc1 for all the various switches that are
available. You may want to set some of them permanently in
/etc/make.conf.
Just do be aware that doing this can lead to trouble sometimes.
Ok, I think this is what I was looking for. But what's the
difference
between these: ?
# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
# -DNOCLEAN do not clean at all
Well, as the comment says, -DNOCLEAN does no cleaning at all before
starting the build.

The comments in /usr/share/mk/bsd.obj.mk (which is indirectly called
from Makefile.inc1):

# clean:
# remove ${CLEANFILES}; remove ${CLEANDIRS} and all contents.
#
# cleandir:
# remove the build directory (and all its contents) created by obj
#
# obj:
# create build directory.
#

So "make clean" first cleans any object files out of the object
directories and then removes them (why, I don't know).

"make cleandir" simply blasts away the entire object directory.
--
Conrad J. Sabatier <***@cox.net> -- "In Unix veritas"
Loading...