Обсуждение: Enhance Makefiles to rebuild objects on map file changes

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

Enhance Makefiles to rebuild objects on map file changes

От
Chao Li
Дата:
Hi Community,

While working on the upgrade from GB18030 to GB18030-2022, I updated two GB18030-related map files. However, rebuilding PostgreSQL did not recompile anything, which led me to discover that the Makefiles under src/backend/utils/mb/conversion_procs were missing dependency rules between NAME.o and the corresponding map files.

This patch adds the necessary dependencies to ensure that when a map file changes, the corresponding .o file is rebuilt accordingly.

I have done tests for every Makefile I changed in a way like:

# make a change to a map file
$ make
# a .o got rebuilt
$ make # make again without map file change
# nothing re-compiled

Chao Li (Evan)
--------------------
HighGo Infra. Software Inc.
https://www.highgo.com/



Вложения

Re: Enhance Makefiles to rebuild objects on map file changes

От
Chao Li
Дата:
It looks weird. From https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com, I don’t see the attachment of the patch file. However, the email in my Inbox has the attachment.

Try to resend the attachment.


Chao Li (Evan)
--------------------
HighGo Infra. Software Inc.
https://www.highgo.com/


On Aug 6, 2025, at 12:41, Chao Li <lic@highgo.com> wrote:

Hi Community,

While working on the upgrade from GB18030 to GB18030-2022, I updated two GB18030-related map files. However, rebuilding PostgreSQL did not recompile anything, which led me to discover that the Makefiles under src/backend/utils/mb/conversion_procs were missing dependency rules between NAME.o and the corresponding map files.

This patch adds the necessary dependencies to ensure that when a map file changes, the corresponding .o file is rebuilt accordingly.

I have done tests for every Makefile I changed in a way like:

# make a change to a map file
$ make
# a .o got rebuilt
$ make # make again without map file change
# nothing re-compiled

Chao Li (Evan)
--------------------
HighGo Infra. Software Inc.
https://www.highgo.com/



<v1-0001-Enhance-Makefiles-to-rebuild-objects-on-map-file-.patch>

Вложения

Re: Re: Enhance Makefiles to rebuild objects on map file changes

От
厉超
Дата:

Try again ...



-----Original Messages-----
From: "Chao Li" <lic@highgo.com>
Send time: Wednesday, 06/08/2025 12:56:36
To: pgsql-hackers@lists.postgresql.org
Subject: Re: Enhance Makefiles to rebuild objects on map file changes


It looks weird. From https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com, I don’t see the attachment of the patch file. However, the email in my Inbox has the attachment.

Try to resend the attachment.


Chao Li (Evan)
--------------------
HighGo Infra. Software Inc.
https://www.highgo.com/


On Aug 6, 2025, at 12:41, Chao Li <lic@highgo.com> wrote:

Hi Community,

While working on the upgrade from GB18030 to GB18030-2022, I updated two GB18030-related map files. However, rebuilding PostgreSQL did not recompile anything, which led me to discover that the Makefiles under src/backend/utils/mb/conversion_procs were missing dependency rules between NAME.o and the corresponding map files.

This patch adds the necessary dependencies to ensure that when a map file changes, the corresponding .o file is rebuilt accordingly.

I have done tests for every Makefile I changed in a way like:

# make a change to a map file
$ make
# a .o got rebuilt
$ make # make again without map file change
# nothing re-compiled

Chao Li (Evan)
--------------------
HighGo Infra. Software Inc.
https://www.highgo.com/



<v1-0001-Enhance-Makefiles-to-rebuild-objects-on-map-file-.patch>

Вложения

Re: Enhance Makefiles to rebuild objects on map file changes

От
Álvaro Herrera
Дата:
On 2025-Aug-06, Chao Li wrote:

> It looks weird. From
> https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com,
> I don’t see the attachment of the patch file. However, the email in my
> Inbox has the attachment.

