[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Javaweb-people] build tools
From: |
Nic Ferrier |
Subject: |
Re: [Javaweb-people] build tools |
Date: |
07 Feb 2002 12:18:20 +0000 |
Brian Jones <address@hidden> writes:
> Nic Ferrier <address@hidden> writes:
>
> > After a bit more thought I have achieved what I was trying to do.
> >
> > For those interested here's the important bit of my makefile. I'm
> > basically using a "cat" of a prepared filelist to act as the list
> > variable that I was talking about.
> >
> >
> > # This rule builds the destination directory for compiles.
> > $(DESTINATION):
> > mkdir $@
> >
> > # This rule recreates the filelist.
> > # It has the nasty side effect of writing a blank line to the file
> > # but compilers don't seem to mind that.
> > init-filelist:
> > @echo > filelist
> >
> > # A variable to represent the list of all files.
> > DEPEND_LIST = $(shell cat filelist)
> >
> >
> > # The compilation targets.
> > .PHONY: compile compile-files debug init-filelist
> >
> > debug: init-filelist $(DEBUGCLASSES) debug-files
> > $(if $(DEPEND_LIST),$(call COMPILE,$(SOURCEDIR)))
> >
> > debug-files:
> > $(if $(DEPEND_LIST),$(call COMPILE,$(DESTINATION)))
> >
> > compile: $(DESTINATION) init-filelist $(DESTCLASSES) compile-files
> >
> > compile-files:
> > $(if $(DEPEND_LIST),$(call COMPILE,$(DESTINATION)))
> >
> >
> > # Automatically match a source file to it's dependant class file.
> > $(DESTINATION)/%.class: $(SOURCEDIR)/%.java
> > @echo $? >> filelist.mak
> >
> > $(SOURCEDIR)/%.class: $(SOURCEDIR)/%.java
> > @echo $? >> filelist.mak
> >
>
> Something seems to be missing. Is filelist.mak == filelist above in
> setting DEPEND_LIST? I've not used/seen the $(call COMPILE, $(VAR))
> notation before so I'm not sure about that. Where are you setting
> DESTCLASSES?
Yes... the extract was just an extract... also filelist.mak should be
filelist.
The $(call...) syntax if a function call. Variables can have
parameter references in them, eg:
COMPILE = $(JAVAC) $(JAVAC_OPTS) -d $(1) -classpath $(call MK-CLASSPATH,$(1))
@filelist
On a call to COMPILE you pass in the destination which is then
interpolated into the expansion of the variable, at the point where
$(1) says it should be.
The trouble with this is that it's a lot to add to a makefile. And it
still doesn't work in a make natural way.
For example, with the above, if you say this:
make source/somepackage/SomeClass.class
You'll just get a filelist created, it won't compile the source file
associated with the class.
The only way to fix it is via list pattern match targets. I doubt
whether they will be added to Make, even if they were, you then have
to rely on everybody using the new Make.
Nic