[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javaweb-people] more compilation stuff

From: Nic Ferrier
Subject: [Javaweb-people] more compilation stuff
Date: 12 Apr 2002 01:18:14 +0100

I've been struggling with the number of projects I'm working on all
requiring java compilation.

I like to use the @filelist makefile system that I developed a while
ago - it's quick and easy and offers a certain amount of dependancy
tracking fairly cheaply.

The trouble is the maintenance of the makefiles is not easy because
they have differing requirements as to the jar files that need to be
built and how they need to be built.

I've just written the attached script which helps to automate the
java compilation bit of makefiles. The idea is that a jar file has a
number of dependancies:

- a set of source files
- a compilation directory where the source files become class files
- a manifest
- a classpath of jar files and class directories

with those 4 bits of information any jar file can be
constructed. This template system takes a similar approach to
automake by requiring the user to specify a target and the attached
variables, eg:

        sourcefiles=`find $sourcedir -name "*.java" -print`
        classpath=$(wildcard lib/*.jar)

As you can see, command substitution and Make functions can be
intermixed (command subst actually gets translated to Make's $(shell)

If the above was in a file called:


then you could generate a real Makefile by doing this:

  automakejar Makefile

The essential idea is the same as with automake (I'm pretty sure the
same thing could be achieved with automake, but I don't know enough
about automake to get that job done). I'll have to maintain all the
rest of my Makefile code, but that is generally pretty static.

I'm posting this here so that people can take a look at it and pick
holes if they want. It would be great if someone could suggest how I
might implement this with automake.


Description: auto java compile magic

reply via email to

[Prev in Thread] Current Thread [Next in Thread]