javaweb-people
[Top][All Lists]
Advanced

[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 01:33:01 +0000

Nic Ferrier <address@hidden> writes:

> If something could be done about the second option then make would 
> be a good solution for java because you could do this: 
>  
>  
>   compile: $(CLASSLIST) 
>         javac -d $(CLASSDEST) @at-filelist  
>  
>   $(CLASSDEST)/%.class: $(SOURCEDIR)/%.java 
>         echo > at-filelist ; 
>         $(foreach var,%@,echo $(var) > at-filelist) 
>  
> I've been thinking whether there is a way to write a small java tool 
> to frig this... but I don't think so. The frustrating thing is that 
> make could do this quite efficiently if it wanted to. 


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



Nic



reply via email to

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