Closed vinipsmaker closed 3 years ago
Hi, that's a good idea. I thought something was missing about include files. :)
Here is an initial implementation: https://github.com/skvadrik/re2c/commit/3ba9108047f516a29e62493a04c00651acf02c9a, to be used as re2c file.re -o file.c --depfile file.d
. I'll add documentation and tests later. Let me know if it works for you. I opted out of -MMD
because that doesn't fall in line with re2c convention on short/long options, and I opted into passing an explicit depfile argument, as it is more generic. But it's not set in stone until the next release.
Here is an initial implementation
Wow that was quick. Thanks.
Let me know if it works for you.
It didn't. I also use the option -I
so the output is pointing to a non-existent file. Here's a sample output:
emilua.p/actor.cpp: ../src/actor.ypp emilua/modules.re
I used the flag -I ../include
so I expect the output will be in the likes of:
emilua.p/actor.cpp: ../src/actor.ypp ../include/emilua/modules.re
(given modules.re
was only found in the directory passed as a -I
arg)
I looked on one of the depfiles generated by the compiler in the same project and I think this change should be enough.
Thanks for checking, fixed in https://github.com/skvadrik/re2c/commit/a30aa9fabca3eb5939f78222b14ede3b3500466c.
fixed in a30aa9f
It's working now. Thank you.
Here's an example on how to use re2c depfiles on meson: https://gitlab.com/emilua/emilua/-/commit/37cccb233749f91fca65af8ab2965a35b2df6305#0cc1139e3347f573ae1feee5b73dbc8a8a21fcfa_40_41
You just need to specify some template string for the generator()
's depfile
argument and then reference '@DEPFILE@'
in re2c arguments.
Thanks for sharing the example!
Hi,
GCC has an option to generate depfiles using a Makefile-like syntax. For instance:
If you call
gcc -MMD foo.c
, it'll generate the following file:— eli-schwartz
I'm using meson to describe the build of my project and I have a few files to be processed through re2c. Some of the files use the
/*!include:re2c "my-re-defs.re" */
re2c's syntax and it'd be nice to have them automatically rebuilt when the included file changes. The build system can take care of this if re2c accepts an option to generate a second output (the depfile). Can we have an option to build a depfile alongside the main output?