xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Brunsmann <joerg.brunsm...@FernUni-Hagen.de>
Subject Re: Makefile's
Date Thu, 25 Nov 1999 19:37:50 GMT
James Duncan Davidson wrote:

> Compilers can work this stuff out for themselves. I've found the only
> check that saves any amount of time is just to compare a source file
> time against a class file time and if it's out of date, put it on the
> update list. 

And you don't even need to maintain a makefile for this. Just a script 
which I found some time ago:

# see documentation below




recurse() {
  for source in "$@"; do
    if [ -d $source ]; then
      recurse $source/*
      case $source in
        if [ $source -nt $class -o ! -e $class ]; then
          echo $source

cd $src
files=$(recurse *)

if [ -n "$files" ]; then
  echo $files
  $javac -d $classes "$@" $files


<<<<* MAJA, the shell script for MAking JAva *>>>>

Maja is a deceptively simple, but extremely useful script.  It
constructs a list of .java files that are newer than their
corrisponding .class files, and then calls javac once on the entire

Maja has a distinct advantage over make, which runs javac on each file
individually. Remember, a good portion of the time spent invoking
javac is simply to get a working java process up and running. Maja
incurrs that penalty only once, instead of possibly hundreds of times!

Also unlike make, there is no need to maintain a "make file": maja
simply keeps all .class files in the $MAJA_CLASS directory up to
date with the .java files in the $MAJA_SRC directory, including

Maja uses one more environment variable: $MAJA_JAVAC. If this 
is defined, it is used as the name of the compiler. The default
is javac.

All the command-line arguments to maja are passed on to the compiler.
for instance, use "maja -O" to optimize maja's output.

View raw message