tree: adb7a1b278303f3a76ee9e6d318de77b3a37359b [path history] [tgz]
  5. config.json
third_party/amalgamate/ - Amalgamate C source and header files


Mirror: aims to make it easy to use SQLite-style C source and header amalgamation in projects.

For more information, please refer to:

Here be dragons is quite dumb, it only knows the bare minimum about C code required in order to be able to handle trivial include directives. It can produce weird results for unexpected code.

Things to be aware of: will not handle complex include directives correctly:

    #define HEADER_PATH "path/to/header.h"
    #include HEADER_PATH

In the above example, path/to/header.h will not be included in the amalgamation (HEADER_PATH is never expanded). makes the assumption that each source and header file which is not empty will end in a new-line character, which is not immediately preceded by a backslash character (see of ISO C99). should be usable with C++ code, but raw string literals from C++11 will definitely cause problems:

    R"delimiter(Terrible raw \ data " #include <sneaky.hpp>)delimiter"
    R"delimiter(Terrible raw \ data " escaping)delimiter"

In the examples above, will stop parsing the raw string literal when it encounters the first quotation mark, which will produce unexpected results.


Python v.2.7.0 or higher is required. can be tested and installed using the following commands:

    ./ && sudo -k cp ./ /usr/local/bin/

Using [-v] -c path/to/config.json -s path/to/source/dir \
            [-p path/to/prologue.(c|h)]
  • The -c, --config option should specify the path to a JSON config file which lists the source files, include paths and where to write the resulting amalgamation. Have a look at test/source.c.json and test/include.h.json to see two examples.

  • The -s, --source option should specify the path to the source directory. This is useful for supporting separate source and build directories.

  • The -p, --prologue option should specify the path to a file which will be added to the beginning of the amalgamation. It is optional.