SWAG >> GuessBuild

Download GuessBuild

The latest source for guessbuild is available below. This is the first release of this product. While effort has been made to test it, the software may contain bugs. The source code assumes 4 character tabs.

Source code 1.0.0 [guessbuild.cpp] [Makefile]

This software is being constantly developed and improved; check back often for newer versions.


GuessBuild is a tool intended to assist in constructing a pseudo build history, when the collective source code which one wishes to examine using asx, acd, etc. cannot have a build history generated as consequence of actually performing a build. This may be because the source comes with no instructions on how to build it, or because the system is not suitably set up to permit available make files to be executed on it. For example the make files may presume that environment variables are preset with unknown values; that source code is in specific named directories, or there are simply so many makefiles that could be executed that it is not at all clear what make files build what parts of the system.

This program when presented with a list of files one per line contained in a file (typically discovered using the find program) emits a pseudo build history to standard output, describing a best guess as to how the source contained within this list might be compiled to assembler. All files within this list except those having the suffix '.c', '.cpp' and '.h' are ignored. Each file whose suffix is '.c' or '.cpp' is scanned. Occurrances of #include statements whose include file is contained in double quotes (ie. a user provided header) within such a scanned source file result in all '.h' files (in the input list) which might be the target to be included (as consequence of having the correct final steps in the path name) being identified. For each such potentially intended header file to include in this source, the directory containing it is added to the list of those to be specified using the "-I" argument in the pseudo build history.

Source code which has one or more include statements referencing user header files that match no candidate header file in the list of files provided as input, are presumed to be unbuildable, and not added to the pseudo-build history. Instead they are reported as lacking suitable header files on the standard error output. Later in this same output a breakdown of the source code dependent on each missing header file is also provided. Empty source code is also reported on the standard error output but otherwise ignored.

Each source file which has one or more possible known header files that might be intended to replace the include statements found in it results in a statement suggesting how it might be compiled to assembler emitted to standard output. This output is in the format expected by acd and asx. Include directories are ordered (order of examination when performing header file inclusion) by the number of initial characters in the directory path name which agree with the same initial characters in the source file name. Within this ordering, directories with the same number of initial matching characters, are further ordered so that directories identified as containing many header files included within a given source file, occur before directories which have fewer potentially included header files within them. This ordering results in a best guess as to where each header file should be obtained from when compiling each source file. Obviously, when only one header file is a candidate to be included, no such guessing is required.

Upon completion of processing, standard output may be used as input to asx, acd, etc. Into the standard error output is also reported all the defines used within simple #ifdef and #ifndef statements, permitting the build history to be manually augmented with those defines that the user considers (given their names) to be potentially required. Finally, some statistics about the source examined is reported on standard error output.


guessbuild file-containing-filenames > build.history 2> errors

Developed by

  • Ian Davis.


  • swag:~ijdavis/src/guessbuild
  • swag:~ijdavis/bin/guessbuild -- executable


  • Subject to change.. still under development.

Contact information

For more information on this software please contact us at .