Yeah, AppleMail is known to do this.  I don't know if there's a config
toggle you can use to avoid that, or you just have to use something
else.  If there _is_ an AppleMail toggle that you changed for your later
experiemnts, please let us know what it is, so that we can point other
people with this problem to it.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Las navajas y los monos deben estar siempre distantes"   (Germán Poo)



Re: Re: Enhance Makefiles to rebuild objects on map file changes

От
厉超
Дата:
I finally switch to use my Gmail account. With the Gmail account, AppleMail can send attachment successfully.


> -----Original Messages-----
> From: "Álvaro Herrera" <alvherre@kurilemu.de>
> Send time:Wednesday, 06/08/2025 17:41:46
> To: "Chao Li" <lic@highgo.com>
> Cc: pgsql-hackers@lists.postgresql.org
> Subject: Re: Enhance Makefiles to rebuild objects on map file changes
>
> On 2025-Aug-06, Chao Li wrote:
>
> > It looks weird. From
> > https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com,
> > I don’t see the attachment of the patch file. However, the email in my
> > Inbox has the attachment.
>
> Yeah, AppleMail is known to do this.  I don't know if there's a config
> toggle you can use to avoid that, or you just have to use something
> else.  If there _is_ an AppleMail toggle that you changed for your later
> experiemnts, please let us know what it is, so that we can point other
> people with this problem to it.
>
> --
> Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
> "Las navajas y los monos deben estar siempre distantes"   (Germán Poo)

Re: Enhance Makefiles to rebuild objects on map file changes

От
Bruce Momjian
Дата:
On Wed, Aug  6, 2025 at 11:41:46AM +0200, Álvaro Herrera wrote:
> On 2025-Aug-06, Chao Li wrote:
> 
> > It looks weird. From
> > https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com,
> > I don’t see the attachment of the patch file. However, the email in my
> > Inbox has the attachment.
> 
> Yeah, AppleMail is known to do this.  I don't know if there's a config
> toggle you can use to avoid that, or you just have to use something
> else.  If there _is_ an AppleMail toggle that you changed for your later
> experiemnts, please let us know what it is, so that we can point other
> people with this problem to it.

I found this from June of 2024 with a fix:

    There's a button in the tool bar called 'Include Attachments'. If
    this button is accidentally switched off then the email won't send
    an email with attachments. So I just went to 'View' and 'Edit
    Toolbar' and got rid of this very useless button. Now I have no
    more problems with certain emails not sending with attachments.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.



Re: Enhance Makefiles to rebuild objects on map file changes

От
Bruce Momjian
Дата:
On Tue, Aug 12, 2025 at 11:58:12AM -0400, Bruce Momjian wrote:
> On Wed, Aug  6, 2025 at 11:41:46AM +0200, Álvaro Herrera wrote:
> > On 2025-Aug-06, Chao Li wrote:
> > 
> > > It looks weird. From
> > > https://www.postgresql.org/message-id/1CA8625F-AA41-4ED2-B60F-E28AC71F37DC%40highgo.com,
> > > I don’t see the attachment of the patch file. However, the email in my
> > > Inbox has the attachment.
> > 
> > Yeah, AppleMail is known to do this.  I don't know if there's a config
> > toggle you can use to avoid that, or you just have to use something
> > else.  If there _is_ an AppleMail toggle that you changed for your later
> > experiemnts, please let us know what it is, so that we can point other
> > people with this problem to it.
> 
> I found this from June of 2024 with a fix:
> 
>     There's a button in the tool bar called 'Include Attachments'. If
>     this button is accidentally switched off then the email won't send
>     an email with attachments. So I just went to 'View' and 'Edit
>     Toolbar' and got rid of this very useless button. Now I have no
>     more problems with certain emails not sending with attachments.

Sorry, URL is:

    https://discussions.apple.com/thread/254969428?sortBy=rank&page=1

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.



Re: Enhance Makefiles to rebuild objects on map file changes

От
Chao Li
Дата:
Hi Bruce,

Thanks for the information.


Sorry, URL is:

https://discussions.apple.com/thread/254969428?sortBy=rank&page=1


My problem was different. The situation I faced was:

