GNU build system: setting files generated by third-party tools as build dependencies
In this tutorial it is shown how to add files generated or edited by third-party programs as build dependencies.
In some cases, a build process may require that some specific files are either present in the system or kept up-to-date in order for the build process to succeed. Although it may be possible to rely on the programmer to keep those files up to date, it is preferable to automate this job and let the build process work for us, by automating the creation of those files and/or updating them when needed.
One such example involves developing parsers, which may be employed in everyday uses such as importing data from configuration files or parsing messages from a communication protocol. If a software project adopts any automatic code generator to develop a lexer and/or parser other than flex and bison then the project files will require some tweaking in order to both automate the source code generation and to add the files generated by foreign tools as build dependencies.
To illustrate this need, let's consider a small parser developed in C++ whose lexer is generated by re2c. In this case, in order to get the build process up and running, we must must first generate valid C++ code from re2c's regular expressions. Considering that a project's re2c source file is located at ./src/lexer.c++.re2c, we can generate the source file at ./src/lexer.c++ as follows:
- re2c -o ./src/lexer.c++ ./src/lexer.c++.re2c
- TO BE CONTINUED