🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3768

Makefile : %.class: %.java

#3768
From: * Tong *
Date: Sat, 02 Jun 2001 17:49
36 lines
2316 bytes
jik@kamens.brookline.ma.us (Jonathan Kamens) writes:

> ${CLASSFDIR}/%.class: %.java
>         javac -d ${CLASSFDIR} $<

Thanks.

> >PS. I tried 
> >${CLASSFDIR}/%.class: %.java
> >
> >and it didn't seem to work. Can't remember why tho.
> 
> Well, we certainly can't figure it out either, if that's all the
> information you provide....

Oh, at last I recalled why it failed. It has nothing to do with the
OP though. It is really a java issue -- The above will not work if
the java program belongs to a package. The generated .class file
will not be under ${CLASSFDIR} but somewhere beneath it, causing the
make always recompile. 

Here is an example of explicit rule:

${CLASSFDIR}/knn/DbKnn.class: knn/DbKnn.java
        javac -d ${CLASSFDIR} knn/DbKnn.java

${CLASSFDIR}/knn/Knn.class: knn/Knn.java
        javac -d ${CLASSFDIR} knn/Knn.java

Any idea that can make 'make' work this way? 

-- 
Tong (remove underscore(s) to reply)
  *niX Power Tools Project: http://xpt.sourceforge.net/
  http://members.xoom.com/suntong001/
  - All free contribution & collection
Technical Details
Message-ID: <sa8snhiepqq.fsf_-_@sun_tong_001.personal.yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!acadiau.ca!acadiau.ca!not-for-mail
References: <3B03B870.2168B36C@bigfoot.com> <p5lmnwukdf.fsf@lemming.engeast.baynetworks.com> <p5bsosui8e.fsf@lemming.engeast.baynetworks.com> <sa8vgmls6pf.fsf@sun_tong_001.personal.yahoo.com> <9f4aia$bda$1@jik.kamens.brookline.ma.us>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109f73,4f4561c76a5fff83
X-Google-Attributes: gid109f73,public
X-Google-Thread: fc89c,4f4561c76a5fff83
X-Google-Attributes: gidfc89c,public
X-Google-ArrivalTime: 2001-06-02 10:49:45 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!acadiau.ca!acadiau.ca!not-for-mail
From: * Tong * <sun_tong_001@yahoo.com>
Newsgroups: comp.unix.programmer,gnu.utils.help
Subject: Makefile : %.class: %.java
Date: 02 Jun 2001 14:49:33 -0300
Organization: personal.yahoo.com
Lines: 36
Message-ID: <sa8snhiepqq.fsf_-_@sun_tong_001.personal.yahoo.com>
References: <3B03B870.2168B36C@bigfoot.com> <p5lmnwukdf.fsf@lemming.engeast.baynetworks.com> <p5bsosui8e.fsf@lemming.engeast.baynetworks.com> <sa8vgmls6pf.fsf@sun_tong_001.personal.yahoo.com> <9f4aia$bda$1@jik.kamens.brookline.ma.us>
NNTP-Posting-Host: sunny.acadiau.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: poseidon.acadiau.ca 991504184 60445 131.162.161.46 (2 Jun 2001 17:49:44 GMT)
X-Complaints-To: marc.fournier@acadiau.ca
NNTP-Posting-Date: Sat, 2 Jun 2001 17:49:44 +0000 (UTC)
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7