Java Forum / General / December 2005
Java Makefile
eli.hen@gmail.com - 15 Dec 2005 14:58 GMT Hi,
Makefile file is: --------------------
JAVAC=javac CLASSPATH=./src:./ext:./ext/jdom.jar JAVACFLAGS= SRCPATH=./src CLSPATH=./classes
.SUFFIXES: .java .class .java.class: $(JAVAC) -classpath $(CLASSPATH) -d $(CLSPATH) $(JAVACFLAGS) $(<:%=$(SRCPATH)/%)
all: Cls1.class Cls2.class
The output of "make all" is: make: *** No rule to make target `Cls1.class'. Stop.
[make version: 3.72.1 by Richard Stallman and Roland McGrath]
What's wrong? How can it be fixed?
-thanks, Eli
Malte - 15 Dec 2005 16:21 GMT > Hi, > [quoted text clipped - 22 lines] > > -thanks, Eli .java.class: perhaps?
A good fix for make is to use ant :-)
Thomas Weidenfeller - 15 Dec 2005 16:23 GMT > What's wrong? How can it be fixed? The rule interference fails, because make can't find the needed input for building a .class file. So it correctly reports that it doesn't know how to build Cls1.class. It can't find the needed input, because you have hidden it in another directory.
It is a bad idea to run a makefile from a directory which does not contain the source. You would have to mess with the ugly VPATH feature (VPATH can really surprise you if you happen to have files with the same name in different directories, e.g. an accidental older copy of some source).
It would be best if you place the makefile in the same directory as the source which you want to compile.
/Thomas
 Signature The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Roedy Green - 16 Dec 2005 03:54 GMT >Makefile file is: most people use Ant instead of Make. It will work many times faster and will be multiplatform. The syntax sucks 100 day old hen eggs, (XML based), but it works.
see http://mindprod.com/jgloss/ant.html
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Dimitri Maziuk - 16 Dec 2005 17:08 GMT Roedy Green sez:
>>Makefile file is: > > most people use Ant instead of Make. It will work many times faster > and will be multiplatform. The syntax sucks 100 day old hen eggs, (XML > based), but it works. More specifically, Java doesn't have a separate link stage, so ".java.class" Makefile rule only works for stand-alone classes. Usually you need something like javac /some/path/*.java and the only way to tell make that target depends on all java files in /some/path is to list them all in the Makefile. And that won't do incremental compiles.
In ant this logic is built in, making it a better Java build tool in spite of "declarative" (read: the only way to make a procedural rule like .c.o is is to code it in Java as an ant task) XML.
Dima
 Signature ...the mainstream products of major vendors largely ignore these demonstrated technologies... [Instead, their customers] are left with several ineffective solutions collected under marketing titles like "defense in depth". -- Thirty Years Later: Lessons from the Multics Security Evaluation
slippymississippi@yahoo.com - 16 Dec 2005 04:24 GMT Ant is a platform-independent java-centric make tool based on xml. It's fairly useful. But if you really want a powerful make tool, go with Maven 2.0.
To answer your question, though... somewhere in that make file you need a rule for building Cls1.class and Cls2.class. Generally, all: just tells you which targets to build. There are no Cls1.class: and Cls2.class targets.
I don't know enough about make to tell you, but it looks like whoever gave you this wants you to figure out what the heck the fancy macro $(<:%=$(SRCPATH)/%) does.
Thomas Weidenfeller - 16 Dec 2005 08:08 GMT > Ant is a platform-independent java-centric make tool based on xml. a) it is not a make tool. It is an ill conceived scripting thingy.
b) The usage of xml is a design blunder beyond believe.
/Thomas
 Signature The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Roedy Green - 16 Dec 2005 09:55 GMT On Fri, 16 Dec 2005 09:08:52 +0100, Thomas Weidenfeller <nobody@ericsson.invalid> wrote, quoted or indirectly quoted someone who said :
>b) The usage of xml is a design blunder beyond believe. I tease the ANTish use of XML in the Java glossary http://mindprod.com/jgloss/ant.html this way:
Conditional execution is extremely clumsy in ant. Imagine in Java that instead of writing this:
// conditional increment in Java if ( file.exists() ) i++;
You had to write:
// How ant thinks about conditionals. // This is how Ant would write java if ant could // write java programs. boolean doesFileExist = file.exist(); call maybeIncrement(); //.. void maybeIncrement() { if ( ! doesFileExist ) return; i++; }
Then you have some idea of the verbosity of ant conditionals. Obviously, ant conditionals are not written in Java, but they have that same degree of awkwardness. This comes from trying to do everything in pure XML syntax. In ant you have to create a named step called a target that contains the commands you may or may not want to execute. Then you apply the keyword if and property name to the target. You have to elsewhere in the program set the property to true or false depending on whether you want the step executed. Then you have to do an <antcall to the step to attempt to execute it! All this, because the ant people have a love affair with XML! It is major production to conditionally copy a file that may or may not exist.
<!-- conditional file copy in ANT -->
<!-- copy pad.xml from website to project dir, if it exists --> <available property="has.pad.xml" file="${pad.dir}/${ant.project.name}.xml" />
<antcall target="copy.pad.xml" />
<!-- copy pad.xml from website to project dir, if there is one. --> <target name="copy.pad.xml" if="has.pad.xml"> <copy file="${pad.dir}/${ant.project.name}.xml" todir="${package.dir}" failonerror="false" overwrite="true" /> </target>
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
castillo.bryan@gmail.com - 22 Dec 2005 05:49 GMT >Then you have some idea of the verbosity of ant conditionals. >Obviously, ant conditionals are not written in Java, but they have [quoted text clipped - 7 lines] >because the ant people have a love affair with XML! It is major >production to conditionally copy a file that may or may not exist. Do you think the clumsiness is because of XML or the way they structured the XML? Why not have an if tag that has tasks contained within the if tag? This makes more sense to me visually.
<target name="copy.pad.xml"> <if-exists file="${pad.dir}/${ant.project.name}.xml"> <copy file="${pad.dir}/${ant.project.name}.xml" todir="${package.dir}" failonerror="false" overwrite="true" /> </if-exists> </target>
Ant has support for container tags, I wonder why there aren't conditional container tags? Or do I just not know about them?
Jean-Francois Briere - 22 Dec 2005 20:37 GMT > Or do I just not know about them? You don't know about them. But don't be hard on yourself. All those "experts" that have posted in this thread and have whined about Ant seem not to know either. It is called Ant-contrib. Here is the link of its main page: http://ant-contrib.sourceforge.net/ And here is the link of its Ant tasks: http://ant-contrib.sourceforge.net/tasks/tasks/index.html
Regards
root - 24 Dec 2005 19:49 GMT >> Or do I just not know about them? > [quoted text clipped - 5 lines] > And here is the link of its Ant tasks: > http://ant-contrib.sourceforge.net/tasks/tasks/index.html Uh-huh. And if you're developing open source, hopefully you don't forget to put "you'll need ant-contrib tasks. And ant-junit task. And ant-jflex task. And a bunch of ant-netbeans jars. Just to compile this thing" on your download page.
Dima
Jean-Francois Briere - 27 Dec 2005 18:50 GMT >>> Or do I just not know about them? >>> [quoted text clipped - 5 lines] >> And here is the link of its Ant tasks: >> http://ant-contrib.sourceforge.net/tasks/tasks/index.html
> Uh-huh. And if you're developing open source, hopefully you don't forget to > put "you'll need ant-contrib tasks. And ant-junit task. And ant-jflex task. > And a bunch of ant-netbeans jars. Just to compile this thing" on your > download page. > > Dima Huh? Most people don't have to compile the ant-contrib tasks library. That's the entire point of using lthird party ibraries :-)
Jean-Francois
slippymississippi@yahoo.com - 16 Dec 2005 15:26 GMT > a) it is not a make tool. It is an ill conceived scripting thingy. Ant is clunky, but it led to the creation of Maven 2.0, which is a thing of pure beauty.
Michael Redlich - 20 Dec 2005 17:41 GMT > a) it is not a make tool. It is an ill conceived scripting thingy. > > b) The usage of xml is a design blunder beyond believe. Hmmm...this is an interesting response coming from the author of XMLtp...
For those of you not familiar with XMLtp, check out http://mitglied.lycos.de/xmltp/.
Mike.
Thomas Weidenfeller - 21 Dec 2005 07:58 GMT Oh, did I forgot to plonk you in this group? I'll change that in a second.
>>a) it is not a make tool. It is an ill conceived scripting thingy. >> >>b) The usage of xml is a design blunder beyond believe. > > Hmmm...this is an interesting response coming from the author of > XMLtp... Nop. It just means that I have an informed opinion about the usage of XML in ant. And that opinion is that the XML usage in ant is a design blunder beyond believe.
> For those of you not familiar with XMLtp, check out > http://mitglied.lycos.de/xmltp/. Thanks for advertising my software, it has been discussed here a few times in the past. However, these days I recommend that people use Java's build in XML API if they are in need to handle XML. XMLtp is less powerful and limited and originated from the times when Java SE didn't come with XML support.
/Thomas
 Signature The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Michael Redlich - 21 Dec 2005 13:54 GMT > Oh, did I forgot to plonk you in this group? I'll change that in a second. Mach was sie wollen...
> >>a) it is not a make tool. It is an ill conceived scripting thingy. > >> [quoted text clipped - 6 lines] > XML in ant. And that opinion is that the XML usage in ant is a design > blunder beyond believe. OK, so far I've heard you say *three* times that the XML usage in Ant is a design blunder beyond belief. The only thing I haven't heard is your explanation for *why* it is flawed.
> > For those of you not familiar with XMLtp, check out > > http://mitglied.lycos.de/xmltp/. [quoted text clipped - 4 lines] > powerful and limited and originated from the times when Java SE didn't > come with XML support. No problem. I downloaded your software despite the fact that you explicity stated that it was developed before the Java API had support for XML. I was curious to see how you implemented an XML parser, and I was especially impressed with the GUI demo application. As-a-matter-of-fact, it parsed an Ant build.xml file quite nicely.
:-0 I am actually planning to demo your software at an upcoming ACGNJ Java Users Group. I usually make most of the presentations, but a presentation from the author would be more effective, don't you think? Whaddya say, Thomas? Why not take some vacation time to visit scenic New Jersey sometime next year? Heck, I'll even take some time off to show you around New York City as well.
Sind sie von Deutchland? Ich bin auch Deutch (ya know, redlich, an old German term meaning integrity). My parents were born in Germany...
Tchuss..
Mike.
Roedy Green - 21 Dec 2005 15:24 GMT >OK, so far I've heard you say *three* times that the XML usage in Ant >is a design blunder beyond belief. The only thing I haven't heard is >your explanation for *why* it is flawed. See http://mindprod.com/jgloss/ant.html
Where I show some examples of the circumlocutions you need with XML that would take only a line of code in any sane language. .
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Alan Krueger - 21 Dec 2005 16:09 GMT > Sind sie von Deutchland? Ich bin auch Deutch (ya know, redlich, an old "Deutschland" and "Deutsch"
> German term meaning integrity). My parents were born in Germany... > > Tchuss.. "Tschüss"
According to custom, any spelling/grammer critique is supposed to have an error of its own, so I've inserted at least one into this sentence.
Stefan Ram - 21 Dec 2005 16:26 GMT >"Tschüss" First, to add something to the subject of the thread: This topic (Ant-Makefile-Syntax) currently also is being discussed in de.comp.lang.java.
My personal reference the Duden (1973) only lists
"tschüs!".
(More recent instances of this book might have added a second "s" to the end)
The complete entry is:
*tschüs! /fr./ [auch: /tschüß/] (ugs.- - ·
fam. für: auf Wiedersehen!)
Where "[/tschüß/]" does not intend to give the spelling, but only an alternate pronunciation as being described by the Duden (1973):
[] Die e c k i g e n K l a m m e r n schließen Aussprachebezeichnungen (vgl. S. 13, VI), zusätzliche Trennungsangaben (z.B. Ecke [/Trenn/.: Ek|ke]), Zusätze zu Erklärungen in runden Klammern (vgl. S. 13, V) und beliebige Auslassungen (Buchstaben und Silben, wie z.B. in abschnitt[s]weise, Wißbegier[de]) ein.
(...)
Die (...) verwendete besondere L a u t s c h r i f t ergänzt das lateinische Alphabet:
(...)
ß ist das stimmlose (harte) s, z.B. Malice [...liß@]
(...)
Ein unter den Selbstlaut (Vokal) gesetzter P u n k t gibt betonte K ü r z e an, ein Strich betonte L ä n g e
(...)
The bibliographic data of that Duden are:
[resource:book/Duden Rechtschreibung 1973] = < :is-a = [book] :description:editor = [Dudenredaktion] :description:series = [Duden] :description:title = [Rechtschreibung] :description:publisher = [Bibliographisches Institut AG] :description:address = [Mannheim] :description:date = [1973] :description:volume = [1] :description:isbn = [3-411-00911-X] >
Michael Redlich - 21 Dec 2005 16:42 GMT > > Sind sie von Deutchland? Ich bin auch Deutch (ya know, redlich, an old > [quoted text clipped - 8 lines] > According to custom, any spelling/grammer critique is supposed to have > an error of its own, so I've inserted at least one into this sentence. Guten tag, Alan:
Oops. Thanks for pointing out my spelling errors. I *definitely* should have known better. I was, however, aware that "tschüss" had the umlaut, but I couldn't remember the keystroke sequence for 'ü' while I was typing this morning. Oh, and by-the-way, 'grammer' should be 'grammar'.
OK, it's time for mittag essen here in New Jersey (guten appetit).
I assume that you live in Germany? If so, where? My mom was born in a small town near Bad Kreuznach, called Pfaffen Schwabenheim. My dad was originally from Lauchhammer, near Dresden.
Tschüss...
Mike.
Alan Krueger - 22 Dec 2005 03:39 GMT [...]
>>According to custom, any spelling/grammer critique is supposed to have >>an error of its own, so I've inserted at least one into this sentence. [...]
> Oh, and by-the-way, 'grammer' should be 'grammar'. Indeed.
Luc The Perverse - 22 Dec 2005 04:22 GMT > [...] >>>According to custom, any spelling/grammer critique is supposed to have [quoted text clipped - 3 lines] > > Indeed. Not nearly as ironic as "speling"
-- LTP
:) Jean-Francois Briere - 21 Dec 2005 07:16 GMT Ant is one of the most widely used build tools in the Java universe. There are many reasons for it. Among other things, it solved many problems related to makefiles. So if you are not yet familiar with Ant, do yourself a favor and try it.
Regards
Thomas Weidenfeller - 21 Dec 2005 07:45 GMT > Ant is one of the most widely used build tools in the Java universe. Which doesn't change that fact that it is fundamentally flawed with its XML syntax.
/Thomas
 Signature The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|