Abruzzo Forte e Gentile
Abruzzo Forte e Gentile

Reputation: 14869

"clean" rule not existing in Makefile, but make clean produces something anyway

I have a small issue with my build procedure on linux.

For whatever reason in my code if I issue a "make clean" Linux produces a file called "clean". The thing is that I don't have a "clean" section on the makefile of my project.

It looks like my make is picking up the wrong Makefile from somewhere and this might clash with the Makefile of my project.

Is there anyway to know which makefile is looked up?

Upvotes: 1

Views: 208

Answers (2)

unwind
unwind

Reputation: 399881

Two ideas:

  1. Use the --debug command line option to have the make program tell you more about what it's doing.
  2. Try adding a .PHONY declaration of the clean target.

Upvotes: 2

I suggest to use remake to debug your makefiles. Install it then run remake -x or even remake -x -d. (The remake utility is a nearly compatible variant of GNU make).

In your case, the lack of a phony clean target makes the make utility creating an empty file named clean.

Upvotes: 1

Related Questions