Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: How to develop without an IDE? Date: Mon, 23 Apr 2012 21:11:45 +0200 Lines: 109 Message-ID: <9vlns0Fv8cU1@mid.individual.net> References: <4f94338d$0$295$14726298@news.sunsite.dk> <4f94765c$0$284$14726298@news.sunsite.dk> <4f949830$0$295$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 9e0YtBrbGWfMllF8LHnPLw1EN+/3QOzUVowS5HSlxtp0yi7kc= Cancel-Lock: sha1:5Ug1zRkYKL/0g9NOHVDdJLwLmXY= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:13823 On 23.04.2012 06:57, Nasser M. Abbasi wrote: > On 4/22/2012 10:28 PM, BGB wrote: > >>>> >>>> it does technically work though, and may make some sense, say, if >>>> one is >>>> also building a bunch of C code (say, as part of a JNI wrapper for >>>> native code or similar), or is generally part of a larger project for >>>> which make is already used. >>> >>> I would rather call ant from make or make from ant to handle those >>> situations. >>> >> >> yes, this works as well. >> >> I guess it is probably whichever is more convenient. > > I found that using one good tool for everything is better than > mixing things. Which, if followed religiously, will lead you into a situation where it can get really awkward to do things with tool A which would be extremely easy with tool B. > Also, gnumake can do so many more things than just build source > code. I use it to update my html files and pdf files from > Latex sources, and other such things. No wonder because make doesn't do *any* of these things. Make evaluates timestamps along dependencies (mostly between files) and invokes other programs that do all the work. GNU make additionally has an extremely large database of predefined rules, has functions and other capabilities. > As long as the idea that drives the tool is: Perform this action > to update these prerequisites that this target depends on, then better > to use one tool that does this better and for many other things, not > just .java files. Interestingly GNU make's large built in rule database does not contain anything related to compiling Java. How do you create your Makefiles in a way as to invoke javac only for those files which have changed - especially in light of the fact that one Java source file might create multiple .class files? > In my tree, I have .f, .f90, .c, .c++, .java, .tex, and many > other files that I want to 'update' in my tree. > > Using one tool for all, is better, because one becomes better > at using this one tool, and things are integrated better. > gnumake+bash is pretty much all what I need. I'm with Leif: if you drink your own cool aid you should be throwing out all those languages and resort to language [ ] only. > I tried ant, and found that I am doing the same thing I > am already doing in my Makefile, just had to use different > syntax. (I also did not like XML syntax). Also looked at Ruby > script, and few other things. They all pretty much try to do > what Make allready does but using different syntax. I disagree: ant is very different from make. Ant has built in tasks and knows itself how to accomplish them. You can even teach it more tasks via its extension interface. ant rules for building Java projects are almost certainly a lot simpler than the same for make - as that example proves. > It is very easy to use gnumake to build Java and make jar files and > all. Here is a link showing Makefile for Java from the best book > on gnumake "Managing Projects with GNU make" by Robert Mecklenburg > > http://www.makelinux.net/make3/make3-CHP-9#make3-CHP-9 I did not see the advertized Makefile example but found this gem (quoting from that page): "Code declared to be within the a.b.c package would be compiled to class files in the a/b/c directory. This means that make's normal algorithm for associating a binary file with its source fails." Or did you mean this link? http://www.makelinux.net/make3/make3-CHP-9-SECT-2 I am counting 200+ lines in this Makefile. It inefficiently invokes javac on all Java sources and defines functions for things that ant can do out of the box. As a consequence you have to search in different locations to find out which packages go into which jar file. The same is probably 15% of the lines as an ant file. Sorry, but that example is no advertisement for using make to build Java projects. > Chapter 9 is all about using make for build Java. > > As others said. If you are using an IDE with its own build > system. It is better to have your own makefile to build > your tree, independent of what the IDE has. This way, if > you changed IDE, or move your tree somewhere else where > this IDE is not available, you can still build your tree > any where. Modern IDE's usually have integration with ant and / or maven and will happily generate appropriate build files. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/