Pregunta

I have a C project with many header files, but I do not want to deliver to the client one specific header file with bunch of defines. I want all other files to be preprocessed with just that specific header file, and I want to regenerate all sources to a new directory, so that client is able to compile this project's new source although he wouldn't have the mentioned header file.

Is there a Linux or Windows way to do this without manual search/replace in editor?

¿Fue útil?

Solución

I would use a macro processing tool such as m4, which is widely available (it's standard on most Linux and *nix distributions, as it's used by autoconf, sendmail, et al). Convert the special header to a bunch of m4 macros and then apply this to all the source files.

Note that there are plenty of other alternatives to m4, and scripting languages such as Perl could also be considered.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top