Make Tool

More pertinent stuff is happening at MakeProgram.


A MakeTool is a program which will organise the building of software from source code. There is detail about this in GnuMake, and how complicated it can be.

What is needed is a MakeMakeTool which will generate the makefiles from a scripting language which the user can write.

One such tool is CMake

-- JohnFletcher

See also RakeMake.


automake/autoconf?

Or, for real dinosaurs.... imake?


First off, I'll confess that I haven't had tons of experience with classic makefiles, but I have had some, and most of it has been not so great. The biggest problem that I see is that dependencies have to be maintained by programmers, and it is not always obvious when a new dependency has been introduced. Worse is that if you forget the dependency, the error doesn't surface in all cases and when it does it is a real nightmare. For example a .h file in C is modified but not all .c files are recompiled due to a missing dependency and you have mismatched data structures. Trying to figure this out while debugging is a real pain. You usually just "make all" after getting really confused and the problem disappears, only to surface again the next time because its too difficult to track down the missing dependency.

Hand-maintaining source-file dependencies for more than SevenPlusOrMinusTwo files is unlikely to work for any length of time. If you cannot reliably autogenerate this dependency information, then hand-coding it into your makefile will only give you a false sense of security and eventually lead to the type of pain described above.

Java and Ant mostly eliminate this need, but most real world projects have other components that must be built and play into the dependencies of the final result.

It is possible but non-trivial to write a makefile that handles dependencies for C and similar languages as reliably and transparently as Java and Ant. Such a makefile is described by AdvancedAutoDependencyGeneration.

In my current and previous jobs, I've converted some fairly ad-hoc and error prone manual building procedures into fully automated source control to shipping deliverable builds, and I've not used dependencies at all! When a developer needs to do an incremental build, he either *knows* what needs to be built because it's not that complex, or he builds more major chunks that are known to be a superset of what needs to be built. It works very well.

An important point is that the build system does know all the independent steps and the order in which those steps must occur, so that the developer need not remember that. He just specifies which source files he wish to build, and the steps associated with them occur in the right sequence.

Again, this has worked very well, and no one ever has to worry about keeping dependencies up to date.

Tools that automatically generate dependencies are fine, but they usually work in a limited domain. When you have custom code generators involved in your build or some funky on-line help formatting tools, these will usually not work well.

One way to deal with this is to develop your own dependency generators for these tools. How easy that is to do will depend on how much your tools behave like a compiler.

Our computers are fast enough that for small projects, always build everything when you are in doubt about what needs building. For large projects, sub-divide into sub-projects such that will be known that a sub-project is a superset of what needs to be compiled based on what you've changed.

Subdividing the project can lead to its own set of problems, described by RecursiveMakeConsideredHarmful (the paper, less the wiki page).

With ContinuousIntegration, you rarely have too much checked out, and so you know what needs to be compiled.

There are times, though few, where changes are made and the safest thing is to rebuild everything, because you don't know which sub-projects are sufficient. But they don't happen often enough to warrant maintaining dependencies.

A different question is whether they happen often enough to warrant writing a makefile that maintains the dependencies for you. The answer to that depends on things like the size and complexity of the project, number of developers, and the frequency of updates from VersionControl.


CategoryCpp CategorySoftwareTool


EditText of this page (last edited August 10, 2014) or FindPage with title or text search