Add support for automatically updating Unicode derived files
[pgsql.git] / contrib / unaccent / Makefile
blob9753bc6ad2912878c925d32e4e778877bac4e110
1 # contrib/unaccent/Makefile
3 MODULE_big = unaccent
4 OBJS = \
5 $(WIN32RES) \
6 unaccent.o
8 EXTENSION = unaccent
9 DATA = unaccent--1.1.sql unaccent--1.0--1.1.sql unaccent--unpackaged--1.0.sql
10 DATA_TSEARCH = unaccent.rules
11 PGFILEDESC = "unaccent - text search dictionary that removes accents"
13 REGRESS = unaccent
15 # We need a UTF8 database
16 ENCODING = UTF8
17 NO_LOCALE = 1
19 ifdef USE_PGXS
20 PG_CONFIG = pg_config
21 PGXS := $(shell $(PG_CONFIG) --pgxs)
22 include $(PGXS)
23 else
24 subdir = contrib/unaccent
25 top_builddir = ../..
26 include $(top_builddir)/src/Makefile.global
27 include $(top_srcdir)/contrib/contrib-global.mk
28 endif
30 update-unicode: unaccent.rules
32 # Allow running this even without --with-python
33 PYTHON ?= python
35 unaccent.rules: generate_unaccent_rules.py ../../src/common/unicode/UnicodeData.txt Latin-ASCII.xml
36 $(PYTHON) $< --unicode-data-file $(word 2,$^) --latin-ascii-file $(word 3,$^) >$@
38 # Only download it once; dependencies must match src/common/unicode/
39 ../../src/common/unicode/UnicodeData.txt: $(top_builddir)/src/Makefile.global
40 $(MAKE) -C $(@D) $(@F)
42 # Dependency on Makefile.global is for CLDR_VERSION
43 Latin-ASCII.xml: $(top_builddir)/src/Makefile.global
44 $(DOWNLOAD) https://raw.githubusercontent.com/unicode-org/cldr/release-$(subst .,-,$(CLDR_VERSION))/common/transforms/Latin-ASCII.xml
46 distclean:
47 rm -f Latin-ASCII.xml