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.
Hello Darek Snell,
Thank You so much for your time.
I will try this on tomorrow.
But i want to ask you something,
i was compiling application JN-AN-1162 i have added SDK of 4168 in this having all header files.
i have added header files in code as well as in include box(by right click on project directory).
while i was compiling single file like "uart.c", but it was showing error of another file that " you haven't include jendefs.h file. i remove that another example which was giving error of jendefs.h is not present (i removed because that example was not necessary at that time).
after that example and again compile uart.c still it went to another example and saying jendefs.h is not present like wise i delete all another example except uart.c and header files which are required.
i try to compile but again it goes to header file like "AppHardwareApi.h" and showing error in that header file that not having "jendefs.h" is not present.
now i can't remove 'AppHardwareApi.h" because its required in uart.c code.
i don't understand why this is happened.
is all because of HAController.exe error or something i was not doing in proper way.
(Sorry for bad English)
I hope you understand what i wanted to say.
Thank You again for your time.
If you have compiler errors that say jendefs.h cannot be found, then there must still be a source file in the workspace that is including that file. First, I would close all other projects in your workspace, so you don't have errors from those projects showing up. In the Project Explorer view, right-click each project and select Close, so you only have this project open. If that doesn't eliminate that error, then there is still a source file in this project including that file. You can search the files in the workspace to find where the include is. Use Ctrl+H to open the search tool. Click the "File Search" tab, and search for jendefs.h.
Or better yet, fix the project includes so the compiler can find that header file. Find the directory in the file system that includes jendefs.h. Then add that path to the Project properties, under the C compiler includes.
i read your paragraph. i understand little bit. can you explain how to link the project.
Because i am stuck at same point. now i have only one error is mention below
"make: *** No rule to make target `HAControlDongle.exe', needed by `all'. Stop"
i am trying to link resource but its not working.
please give me proper direction.
i have attached screen-shot. please check it out.
or else if i am wrong please reply me.
waiting for your reply.
From the error message, it appears the project is trying to include the file HAControlDongle.exe in the project build. Since HAControlDongle.exe is not a source file, it probably needs to be excluded from the build. You can find the file HAControlDongle.exe in the Project Explorer view, right-click on the file, and click Properties. Select the "C/C++ Build" menu on the left, and then check the box "Exclude resource from build". That should prevent the toolchain from including that file in the build.
From your screenshot, it appears you have excluded uart.c from your build. That means the compiler won't build uart.c, which I believe is not what you want. Earlier, I was suggesting you exclude HAControlDongle.exe from the build to get around the error you reported.
Thank You for your time.
Now my code is compiling and creating binary files.
as error are showing still in project window, but i am ignoring them.
am i going on same path?"
i just wanted to be sure.
i have taken screenshot and trying to build DEVICEREMOTE.c File.
As automatically included header files.
AWESOME Article... I knew the linked resources weren't found properly.
My setup: OSX
I actually had two issues...
1. When the SDK was installed in /Library/Freescale/KSDK_1.2.0, the files were installed with the wrong permissions. Many of the files I had no right to view. That caused me all sorts of issues, so I selected the "copy projects into workspace".
2. Once I got the rights solved, I didn't uncheck the copy project into workspace. I could see the files weren't correct, but I didn't know why.
Your article was a life saver! Especially for a Friday NIGHT! :smileyhappy: . Bring on the beer!!
I tried creating a project in KSDK-Project-Generator 2.1 and when I copy paste the code as per
Now the error I am getting is
make: *** No rule to make target '../../../../../../lib/ksdk_platform_lib/kds/K82F25615/debug/libksdk_platform.a', needed by 'myPOV_MK82FN256VLL15.elf'.
make: Target 'all' not remade because of errors.
Also when I imported the project in KDS after creating in KSDK-Project-Generator 2.1 the import option does not let me apply check mark to the box
ksdk_platform_lib_K82F2515(.project file within this project is read-only)
is that how it is supposed to be?