The error "No Rule to Make Target" is common when using build tools based on make, like Kinetis Design Studio (KDS), CodeWarrior 10, LPCXpresso, or S32 Design Studio. While the error is not descriptive, and not intuitive for how to fix it, it usually means the tool cannot find a needed file. This discussion covers the common reasons for this error, and how to resolve it.
The first step to resolve this error is to try cleaning and rebuilding the project. To clean the project in Eclipse, use the menu Project->Clean. Cleaning a project deletes all the object code generated from previous builds, and forces the build tool to completely rebuild the project. This can sometimes fix the "No Rule to Make Target" error when the object code references sources files in paths that are no longer valid. This can occur if the project is shared from a different computer with prebuilt object code, and the paths on the two computers are different. Cleaning the project doesn't fix all of these errors, but it will ensure the project is completely rebuilt using the directory structure on that computer.
If cleaning the project doesn't help, then the likely cause is an issue with a linked resource. These toolchains use the Eclipse open-source IDE, and Eclipse manages some files in a project as linked resources. With an Eclipse project, the project directory is the directory that includes the .project folder for Eclipse. For example, in KSDK v2.0 for the FRDM-K64F development board, the KDS Hello World example project directory is located at \KSDK_2.0.0\boards\frdmk64f\demo_apps\hello_world\kds
Any source files within this project directory, or any sub-directory, are local project files. Any source files outside this project directory that are used in the project are considered linked resources. Shown below are the source files for this example project. Because they are not in the project directory, they are included in the Eclipse project as linked resources.
Eclipse uses icons in the Project Explorer view to differentiate the linked resource files from the local project files. In the screenshot below, all the source files in the project have the arrow icon over the file icon, indicating these files are linked resources for this project.
Eclipse provides a summary of all the linked resources, which can be helpful when resolving errors with the paths to these linked resources. To see the summary, open the project properties by right-clicking the project, and select Properties. In the left menu tree, expand Resources and select the Linked Resources tab. Below are all the source files that are linked resources in this example project. The summary shows the path for each of these linked resources. In this example, the paths are all project-relative using the path variable PROJECT_LOC. Project-relative means the locations of these files in the file system is dependent on the project directory with the .project file. Some NXP/Freescale examples of projects with linked resources include MQX, Kinetis SDK, USB stack examples, and board sample code.
If the paths to these linked resources are not valid, the build tool will not be able to find these files when building the project, and the make tool will typically throw the error "No Rule to Make Target". In that case, these paths need to be fixed.
One common reason an Eclipse project has broken links to resources when imported is because of a setting in the Project Import panel. When existing projects are imported into the Eclipse workspace, and that project contains linked resources, then the box in the Import settings "Copy projects into workspace" should be left unchecked. Checking this box copies the project directory into the workspace directory, and imports the copied directory. If local project files are included in the project, they will be copied to the new project directory in the workspace. But for linked resource files, they are not copied with the new project. These linked resources remain in their original location. The links are frequently broken, because the project directory has changed location relative to the source files. Then, the tool cannot find the needed source files, and the error "No Rule to Make Target" occurs when attempting to build.
Just to show the problem, here is an example of importing the KSDK Hello World project with the box checked for "Copy projects into workspace". Now the project-relative paths of this project are no longer valid. The reason is the project directory is now located in the workspace directory, but the files that are linked resources haven't moved from their original location. So the project-relative paths need to change. Eclipse indicates linked resources with path errors by replacing the icon with a yellow exclamation mark. Any files shown like this in the Project Explorer will likely not be found by the build tool.
The project Linked Resources summary also lists all the linked resource files with invalid locations. The paths to these linked resources call all be edited here if needed to resolve the path issues.
Therefore, if an imported project gives errors "No rule to make target" and cleaning doesn't help, try deleting the project from the workspace, and re-import the project without the box checked for "Copy projects into workspace". If that doesn't resolve the issue, then review error messages and the Linked Resources to try and find what file(s) is missing.