0

I thought about playing around with m4's extra macro processing features (over the regular cpp preprocessor) by merely, simply including it in the invoked chain of tools during the GCC compilation (rather right before cpp, so looks like as the first invoked command), however I don't know how to do it, i.e.: how to make m4 invoked as the (apparently) first stage of C gcc compilation of each of the input .c files. Is there some elegant method of achieving this?

Update: Apparently, the question might be more about build tools like autotools and CMake. I would be more interested in autotools.

3
  • 3
    Don't do this in GCC, do it in your Makefile. Commented Oct 7, 2021 at 19:28
  • @Barmar: You might be right. I've updated the question. Commented Oct 7, 2021 at 19:37
  • I would be more interested in autotools Just add it to makefile.am, literally file.c: file.c.m4 m4 $< > $@ , make will pick it up. As for cmake, just add_custom_command it, I did some more work with GNU m4 and CMake to track m4_include(dependencies) from m4 and automatically recompile if dependencies changes, but I doubt the library is "user ready". Commented Nov 16, 2021 at 10:13

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.