lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Copyright (C) 2015 Free Software Foundation, Inc. |
| 2 | # This file is part of the GNU C Library. |
| 3 | |
| 4 | # The GNU C Library is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU Lesser General Public |
| 6 | # License as published by the Free Software Foundation; either |
| 7 | # version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | # The GNU C Library is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | # Lesser General Public License for more details. |
| 13 | |
| 14 | # You should have received a copy of the GNU Lesser General Public |
| 15 | # License along with the GNU C Library; if not, see |
| 16 | # <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | # Makefile for generating and updating Unicode-extracted files. |
| 19 | |
| 20 | |
| 21 | # This Makefile is NOT used as part of the GNU libc build. It needs |
| 22 | # to be run manually, within the source tree, at Unicode upgrades |
| 23 | # (change UNICODE_VERSION below), to update ../locales/i18n ctype |
| 24 | # information (part of the file is preserved, so don't wipe it all |
| 25 | # out), and ../charmaps/UTF-8. |
| 26 | |
| 27 | # Use make all to generate the files used in the glibc build out of |
| 28 | # the original Unicode files; make check to verify that they are what |
| 29 | # we expect; make install to copy them to the location expected by the |
| 30 | # glibc build; and make clean to remove all generated files. |
| 31 | |
| 32 | # We keep a local copy of the downloaded Unicode files, to avoid |
| 33 | # running afoul of the LGPL corresponding sources requirements, even |
| 34 | # though it's not clear that they are preferred over the generated |
| 35 | # files for making modifications. |
| 36 | |
| 37 | |
| 38 | UNICODE_VERSION = 7.0.0 |
| 39 | |
| 40 | PYTHON3 = python3 |
| 41 | WGET = wget |
| 42 | |
| 43 | DOWNLOADS = UnicodeData.txt DerivedCoreProperties.txt EastAsianWidth.txt |
| 44 | GENERATED = i18n UTF-8 |
| 45 | REPORTS = i18n-report UTF-8-report |
| 46 | |
| 47 | all: $(GENERATED) |
| 48 | |
| 49 | check: check-i18n check-UTF-8 |
| 50 | |
| 51 | install: |
| 52 | cp -p i18n ../locales/i18n |
| 53 | cp -p UTF-8 ../charmaps/UTF-8 |
| 54 | |
| 55 | clean: mostlyclean |
| 56 | -rm -rf __pycache__ |
| 57 | mostlyclean: |
| 58 | -rm -f $(REPORTS) $(GENERATED) |
| 59 | |
| 60 | .PHONY: all check clean mostlyclean install |
| 61 | |
| 62 | i18n: UnicodeData.txt DerivedCoreProperties.txt |
| 63 | i18n: ../locales/i18n # Preserve non-ctype information. |
| 64 | i18n: gen_unicode_ctype.py |
| 65 | $(PYTHON3) gen_unicode_ctype.py -u UnicodeData.txt \ |
| 66 | -d DerivedCoreProperties.txt -i ../locales/i18n -o $@ \ |
| 67 | --unicode_version $(UNICODE_VERSION) |
| 68 | |
| 69 | i18n-report: i18n ../locales/i18n |
| 70 | i18n-report: ctype_compatibility.py ctype_compatibility_test_cases.py |
| 71 | $(PYTHON3) ./ctype_compatibility.py -o ../locales/i18n \ |
| 72 | -n i18n -a -m > $@ |
| 73 | |
| 74 | check-i18n: i18n-report |
| 75 | @if grep '\(Missing\|Added\) [^0]\|^Number of errors[^=]* = [^0]' \ |
| 76 | i18n-report; \ |
| 77 | then echo manual verification required; false; else true; fi |
| 78 | |
| 79 | UTF-8: UnicodeData.txt EastAsianWidth.txt |
| 80 | UTF-8: utf8_gen.py |
| 81 | $(PYTHON3) utf8_gen.py UnicodeData.txt EastAsianWidth.txt |
| 82 | |
| 83 | UTF-8-report: UTF-8 ../charmaps/UTF-8 |
| 84 | UTF-8-report: utf8_compatibility.py |
| 85 | $(PYTHON3) ./utf8_compatibility.py -o ../charmaps/UTF-8 \ |
| 86 | -n UTF-8 -a -m > $@ |
| 87 | |
| 88 | check-UTF-8: UTF-8-report |
| 89 | @if grep '^Total.*: [^0]' UTF-8-report; \ |
| 90 | then echo manual verification required; false; else true; fi |
| 91 | |
| 92 | |
| 93 | .PHONY: downloads clean-downloads |
| 94 | downloads: $(DOWNLOADS) |
| 95 | clean-downloads: |
| 96 | -rm -f $(DOWNLOADS) |
| 97 | |
| 98 | $(DOWNLOADS): |
| 99 | $(WGET) http://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/$@ |