Simplify make rules for vsc files and remove duplication
We use an implicit rule to tell make how to turn vsc into c and manually define the vsc files in Makefile.am. The implicit rule tells automake to add .vsc to SUFFIXES, which in turn allows us to add the actual vscs to varnishd_SOURCES. To avoid triple configuration of the list of built VSC .c and .h files, we generate these in configure. AC_SUBSTing files into _SOURCES is forbidden by autoconf for a good reason: Adding sources to the build should remain an explicit process to avoid accidentally compiling in code just because someone had files with a magic name lying around. As the implicit .vsc -> .c rule does not allow for additional dependencies, we add in the dependency to vsctool using the auto-generated list of c files. BUILT_SOURCES is used to ensure that, for default make targets, headers generated from vscs are always present before the actual varnishd sources are being build, of which some depend on vsc headers. For subsequent builds, include dependency tracking takes over. The Makefile rules are deliberately simple to hopefully cover all make flavours available on the planet. Notice that, for example, if we limited ourselves to gmake, we could use much simpler substitution rules to generate VSC_GEN_C and _H instead of the de-tour via configure. Portability is also the reason for renaming all vsc files.
Showing
Please register or sign in to comment