new target for contrib/Makefile

Поиск
Список
Период
Сортировка
Искать

new target for contrib/Makefile

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:

If you run make installcheck in contrib it stops on the first module 
that fails. This is mildly annoying from the point of view of the 
buildfarm script, which wants to run all the available regression tests. 
To solve that I implemented a new target that does run them all and only 
fails at the end if any have failed. The patch is attached for your 
delectation.

cheers

andrew


Index: contrib/Makefile
===================================================================
RCS file: /home/cvsmirror/pgsql-server/contrib/Makefile,v
retrieving revision 1.51
diff -c -w -r1.51 Makefile
*** contrib/Makefile	16 Sep 2004 21:20:19 -0000	1.51
--- contrib/Makefile	29 Sep 2004 14:30:03 -0000
***************
*** 61,63 ****
--- 61,69 ----
  	@for dir in $(WANTED_DIRS); do \
  		$(MAKE) -C $$dir $@ || exit; \
  	done
+ 
+ installcheck-all:
+ 	@CHECKERR=0; for dir in $(WANTED_DIRS); do \
+ 		$(MAKE) -C $$dir installcheck || CHECKERR=$$?; \
+ 	done; exit $$CHECKERR
+ 

Re: new target for contrib/Makefile

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andrew Dunstan  writes:
> If you run make installcheck in contrib it stops on the first module 
> that fails. This is mildly annoying from the point of view of the 
> buildfarm script, which wants to run all the available regression tests. 

Yeah.  ISTM that "make -k installcheck" should be the correct way to do
this, but I've never gotten around to figuring out how to make it work.

			regards, tom lane

Re: new target for contrib/Makefile

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


Tom Lane wrote:

>Andrew Dunstan  writes:
>  
>
>>If you run make installcheck in contrib it stops on the first module 
>>that fails. This is mildly annoying from the point of view of the 
>>buildfarm script, which wants to run all the available regression tests. 
>>    
>>
>
>Yeah.  ISTM that "make -k installcheck" should be the correct way to do
>this, but I've never gotten around to figuring out how to make it work.
>
>
>  
>

I can't see an obvious way, because of the need to loop through 
WANTED_DIRS.

But I am not a make expert (make has almost as many warts as sendmail ...)

cheers

andrew

Re: new target for contrib/Makefile

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andrew Dunstan  writes:
> Tom Lane wrote:
>> Andrew Dunstan  writes:
>>> If you run make installcheck in contrib it stops on the first module 
>>> that fails. This is mildly annoying from the point of view of the 
>>> buildfarm script, which wants to run all the available regression tests. 
>> 
>> Yeah.  ISTM that "make -k installcheck" should be the correct way to do
>> this, but I've never gotten around to figuring out how to make it work.

> I can't see an obvious way, because of the need to loop through 
> WANTED_DIRS.

I found the following closely-related suggestion in the Make manual.
It's not quite there because it doesn't seem to provide a way to pass
down the current action (all/clean/install/etc) to the sub-Make.
Any ideas how we could do that?


      Another example of the usefulness of phony targets is in conjunction
   with recursive invocations of `make'.  In this case the makefile will
   often contain a variable which lists a number of subdirectories to be
   built.  One way to handle this is with one rule whose command is a
   shell loop over the subdirectories, like this:
   
        SUBDIRS = foo bar baz
        
        subdirs:
                for dir in $(SUBDIRS); do \
                  $(MAKE) -C $$dir; \
                done
   
      There are a few of problems with this method, however.  First, any
   error detected in a submake is not noted by this rule, so it will
   continue to build the rest of the directories even when one fails.
   This can be overcome by adding shell commands to note the error and
   exit, but then it will do so even if `make' is invoked with the `-k'
   option, which is unfortunate.  Second, and perhaps more importantly,
   you cannot take advantage of the parallel build capabilities of make
   using this method, since there is only one rule.
   
      By declaring the subdirectories as phony targets (you must do this as
   the subdirectory obviously always exists; otherwise it won't be built)
   you can remove these problems:
   
        SUBDIRS = foo bar baz
        
        .PHONY: subdirs $(SUBDIRS)
        
        subdirs: $(SUBDIRS)
        
        $(SUBDIRS):
                $(MAKE) -C $@
        foo: baz
   
      Here we've also declared that the `foo' subdirectory cannot be built
   until after the `baz' subdirectory is complete; this kind of
   relationship declaration is particularly important when attempting
   parallel builds.


			regards, tom lane

Re: new target for contrib/Makefile

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Tom Lane wrote:
> I found the following closely-related suggestion in the Make manual.
> It's not quite there because it doesn't seem to provide a way to pass
> down the current action (all/clean/install/etc) to the sub-Make.
> Any ideas how we could do that?

I've seen the following idea somewhere:

SUBDIRS = ...

.PHONY: $(addsuffix -foo, $(SUBDIRS)):

$(addsuffix -foo, $(SUBDIRS)):
	$(MAKE) -C `echo $@ | sed 's/-.*$//'` `echo $@ | sed 's/^.*-//'`

Repeat for all "foo" targets that you need.  The sed expressions may 
need refining.

Then again, the original proposal doesn't sound so bad either.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: new target for contrib/Makefile

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut  writes:
> I've seen the following idea somewhere:

Looks like you used a variant of this in src/backend/Makefile.

> Then again, the original proposal doesn't sound so bad either.

Well, I'd like a more generic fix that we could apply everywhere,
because right now the Makefiles are not good about honoring -k,
and that irritates me at least a couple times a week ;-).  As an
example, if you get a compile error in building the backend,
src/Makefile aborts after "$(MAKE) -C backend" returns, instead of
proceeding to build interfaces, bin, etc.

			regards, tom lane

Re: new target for contrib/Makefile

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


Peter Eisentraut wrote:

>Tom Lane wrote:
>  
>
>>I found the following closely-related suggestion in the Make manual.
>>It's not quite there because it doesn't seem to provide a way to pass
>>down the current action (all/clean/install/etc) to the sub-Make.
>>Any ideas how we could do that?
>>    
>>
>
>I've seen the following idea somewhere:
>
>SUBDIRS = ...
>
>.PHONY: $(addsuffix -foo, $(SUBDIRS)):
>
>$(addsuffix -foo, $(SUBDIRS)):
>	$(MAKE) -C `echo $@ | sed 's/-.*$//'` `echo $@ | sed 's/^.*-//'`
>  
>

Cute. And wonderfully cryptic. I'm sure I've lost brain cells already 
just trying to understand it ;-)


cheers

andrew
FAQ