Hi, for a project of mine I need support for java .class files, and as I'd like to do this the right way I've thought I might as well try to hack automake's Java support.
What do you think about something like this: ----- Makefile.am ----- data_JARS = foo.jar foo_jar_JAVA = Foo.java data_JAVA = Bar.java should create foo.jar (containing Foo.class) and Bar.class and put them in $datadir. This is IMO compatible with current behaviour. This should lead to ----- Makefile.in ----- %.jstamp: %.java $(RM) $@ mkdir -p .java/$*.java cd .java/$* && $(GCJ) -C `evil VPATH script here` $(JV_SCAN) --list-class `evil VPATH script here` >$@ foo.jar: Foo.jstamp mkdir -p .java/$@ cd .java && for i in `$^`; do \ srcdir=`echo $i | sed -e 's/jstamp$/java'` \ for j in `cat $i`; do \ package=`echo $j | sed -e 's@\.@/@g' -e 's@[^/]*$@@'` srcfile=`echo $j | sed -e 's/.*\.//g'`.class \ mkdir -p $@/$package cp $srcdir/$srcfile $@/$package \ done \ done cd .java/$@ && $(JAR) -cf ../../$@ * Alternatively, if we're using Sun javac instead of gcj, the first rule should look like %.jstamp: %.java $(RM) $@ mkdir -p .java/$*.java $(JAVAC) -d .java/$*.java `evil VPATH script here` cd .java/$*.java && find . -type f -name \*.class | sed -e 's@/@.@g' -e 's/^\.*//' >$@ This is just a idea how things could work. Of course, the "evil VPATH script" needs to be included, a few GNUism removed from the Makefile.in ($* being the most prominent), install and clean rules written etc. Questions, comments? Should I make things work like this and submit a patch? Simon -- GPG Fingerprint: 040E B5F7 84F1 4FBC CEAD ADC6 18A0 CC8D 5706 A4B4
msg06513/pgp00000.pgp
Description: PGP signature