dispatcher
dispatcher

Reputation: 233

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.

Upvotes: 6

Views: 5854

Answers (3)

MIKE DANNHARDT
MIKE DANNHARDT

Reputation: 1

I added the following to the Pre-build steps and it seems to work great:

del ${CWD}\addtional_dir\file.o

Upvotes: 0

user2875980
user2875980

Reputation: 21

You can user make clean on Pre-build steps

Upvotes: 2

bobbogo
bobbogo

Reputation: 15483

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)

Upvotes: 8

Related Questions