Community
Participate
Working Groups
The generated makefile has .SECONDARY: with no dependants. This means: .SECONDARY with no prerequisites causes all targets to be treated as secondary (i.e., no target is removed because it is considered intermediate). -- https://www.gnu.org/software/make/manual/html_node/Special-Targets.html A target being secondary means: When a file is secondary, make will not create the file merely because it does not already exist, but make does not automatically delete the file. -- https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html#Chained-Rules So you can have this situation: Create a project with: file.c which include header.h Build the project. Delete header.h and build again. In this case, depending on how you do the delete/build make will report: make: Nothing to be done for 'all'. Delete the file outside of Eclipse (command line) and run the build in Eclipse. This causes the build to be run before the delta of the removed file is processed. If you delete in Eclipse the delta is seen by Eclipse CDT, then BuildDescriptionManager.cleanGeneratedRebuildResources(IBuildDescription) will remove the intermediary files and that forces the rebuild. I don't know if BuildDescriptionManager.cleanGeneratedRebuildResources was created to workaround the .SECONDARY that had long preceded it, or not. I do know that the .SECONDARY is unintentionally used with no dependants because of how it is used with pre and post build (from GnuMakefileGenerator): buffer.append(".SECONDARY:"); //$NON-NLS-1$ if (prebuildStep.length() > 0) { buffer.append(WHITESPACE).append(MAINBUILD).append(WHITESPACE).append(PREBUILD); } if (postbuildStep.length() > 0) { buffer.append(WHITESPACE).append(POSTBUILD); } Now it could be when the above code was written (2003 or so) that Make 2.78 or earlier was being used for dev. 2.79, released in the early 2000s added the ".SECONDARY with no prerequisites causes all targets to be treated as secondary".
I am going to resolve this problem by removing this incorrect use of .SECONDARY. If a user has depended on this behaviour, they can add ".SECONDARY:" to their makefile.targets in the root of their project.
New Gerrit change created: https://git.eclipse.org/r/97335
Gerrit change https://git.eclipse.org/r/97335 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=7f8440b6b2e059a0acc973a90ae7ac08d7fd6865
In the unlikely event that a project was depending on such behaviour the behaviour can be restored by creating a "makefile.targets" in the root of the project with: .SECONDARY: as the contents.
*** Bug 400903 has been marked as a duplicate of this bug. ***