help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble defining implicit rule


From: Jim Gallagher
Subject: Trouble defining implicit rule
Date: Mon, 4 Feb 2002 06:42:24 -0800

Hi,

I'm trying to write an implicit rule for building .class files from .java 
files.

After reading the documentation, I thought my Makefile should look like this:

JAVA_ROOT = /u01/jdk1.2.2 
JAVAC = $(JAVA_ROOT)/bin/javac 
JAVA_FLAGS = -g 
CLASS_PATH = .:$(JAVA_ROOT)/jre/lib/rt.jar:$(JAVA_ROOT)/jre/lib
TARGETS = AbstractCellEditor.class AbstractTreeTableModel.class \ 
FileSystemModel.class  JTreeTable.class MergeSort.class \ 
TreeTableExample0.class TreeTableModelAdapter.class TreeTableModel.class

all : $(TARGETS)

%.java : %.class 
        $(JAVAC) $(JAVA_FLAGS) -classpath $(CLASS_PATH) $<

but that didn't work:

address@hidden tree-table]$ make TreeTableExample0.class
make: *** No rule to make target `TreeTableExample0.class'.  Stop.

So, I replaced my implicit rule with a suffix rule:

.SUFFIXES: .java .class
.java.class: 
        $(JAVAC) $(JAVA_FLAGS) -classpath $(CLASS_PATH) $<

This worked. Any idea why the implicit rule did not work?

Make is version 3.79.1.

Thanks,

Jim Gallagher



reply via email to

[Prev in Thread] Current Thread [Next in Thread]