user3559583
user3559583

Reputation: 33

Make file error make: *** No rule to make target `.class', needed by `run'. Stop

I have a make file:

 JCC = javac

 JAVA = java

 RM = rm

 default:   A.class B.class C.class D.class E.class


  A.class: A.java
  $(JCC) A.java

  B.class: B.java
   $(JCC) B.java

  C.class: C.java
  $(JCC) C.java

  D.class: D.java
   $(JCC) D.java

  E.class: E.java
  $(JCC) E.java

  run: $(E).class
  $(JVM)    $(E)

 clean: 
 $(RM) *.class 

when I try to run the the file I am getting as: *** No rule to make target .class', needed byrun'. Stop.

I am new to this makefile.Can someone please tell me What I am doing wrong here??

E is the main class to run.

Upvotes: 0

Views: 1785

Answers (1)

Sagar Sakre
Sagar Sakre

Reputation: 2426

E isnt a variable. Thats why for run target its trying to fetch .class dependency.

Change

run: $(E).class
  $(JVM)    $(E)

to

run: E.class
  $(JVM)  <I dont know what you should put here, but its definitely not $(E)>

Upvotes: 0

Related Questions