Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Eclipse CDT makefile to clean file before compiling

I'm using Eclipse + CDT for a project. I'm using the "generate Makefiles automatically" option from my build settings. I have in one file the date and some values that must be actualized every time the project is compiled. But since I don't change every time this file the compiler doesn't refresh it. Is there any option so I can have a Phony target?

if I could just add some lines to the makefile will work rm -f *.o target but this will be removed the next time I update my project.

I found that in the settings >> c/c++ build >> behaviour there is an opportunity to write some clean variables. Could this help? I tried to write the file name but this does not work.

like image 870
dispatcher Avatar asked Sep 12 '12 15:09

dispatcher


2 Answers

You can give CDT a pre-build command. For me (3.6.2 on Linux):

  • ProjectProperties
  • C/C++ Build category
  • Settings sub-category
  • Build Steps tab
  • Pre-build steps pane
  • Enter a command to delete the object file in question (rm f.o, or somesuch)
like image 58
bobbogo Avatar answered Nov 03 '22 01:11

bobbogo


You can user make clean on Pre-build steps

like image 2
user2875980 Avatar answered Nov 03 '22 01:11

user2875980