* If I use my company’s email account with Mac Mail app to send a patch, then from other email clients that subscribed to pqsql-hackers mailing list, I can see the attachment in the email. But from postgresql.org’s mailing “Archives”, I can only see the email without attached patch file.

* If I use my Gmail account with Mac Mail app to a send a patch, then  postgresql.org’s mailing “Archives” will show the email with the patch file. However, the patch file’s content-type is always “application/octet-stream”. I couldn’t find a way to change that.

* Now I switched to use Thunderbird email app with my Gmail account. With that combination, patches file’s content-type is “plain/text” now in “Archives”.

Regards,

Chao Li (Evan)
--------------------
HighGo Software Co., Ltd.
https://www.highgo.com/



Re: Enhance Makefiles to rebuild objects on map file changes

От
Chao Li
Дата:
Hi John,

Let me explain the Makefile patch in this separate thread, as this is generic to all maps.

Let’s not use gb18030 as an example, instead, using utf8_and_win.

When any of the win-related map file changes, it suppose to automatically rebuild utf8_and_win.o.

WITHOUT this patch, after I touch a map file, it doesn’t rebuild the object file:

```
# Now it’s in master branch
chaol@ChaodeMacBook-Air utf8_and_win % pwd
/Users/chaol/Documents/code/postgresql/src/backend/utils/mb/conversion_procs/utf8_and_win

# touch a map file to simulate a change
chaol@ChaodeMacBook-Air utf8_and_win % touch ../../Unicode/win874_to_utf8.map

# make only rebuild header files, without rebuild object files.
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
'/usr/bin/perl' ../../../src/backend/catalog/genbki.pl --include-path=../../../src/include/ \
--set-version=19 ../../../src/include/catalog/pg_proc.h ../../../src/include/catalog/pg_type.h ../../../src/include/catalog/pg_attribute.h ../../../src/include/catalog/pg_class.h ../../../src/include/catalog/pg_attrdef.h ../../../src/include/catalog/pg_constraint.h ../../../src/include/catalog/pg_inherits.h ../../../src/include/catalog/pg_index.h ../../../src/include/catalog/pg_operator.h ../../../src/include/catalog/pg_opfamily.h ../../../src/include/catalog/pg_opclass.h ../../../src/include/catalog/pg_am.h ../../../src/include/catalog/pg_amop.h ../../../src/include/catalog/pg_amproc.h ../../../src/include/catalog/pg_language.h ../../../src/include/catalog/pg_largeobject_metadata.h ../../../src/include/catalog/pg_largeobject.h ../../../src/include/catalog/pg_aggregate.h ../../../src/include/catalog/pg_statistic.h ../../../src/include/catalog/pg_statistic_ext.h ../../../src/include/catalog/pg_statistic_ext_data.h ../../../src/include/catalog/pg_rewrite.h ../../../src/include/catalog/pg_trigger.h ../../../src/include/catalog/pg_event_trigger.h ../../../src/include/catalog/pg_description.h ../../../src/include/catalog/pg_cast.h ../../../src/include/catalog/pg_enum.h ../../../src/include/catalog/pg_namespace.h ../../../src/include/catalog/pg_conversion.h ../../../src/include/catalog/pg_depend.h ../../../src/include/catalog/pg_database.h ../../../src/include/catalog/pg_db_role_setting.h ../../../src/include/catalog/pg_tablespace.h ../../../src/include/catalog/pg_authid.h ../../../src/include/catalog/pg_auth_members.h ../../../src/include/catalog/pg_shdepend.h ../../../src/include/catalog/pg_shdescription.h ../../../src/include/catalog/pg_ts_config.h ../../../src/include/catalog/pg_ts_config_map.h ../../../src/include/catalog/pg_ts_dict.h ../../../src/include/catalog/pg_ts_parser.h ../../../src/include/catalog/pg_ts_template.h ../../../src/include/catalog/pg_extension.h ../../../src/include/catalog/pg_foreign_data_wrapper.h ../../../src/include/catalog/pg_foreign_server.h ../../../src/include/catalog/pg_user_mapping.h ../../../src/include/catalog/pg_foreign_table.h ../../../src/include/catalog/pg_policy.h ../../../src/include/catalog/pg_replication_origin.h ../../../src/include/catalog/pg_default_acl.h ../../../src/include/catalog/pg_init_privs.h ../../../src/include/catalog/pg_seclabel.h ../../../src/include/catalog/pg_shseclabel.h ../../../src/include/catalog/pg_collation.h ../../../src/include/catalog/pg_parameter_acl.h ../../../src/include/catalog/pg_partitioned_table.h ../../../src/include/catalog/pg_range.h ../../../src/include/catalog/pg_transform.h ../../../src/include/catalog/pg_sequence.h ../../../src/include/catalog/pg_publication.h ../../../src/include/catalog/pg_publication_namespace.h ../../../src/include/catalog/pg_publication_rel.h ../../../src/include/catalog/pg_subscription.h ../../../src/include/catalog/pg_subscription_rel.h
touch bki-stamp
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
'/usr/bin/perl' gen_node_support.pl ../../../src/include/nodes/nodes.h ../../../src/include/nodes/primnodes.h ../../../src/include/nodes/parsenodes.h ../../../src/include/nodes/pathnodes.h ../../../src/include/nodes/plannodes.h ../../../src/include/nodes/execnodes.h ../../../src/include/access/amapi.h ../../../src/include/access/cmptype.h ../../../src/include/access/sdir.h ../../../src/include/access/tableam.h ../../../src/include/access/tsmapi.h ../../../src/include/commands/event_trigger.h ../../../src/include/commands/trigger.h ../../../src/include/executor/tuptable.h ../../../src/include/foreign/fdwapi.h ../../../src/include/nodes/bitmapset.h ../../../src/include/nodes/extensible.h ../../../src/include/nodes/lockoptions.h ../../../src/include/nodes/miscnodes.h ../../../src/include/nodes/replnodes.h ../../../src/include/nodes/supportnodes.h ../../../src/include/nodes/value.h ../../../src/include/utils/rel.h
touch node-support-stamp
cd '../../../src/include/nodes/' && for file in nodetags.h; do \
 rm -f $file && ln -s "../../../src/backend/nodes/$file" . ; \
done
touch ../../../src/include/nodes/header-stamp
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.

# make again, it does nothing
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
make[2]: Nothing to be done for `generated-headers'.
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
make[2]: Nothing to be done for `generated-header-symlinks'.
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.
```

