1# Generates glibc locale data for target. 2 3inputfile = $(firstword $(subst ., ,$(1))) 4charmap = $(or $(word 2,$(subst ., ,$(1))),UTF-8) 5 6# Packages all the generated locale data into the final archive. 7# 8# We sort the file names to produce consistent output regardless of 9# the `find` outputs order. 10$(TARGET_DIR)/usr/lib/locale/locale-archive: $(LOCALES) 11 $(Q)rm -f $(@) 12 $(Q)find $(TARGET_DIR)/usr/lib/locale/ -maxdepth 1 -mindepth 1 -type d -print0 \ 13 | sort -z \ 14 | xargs -0 \ 15 $(HOST_DIR)/bin/localedef \ 16 --prefix=$(TARGET_DIR) \ 17 --$(ENDIAN)-endian \ 18 --add-to-archive 19 20# Generates locale data for each locale. 21# 22# The input data comes preferably from the toolchain, or if the toolchain 23# does not have them (Linaro toolchains), we use the ones available on the 24# host machine. 25# 26# Uses `localedef`, which is built by the `host-localedef` package. 27$(LOCALES): | $(TARGET_DIR)/usr/lib/locale/ 28 $(Q)echo "Generating locale $(@)" 29 $(Q)I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \ 30 $(HOST_DIR)/bin/localedef \ 31 --prefix=$(TARGET_DIR) \ 32 --$(ENDIAN)-endian \ 33 --no-archive \ 34 -i $(call inputfile,$(@)) \ 35 -f $(call charmap,$(@)) \ 36 $(@) 37 38.PHONY: $(LOCALES) 39 40$(TARGET_DIR)/usr/lib/locale/: 41 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/ 42