For a homework assignment I have to make a makefile (physically and in software) for a series of .java files that I have written.
I have written up a make file:
JFLAGS = -d -g bin/
JC = javac
.SUFFXES: .java .class
CLASSES = \
cdn\communications\CommandReader.java \
cdn\communications\CommandReaderFactory.java \
cdn\communications\CommandReaderThread.java \
cdn\communications\DiscoveryCommandReader.java \
cdn\communications\Link.java \
cdn\communications\RefreshThread.java \
cdn\communications\RouterCommandReader.java \
cdn\node\Discovery.java \
cdn\node\Node.java \
cdn\node\Router.java \
cdn\utility\Utility.java \
cdn\wireformats\DeRegisterRequest.java \
cdn\wireformats\DeRegisterResponse.java \
cdn\wireformats\LinkInfo.java \
cdn\wireformats\LinkWeightUpdate.java \
cdn\wireformats\MessageType.java \
cdn\wireformats\PeerRouterList.java \
cdn\wireformats\RegisterRequest.java \
cdn\wireformats\RegisterResponse.java \
cdn\wireformats\RouterInfo.java \
cdn\wireformats\WireFormatFactory.java \
all : $(CLASSES)
clean : $(CLASSES:.java=.class)
But when I run it I get the message “make: Nothing to be done for `all’.” and none of my files are made.
Is there something I’m missing here? I’m running the file from the directory that holds the “cdn” directory hierarchy?
Any thoughts would be appreciated.
Fix your
alltarget to depend on .class files instead of .java files (that are already exist and thus ” Nothing to be done”).Also, you have to a add a rule to compile .java files into .class files:
In case of using the rule above (so-called pattern rule),
.SUFFXES:isn’t needed anymore, you can remove it at all.