> Heh. Well, basic for Java, maybe. Not at all basic for any traditional > use of make. The people who designed the Java build environment > obviously had little knowledge of make, or else they just didn't care.
Tell me about it. ;-) > But, the short answer is Java and make simply don't work well together. > Something like this: > > JARFILES = foo.jar bar.jar baz.jar > > %.jar: > @$(RM) $@ > $(JAR) cf $@ $^ > > all: $(JARFILES) > > include $(JARFILES:.jar=.dep) > > %.dep: > find $* -name \*.java -print \ > | sed 's/\(.*\)\.java$$/$*.jar $*.dep: \1.class/' \ > > $@ > > I just wrote that off the top of my head so I'm not sure the quoting, > etc. is correct, but hopefully you get the idea. Thanks, Paul. Here's what I wound up doing, and it seems to work. Sort of the same idea as you had. A bit kludgy, and not very robust if make is aborted, leaving a .ja file lying around. On the other hand, don't have dependency files to deal with. [Please let me know if anyone has comments. I appreciated the feedback last week, and wanted to let you-all know what I came up with.] > # this is a way to have a jar file generated based > # on dependencies, as $@ and $* are not expanded if used in the dependency > # list, and static pattern rules cannot be implicit > # > # for a target x.jar , the dependencies list is generated for the subtree > # x , and make is recursively called to generate the target x.ja , from > # a set of files which may be a superset of the dependencies (because of > # the nature of java compilation) along with a specified set of other files, > # after which it is then renamed to x.jar > # > # note that JAR must be version 1.2+ for uf option > %.jar: > JAR_DEPENDENCIES="$(shell find $* -name '*.java' | sed 's/\.java$$/\.class/' >)" $(MAKE) $*.ja > > %.ja: $(JAR_DEPENDENCIES) > @$(RM) $@ $@r > $(JAR) cf $@ `find $* -name \*.class` > for i in $(JARSUFFIXES) .dummy.; do \ > if [ "x$$i" != "x.dummy." ]; then \ > f=`find $* -name \*.$$i`; \ > if [ "x$$f" != "x" ]; then \ > $(JAR) uf $@ $$f; \ > fi; \ > fi; \ > done > /bin/mv $@ $@r _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
