help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Make enhansment patch - batching compiles


From: Jason Wessel
Subject: Re: GNU Make enhansment patch - batching compiles
Date: Thu, 3 May 2001 14:00:42 -0500

----- Original Message ----- 
From: "Eli Zaretskii" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>; <address@hidden>
Sent: Thursday, May 03, 2001 1:15 PM
Subject: Re: GNU Make enhansment patch - batching compiles


> 
> I thought about doing that from the rule which is normally used to
> compile .java into .class.  Something like this:
> 
>    %.class : %.java
> echo '$< \\' >> files_list
> 

Using an implicit rule is not really what I want to do, 
esplically in java where there is not a 1 to 1 relationship 
between .class and .java files.  Several class files can
be produced from a single java file.  Also the generated
.class files may have no relationship to the .java files.

I have a system which already builds these sorts of make files
here is an example:

.PHONY : BATCH1
.PHONY : all_classes
all: all_classes

build_classes = 1.class 2.class 3.class

#### Decide if we should batch the build if someone did "make all"
#### We have to be able to do a non batch build incase someone
#### wants to build a class file such as "make 1.class"
ifeq (${MAKECMDGOALS},all)
batch := 1
all_classes: $(build_classes) BATCH1
else
all_classes: $(build_classes)
endif

#### Here is a compile rule
compile_cmd = javac

#### Other dependancies
1.class: worker.java thinker.java
2.class: worker.java

#### Rules to build class files
####   For each rule there is a batch collector if we
####   are supposed to batch build files
1.class: big.java
ifeq (${batch},1)
        $(globalvar targlist1,${targlist1} $<)
else
        $(compile_cmd) $<
endif
2.class: big.java
ifeq (${batch},1)
        $(globalvar targlist1,${targlist1} $<)
else
        $(compile_cmd) $<
endif
3.class: 3.java
ifeq (${batch},1)
        $(globalvar targlist1,${targlist1} $<)
else
        $(compile_cmd) $<
endif

BATCH1:
        @if [ "${targlist1}" = "" ] ; then\
          "Targets up to date.";\
        else\
                echo ***building***: Batched $(sort ${targlist1});\
                echo $(compile_cmd) $(sort ${targlist1}); \
        fi






reply via email to

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