Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I compile auto-generated C files in pre-build?

I have an Eclipse project that I need to auto-generate some files before compiling it. I do not want to put this auto-generated files in my repository, so each time I compile the projetct I perform a pre-build to auto-generate this files.

The problem is that this auto-generated files are *.c and *.h files, and in the first time I compile the project, the following happens (in this order):

  • pre-build: auto-generate some *.c and *.h
  • build: eclipse will not build this auto-generated files

If I compile again, this files will be compiled. Maybe this is happening because of the discovery process of what files eclipse will compile. Before initing compilation, we do not have this auto-generated *.c and *.h files.

In the second time we compile, we already have this auto-generated files, so this files are compiled.

like image 829
Eduardo Montenegro Avatar asked Jul 25 '11 17:07

Eduardo Montenegro


1 Answers

If you want full control over when exactly the custom build step takes place, which files need to be refreshed after it, the environment, the working directory etc.. do not specify it as a simple pre-build step. Go to the project properties -> Builders -> New... and choose "Program".

In the resulting dialog, you have much more control over the execution of your tool. For instance, you can make your tool run whenever the XML file is saved, and you can tell eclipse to refresh all the auto-generated files whenever it is run.

like image 161
enobayram Avatar answered Oct 22 '22 00:10

enobayram