| 1 |
#------------------------------------------------------------------------- |
| 2 |
# |
| 3 |
# Makefile for src/backend/utils/mb/Unicode |
| 4 |
# |
| 5 |
# Copyright (c) 2001-2025, PostgreSQL Global Development Group |
| 6 |
# |
| 7 |
# src/backend/utils/mb/Unicode/Makefile |
| 8 |
# |
| 9 |
#------------------------------------------------------------------------- |
| 10 |
|
| 11 |
subdir = src/backend/utils/mb/Unicode |
| 12 |
top_builddir = ../../../../.. |
| 13 |
include $(top_builddir)/src/Makefile.global |
| 14 |
|
| 15 |
|
| 16 |
# Define a rule to create the map files from downloaded text input |
| 17 |
# files using a script. Arguments: |
| 18 |
# |
| 19 |
# 1: encoding name used in output files (lower case) |
| 20 |
# 2: script name |
| 21 |
# 3: input text files |
| 22 |
# 4: argument to pass to script (optional) |
| 23 |
# |
| 24 |
# We also collect all the input and output files in variables to |
| 25 |
# define the build and clean rules below. |
| 26 |
# |
| 27 |
# Note that while each script call produces two output files, to be |
| 28 |
# parallel-make safe we need to split this into two rules. (See notes |
| 29 |
# in src/backend/parser/Makefile about rules with multiple outputs.) |
| 30 |
# |
| 31 |
define map_rule |
| 32 |
MAPS += $(1)_to_utf8.map utf8_to_$(1).map |
| 33 |
ALL_TEXTS += $(3) |
| 34 |
|
| 35 |
$(1)_to_utf8.map: $(2) $(3) |
| 36 |
$(PERL) -I $$(srcdir) $$< $(4) |
| 37 |
|
| 38 |
utf8_to_$(1).map: $(1)_to_utf8.map |
| 39 |
@touch $$@ |
| 40 |
endef |
| 41 |
|
| 42 |
$(foreach n,2 3 4 5 6 7 8 9 10 13 14 15 16,$(eval $(call map_rule,iso8859_$(n),UCS_to_most.pl,8859-$(n).TXT,ISO8859_$(n)))) |
| 43 |
|
| 44 |
$(foreach n,866 874 1250 1251 1252 1253 1254 1255 1256 1257 1258,$(eval $(call map_rule,win$(n),UCS_to_most.pl,CP$(n).TXT,WIN$(n)))) |
| 45 |
|
| 46 |
$(eval $(call map_rule,koi8r,UCS_to_most.pl,KOI8-R.TXT,KOI8R)) |
| 47 |
$(eval $(call map_rule,koi8u,UCS_to_most.pl,KOI8-U.TXT,KOI8U)) |
| 48 |
$(eval $(call map_rule,gbk,UCS_to_most.pl,CP936.TXT,GBK)) |
| 49 |
|
| 50 |
$(eval $(call map_rule,johab,UCS_to_JOHAB.pl,JOHAB.TXT)) |
| 51 |
$(eval $(call map_rule,uhc,UCS_to_UHC.pl,windows-949-2000.xml)) |
| 52 |
$(eval $(call map_rule,euc_jp,UCS_to_EUC_JP.pl,CP932.TXT JIS0212.TXT)) |
| 53 |
$(eval $(call map_rule,euc_cn,UCS_to_EUC_CN.pl,gb-18030-2000.xml)) |
| 54 |
$(eval $(call map_rule,euc_kr,UCS_to_EUC_KR.pl,KSX1001.TXT)) |
| 55 |
$(eval $(call map_rule,euc_tw,UCS_to_EUC_TW.pl,CNS11643.TXT)) |
| 56 |
$(eval $(call map_rule,sjis,UCS_to_SJIS.pl,CP932.TXT)) |
| 57 |
$(eval $(call map_rule,gb18030,UCS_to_GB18030.pl,gb-18030-2000.xml)) |
| 58 |
$(eval $(call map_rule,big5,UCS_to_BIG5.pl,CP950.TXT BIG5.TXT CP950.TXT)) |
| 59 |
$(eval $(call map_rule,euc_jis_2004,UCS_to_EUC_JIS_2004.pl,euc-jis-2004-std.txt)) |
| 60 |
$(eval $(call map_rule,shift_jis_2004,UCS_to_SHIFT_JIS_2004.pl,sjis-0213-2004-std.txt)) |
| 61 |
|
| 62 |
# remove duplicates |
| 63 |
TEXTS = $(sort $(ALL_TEXTS)) |
| 64 |
|
| 65 |
all: $(MAPS) |
| 66 |
|
| 67 |
distclean: clean |
| 68 |
rm -f $(TEXTS) |
| 69 |
rm -f $(MAPS) |
| 70 |
|
| 71 |
|
| 72 |
BIG5.TXT CNS11643.TXT: |
| 73 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/$(@F) |
| 74 |
|
| 75 |
euc-jis-2004-std.txt sjis-0213-2004-std.txt: |
| 76 |
$(DOWNLOAD) http://x0213.org/codetable/$(@F) |
| 77 |
|
| 78 |
gb-18030-2000.xml windows-949-2000.xml: |
| 79 |
$(DOWNLOAD) https://raw.githubusercontent.com/unicode-org/icu-data/master/charset/data/xml/$(@F) |
| 80 |
|
| 81 |
GB2312.TXT: |
| 82 |
$(DOWNLOAD) 'http://trac.greenstone.org/browser/trunk/gsdl/unicode/MAPPINGS/EASTASIA/GB/GB2312.TXT?rev=1842&format=txt' |
| 83 |
|
| 84 |
JIS0212.TXT: |
| 85 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/$(@F) |
| 86 |
|
| 87 |
JOHAB.TXT KSX1001.TXT: |
| 88 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/KSC/$(@F) |
| 89 |
|
| 90 |
KOI8-R.TXT KOI8-U.TXT: |
| 91 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/$(@F) |
| 92 |
|
| 93 |
$(filter 8859-%.TXT,$(TEXTS)): |
| 94 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/ISO8859/$(@F) |
| 95 |
|
| 96 |
$(filter CP9%.TXT CP12%.TXT,$(TEXTS)): |
| 97 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/$(@F) |
| 98 |
|
| 99 |
$(filter CP8%.TXT,$(TEXTS)): |
| 100 |
$(DOWNLOAD) https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/$(@F) |