Re: C++ build systems
On Sep 16, 10:39 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote:
On Sep 16, 3:59 am, James Kanze <james.ka...@gmail.com> wrote:
On Sep 15, 11:30 pm, Joshua Maurice <joshuamaur...@gmail.com> wrote:
Specifically, I'm very curious how close your build system is
to my "ideal" build system. My ideal build system has two
requirements, fast and correct. Correct means that a full
build at any time produces the same results as a build from a
completely clean local view. Fast means fast. When builds can
take hours or more, I don't want to look at an error, and
wonder if it was because I didn't build from clean,
potentially wasting more hours as I do a sanity check rebuild.
All build systems can be made correct by having it first
completely clean out the local view, then building. However,
this is also the polar opposite of fast. I think it's fair to
say that the only way to achieve correct and fast is to have
an incremental build system, a build system that builds
everything which is out of date, and does not build anything
already up to date.
The problem is that it is very, very difficult to do this and be
correct. Most build systems I've seen compromise somewhere, and
will occasionally rebuild things that aren't necessary.
(From what I've heard, Visual Age is the exception. But I've
never had the chance to try it, and from what I've heard, it
also compromizes conformance somewhat to achieve this end.)
Indeed. I would argue that you would need to solve the Halting
Problem to actually get a system where you only recompile that
which you need to recompile.
Not at all. As I said, Visual Age does (or did) it. For other
reasons, Visual Age wasn't fully conform, but I think those
reasons are fixable.
What you do need is a partial compiler more or less built into
the editor, which parses enough of the file (header or source)
each time you save it to update what definitions it depends on,
and which compares all of your definitions against saved copies.
You then maintain the list of definitions and last modification
dates somewhere (in a database?), and use it, rather than
It's not really fundamentally different from using timestamps,
except for the granularity.
I don't know anything implementable-by-me offhand which is
better than to compare last modified file timestamps and build
dependent files (ala Make).
Well, it's obviously more difficult to implement, since you need
to implement a large part of a C++ compiler, and somehow
integrate it into your editor. Definitely not a week-end
"Out of date" implies timestamps, I think.
Maybe. But timestamps of what? Files, or something with a