Search code examples
windowseclipsemakefilejava-native-interfacejavah

Makefile error: make: *** No rule to make target `genesha.main.java.Jni.class', needed by `FileOperationsLibrary.h'. Stop." in Eclipse (Windows)


I have problem with my makefile. I'm working on Eclipse in Windows and my file structure is like below (project path: D:/workspace):

Genesha    
|
|___bin          
|     |_genesha                  
|             |_main
|                  |_java
|___src                  |__Jni.class
      |_genesha                  
              |_main
                   |_jni
                        |__makefile

When I in cmd from localization of makefile (D:\workspace\Genesha\src\genesha\main\jni) I used command:

javah -o FileOperationsLibrary.h -jni -classpath ../../../../bin genesha.main.java.Jni 

it works correctly. But when I used my makefile, I have following error:

make: *** No rule to make target `genesha.main.java.Jni.class', needed by `FileOperationsLibrary.h'.  Stop.

I was searching long time error and now I have not idea what's wrong here...

EDIT: my makefile

FileOperationsLibrary.h: genesha.main.java.Jni.class
    javah -o FileOperationsLibrary.h -jni -classpath ../../../../bin genesha.main.java.Jni

EDIT 2: Finally, thanks to MadScientist my make file code is:

FileOperationsLibrary.h: ../../../../bin/genesha/main/java/Jni.class
javah -o FileOperationsLibrary.h -jni -classpath ../../../../bin genesha.main.java.Jni

Thank you a lot for help :)


Solution

  • That error means that in your makefile somewhere you have a target FileOperationsLibrary.h that lists genesha.main.java.Jni.class as a prerequisite, something like:

    FileOperationsLibrary.h: genesha.main.java.Jni.class
    

    The file genesha.main.java.Jni.class does not exist, so make tries to find a way to build it. However there are no rules defined in the makefile that tell it how to build that file, so you get that error message.