autoconf, automake and friends

Olivier olivier@zipworld.com.au
Tue Feb 27 22:22:00 GMT 2001


This is not really a gcj question. 
I've tried to adapt your example to my 'Makefile.am' but it won't let
me use VPATH! actually, automake let me use it, I can see it in
'Makefile.in' but 'configure' insist on removing it from the final Makefile!

Is there a reason for that?

Olivier

PS: should I persevere with auto friends? It does not seem to
help much for java.


On Fri, Feb 23, 2001 at 12:12:55AM -0500, Jeff Sturm wrote:
> Here's a simple example I used recently to build the Xerces XML parser.
> It's not perfect, and it assumes one class per source file which is
> actually wrong for inner classes, but it was sufficient to build the
> parser (I used a similar makefile to build the samples):
> 
> 
> # Path to Xerces sources
> SRCDIR = ../src
> 
> # List of sources to compile
> SOURCES = \
> javax/xml/parsers/DocumentBuilder.java \
> javax/xml/parsers/DocumentBuilderFactory.java \
> javax/xml/parsers/FactoryConfigurationError.java \
> ...
> ...
> ...
> org/xml/sax/SAXParseException.java \
> org/xml/sax/XMLFilter.java \
> org/xml/sax/XMLReader.java
> 
> # Construct lists of classes, objects from SOURCES
> CLASSES = ${SOURCES:%.java=%.class}
> OBJECTS = ${SOURCES:%.java=%.o}
> 
> # ${prefix} used to install gcj
> GCCDIR = /opt/gcj
> GCJ = $(GCCDIR)/bin/gcj --classpath=.:$(SRCDIR):$(GCCDIR)/share/libgcj.jar
> GCJFLAGS = -g -fPIC
> JAVAC = $(GCJ) -C
> JAR = $(GCCDIR)/bin/fastjar
> 
> # Tell make where to look for sources
> VPATH = $(SRCDIR)
> 
> # Rule to build Java class from source
> %.class: %.java
> 	$(JAVAC) -d . $<
> 
> # Rule to build object from Java source
> %.o: %.java
> 	$(GCJ) -c $(GCJFLAGS) $< -o $@
> 
> # Default target: build class archive and shared library
> all: xerces.jar libxerces.so
> 
> xerces.jar: $(CLASSES)
> 	$(JAR) -cf $@ $(CLASSES)
> 
> libxerces.so: $(OBJECTS)
> 	$(GCJ) -shared $(OBJECTS) -o $@
> 

-- 
----------------------------------------------------------------------
Olivier Louchart-Fletcher
Email: olivier@zipworld.com.au



More information about the Java mailing list