Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
Subject: Re: autogenerating error code lists (was Re: [COMMITTERS] pgsql: Add foreign data wrapper error code values for SQL/MED.)
Date: 2011-01-11 20:21:05
Message-ID: 4D2CBBB1.6050805@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 11/01/11 18:59, Tom Lane wrote:
> =?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= <wulczer(at)wulczer(dot)org> writes:
>> On 11/01/11 17:11, Tom Lane wrote:
>>> Huh? Why in the world would the specific location of the #include have
>>> anything to do with the problem?
>
>> I'v having a hard time convincing make to generate errcodes.h before
>> compiling any .c file that includes postgres.h. The only way I found was
>> to make src/include/errcodes.h a dependancy of the all target.
>
> Peter would probably be a better person than me to answer that, but I
> imagine that what you want is similar to what src/backend/Makefile does
> for parser/gram.h, only applied at the src/ level or maybe even the
> root.

OK, that was a nudge in the right direction. Basing the rules from
src/backend/Makefile I changed src/Makefile to rebuild
src/include/errcodes.h before building the subdirectories and... it
failed miserably. There's some trickery beyond my understanding here.
There's a rule like this in src/backend/Makefile:

$(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h

that triggers checking whether gram.h needs to be rebuilt before
recursing into each SUBDIR.

A similar trick in src/Makefile doesn't work, because it's
src/backend/common.mk that is responsible for the SUBDIR-recursive
calls, and src/Makefile does not include it.

From what I gathered by reading Makefile.global, the $(recurse) call in
enters each SUBDIR and builds a target called <target>-<subdir>-recurse.
And actually, if I change my rule to read:

$(SUBDIRS:%=all-%-recurse): $(top_builddir)/src/include/utils/errcodes.h

it works. Now whether that's acceptable or not is another thing entirely...

Cheers,
Jan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2011-01-11 20:26:40 pgsql: Track walsender state in shared memory and expose in pg_stat_rep
Previous Message Magnus Hagander 2011-01-11 20:12:34 pgsql: Add missing function prototype, for consistency

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-01-11 20:56:06 Re: Allowing multiple concurrent base backups
Previous Message Jeff Davis 2011-01-11 20:16:43 Re: Allowing multiple concurrent base backups