WITH this patch, it will automatically rebuild object files:

```
# switch to the patch branch
chaol@ChaodeMacBook-Air utf8_and_win % git co topic/chaol/mb-makefiles
Switched to branch 'topic/chaol/mb-makefiles’

# After switching branch, make rebuilt header files and object files.
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
'/usr/bin/perl' ../../../src/backend/catalog/genbki.pl --include-path=../../../src/include/ \
--set-version=19 ../../../src/include/catalog/pg_proc.h ../../../src/include/catalog/pg_type.h ../../../src/include/catalog/pg_attribute.h ../../../src/include/catalog/pg_class.h ../../../src/include/catalog/pg_attrdef.h ../../../src/include/catalog/pg_constraint.h ../../../src/include/catalog/pg_inherits.h ../../../src/include/catalog/pg_index.h ../../../src/include/catalog/pg_operator.h ../../../src/include/catalog/pg_opfamily.h ../../../src/include/catalog/pg_opclass.h ../../../src/include/catalog/pg_am.h ../../../src/include/catalog/pg_amop.h ../../../src/include/catalog/pg_amproc.h ../../../src/include/catalog/pg_language.h ../../../src/include/catalog/pg_largeobject_metadata.h ../../../src/include/catalog/pg_largeobject.h ../../../src/include/catalog/pg_aggregate.h ../../../src/include/catalog/pg_statistic.h ../../../src/include/catalog/pg_statistic_ext.h ../../../src/include/catalog/pg_statistic_ext_data.h ../../../src/include/catalog/pg_rewrite.h ../../../src/include/catalog/pg_trigger.h ../../../src/include/catalog/pg_event_trigger.h ../../../src/include/catalog/pg_description.h ../../../src/include/catalog/pg_cast.h ../../../src/include/catalog/pg_enum.h ../../../src/include/catalog/pg_namespace.h ../../../src/include/catalog/pg_conversion.h ../../../src/include/catalog/pg_depend.h ../../../src/include/catalog/pg_database.h ../../../src/include/catalog/pg_db_role_setting.h ../../../src/include/catalog/pg_tablespace.h ../../../src/include/catalog/pg_authid.h ../../../src/include/catalog/pg_auth_members.h ../../../src/include/catalog/pg_shdepend.h ../../../src/include/catalog/pg_shdescription.h ../../../src/include/catalog/pg_ts_config.h ../../../src/include/catalog/pg_ts_config_map.h ../../../src/include/catalog/pg_ts_dict.h ../../../src/include/catalog/pg_ts_parser.h ../../../src/include/catalog/pg_ts_template.h ../../../src/include/catalog/pg_extension.h ../../../src/include/catalog/pg_foreign_data_wrapper.h ../../../src/include/catalog/pg_foreign_server.h ../../../src/include/catalog/pg_user_mapping.h ../../../src/include/catalog/pg_foreign_table.h ../../../src/include/catalog/pg_policy.h ../../../src/include/catalog/pg_replication_origin.h ../../../src/include/catalog/pg_default_acl.h ../../../src/include/catalog/pg_init_privs.h ../../../src/include/catalog/pg_seclabel.h ../../../src/include/catalog/pg_shseclabel.h ../../../src/include/catalog/pg_collation.h ../../../src/include/catalog/pg_parameter_acl.h ../../../src/include/catalog/pg_partitioned_table.h ../../../src/include/catalog/pg_range.h ../../../src/include/catalog/pg_transform.h ../../../src/include/catalog/pg_sequence.h ../../../src/include/catalog/pg_publication.h ../../../src/include/catalog/pg_publication_namespace.h ../../../src/include/catalog/pg_publication_rel.h ../../../src/include/catalog/pg_subscription.h ../../../src/include/catalog/pg_subscription_rel.h
touch bki-stamp
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
'/usr/bin/perl' gen_node_support.pl ../../../src/include/nodes/nodes.h ../../../src/include/nodes/primnodes.h ../../../src/include/nodes/parsenodes.h ../../../src/include/nodes/pathnodes.h ../../../src/include/nodes/plannodes.h ../../../src/include/nodes/execnodes.h ../../../src/include/access/amapi.h ../../../src/include/access/cmptype.h ../../../src/include/access/sdir.h ../../../src/include/access/tableam.h ../../../src/include/access/tsmapi.h ../../../src/include/commands/event_trigger.h ../../../src/include/commands/trigger.h ../../../src/include/executor/tuptable.h ../../../src/include/foreign/fdwapi.h ../../../src/include/nodes/bitmapset.h ../../../src/include/nodes/extensible.h ../../../src/include/nodes/lockoptions.h ../../../src/include/nodes/miscnodes.h ../../../src/include/nodes/replnodes.h ../../../src/include/nodes/supportnodes.h ../../../src/include/nodes/value.h ../../../src/include/utils/rel.h
touch node-support-stamp
cd '../../../src/include/nodes/' && for file in nodetags.h; do \
 rm -f $file && ln -s "../../../src/backend/nodes/$file" . ; \
done
touch ../../../src/include/nodes/header-stamp
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -I../../../../../../src/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -I/opt/homebrew/Cellar/icu4c@77/77.1/include    -c -o utf8_and_win.o utf8_and_win.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -bundle -o utf8_and_win.dylib utf8_and_win.o  -L../../../../../../src/port -L../../../../../../src/common  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -Wl,-dead_strip_dylibs   -fvisibility=hidden -bundle_loader ../../../../../../src/backend/postgres

# touch a map file to simulate map file change
chaol@ChaodeMacBook-Air utf8_and_win % touch ../../Unicode/win874_to_utf8.map

# make rebuilt object files
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
make[2]: Nothing to be done for `generated-headers'.
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
make[2]: Nothing to be done for `generated-header-symlinks'.
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -I../../../../../../src/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -I/opt/homebrew/Cellar/icu4c@77/77.1/include    -c -o utf8_and_win.o utf8_and_win.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -bundle -o utf8_and_win.dylib utf8_and_win.o  -L../../../../../../src/port -L../../../../../../src/common  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -Wl,-dead_strip_dylibs   -fvisibility=hidden -bundle_loader ../../../../../../src/backend/postgres
chaol@ChaodeMacBook-Air utf8_and_win %

# make again did nothing
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
make[2]: Nothing to be done for `generated-headers'.
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
make[2]: Nothing to be done for `generated-header-symlinks'.
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.

# change map file again
chaol@ChaodeMacBook-Air utf8_and_win % touch ../../Unicode/win874_to_utf8.map

# make automatically rebuilt object files.
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
make[2]: Nothing to be done for `generated-headers'.
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
make[2]: Nothing to be done for `generated-header-symlinks'.
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -I../../../../../../src/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -I/opt/homebrew/Cellar/icu4c@77/77.1/include    -c -o utf8_and_win.o utf8_and_win.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -Wno-cast-function-type-strict -g -O2  -fvisibility=hidden -bundle -o utf8_and_win.dylib utf8_and_win.o  -L../../../../../../src/port -L../../../../../../src/common  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk   -Wl,-dead_strip_dylibs   -fvisibility=hidden -bundle_loader ../../../../../../src/backend/postgres

# make again did nothing
chaol@ChaodeMacBook-Air utf8_and_win % make
/Library/Developer/CommandLineTools/usr/bin/make -C ../../../../../../src/backend generated-headers
/Library/Developer/CommandLineTools/usr/bin/make -C ../include/catalog generated-headers
make[2]: Nothing to be done for `generated-headers'.
/Library/Developer/CommandLineTools/usr/bin/make -C nodes generated-header-symlinks
make[2]: Nothing to be done for `generated-header-symlinks'.
/Library/Developer/CommandLineTools/usr/bin/make -C utils generated-header-symlinks
/Library/Developer/CommandLineTools/usr/bin/make -C adt jsonpath_gram.h
make[3]: `jsonpath_gram.h' is up to date.
```


--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Re: Enhance Makefiles to rebuild objects on map file changes

От
Álvaro Herrera
Дата:
On 2025-Aug-19, Chao Li wrote:

> Hi John,
> 
> Let me explain the Makefile patch in this separate thread, as this is generic to all maps.
> 
> Let’s not use gb18030 as an example, instead, using utf8_and_win.
> 
> When any of the win-related map file changes, it suppose to automatically rebuild utf8_and_win.o.
> 
> WITHOUT this patch, after I touch a map file, it doesn’t rebuild the object file:

Hmm.  Yeah, this really looks somewhat bogus as you say.  I wonder
though if we shouldn't have the UCS_to_*.pl scripts generate a bunch of
"mapdeps.mk" files instead, or something like that, given that these
*.map files are themselves generated.

Also, I suspect you should do something about Meson, but I don't know
what that would look like.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Thou shalt study thy libraries and strive not to reinvent them without
cause, that thy code may be short and readable and thy days pleasant
and productive. (7th Commandment for C Programmers)



Re: Enhance Makefiles to rebuild objects on map file changes

От
John Naylor
Дата:
On Tue, Aug 19, 2025 at 10:43 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
>
> Also, I suspect you should do something about Meson, but I don't know
> what that would look like.

It seems to work already on Meson:

$ <build>
$ touch src/backend/utils/mb/Unicode/win874_to_utf8.map
$ <build>
building for debug
ninja: Entering directory `build-debug'
[2/2] Linking target src/backend/utils/mb/conversion_procs/utf8_and_win.so

--
John Naylor
Amazon Web Services