diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-02-07 17:12:49 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-02-10 11:34:44 +0100 |
commit | a378b130c390423c22999db0841ad1fcf10b4e5c (patch) | |
tree | cc5feadb34bf6ac69d84c66dad5466f5290e7102 /extras | |
parent | bda200a5e9c4592bd61b7924fa171ec3265bfd24 (diff) |
simplify autocorrect makefile
The multiple indirections/complex nested constructs don't really provide
any benefit here, they certainly don't make the makefile easier to read.
Also remove the empty mimetype files and just touch them instead of
copying them.
The xml and mimetype files are now intermediates and are removed by make
once the .dat is built. (if that's not desired, they can be flagged as
.SECONDARY)
Further simplification is possible when using the same language code
for both the intermediate directory as well as the source directory
layout and the .dat files
Change-Id: I0e0c28abcad2b404a88d1f32b9b9cdb53b4125c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129628
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'extras')
50 files changed, 32 insertions, 47 deletions
diff --git a/extras/CustomTarget_autocorr.mk b/extras/CustomTarget_autocorr.mk index 8ac2dd86502a..16e2658dd53d 100644 --- a/extras/CustomTarget_autocorr.mk +++ b/extras/CustomTarget_autocorr.mk @@ -59,6 +59,8 @@ extras_AUTOCORR_LANGS := \ zh-CN:zh-CN \ zh-TW:zh-TW \ +extras_AUTOCORR_SHORTLANG = $(firstword $(subst :, ,$(filter %:$(1),$(extras_AUTOCORR_LANGS)))) + extras_AUTOCORR_XMLFILES := \ af-ZA/DocumentList.xml \ af-ZA/META-INF/manifest.xml \ @@ -234,62 +236,45 @@ extras_AUTOCORR_XMLFILES := \ zh-TW/META-INF/manifest.xml \ zh-TW/SentenceExceptList.xml \ +# param: shortlang +extras_AUTOCORR_XMLFILES_LANG = $(subst $(1)/,,$(filter $(1)/%,$(extras_AUTOCORR_XMLFILES))) -extras_AUTOCORR_MIMETYPEFILES := $(foreach lang,$(extras_AUTOCORR_LANGS),$(firstword $(subst :, ,$(lang)))/mimetype) - - -$(call gb_CustomTarget_get_target,extras/source/autocorr) : \ - $(foreach lang,$(extras_AUTOCORR_LANGS),$(call gb_CustomTarget_get_workdir,extras/source/autocorr)/acor_$(lastword $(subst :, ,$(lang))).dat) - -$(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype : $(SRCDIR)/extras/source/autocorr/lang/%/mimetype - $(call gb_Output_announce,autocorr/$*/mimetype,$(true),CPY,1) - $(call gb_Trace_StartRange,autocorr/$*/mimetype,CPY) - cp $< $@ - $(call gb_Trace_EndRange,autocorr/$*/mimetype,CPY) +$(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype : \ + | $(dir $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype).dir + $(call gb_Output_announce,autocorr/$*/mimetype,$(true),TCH,1) + $(call gb_Trace_StartRange,autocorr/$*/mimetype,TCH) + touch $@ + $(call gb_Trace_EndRange,autocorr/$*/mimetype,TCH) +.SECONDEXPANSION: +# secondexpansion since the pattern not just covers a file, but also a directory portion with +# different number of elements (just the lang or lang/META-INF) and thus the directory dependency +# needs the stem of the actual target to work as intended $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%.xml : $(SRCDIR)/extras/source/autocorr/lang/%.xml \ - | $(call gb_ExternalExecutable_get_dependencies,xsltproc) + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) \ + $$(dir $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/$$*.xml).dir $(call gb_Output_announce,autocorr/$*.xml,$(true),XSL,1) $(call gb_Trace_StartRange,autocorr/$*.xml,XSL) $(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $< $(call gb_Trace_EndRange,autocorr/$*.xml,XSL) -$(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%.dat : - $(call gb_Output_announce,autocorr/$*.dat,$(true),ZIP,2) - $(call gb_Trace_StartRange,autocorr/$*.dat,ZIP) +# secondexpansion necessry since the .dat are created with longlang form, while the other files +# are created in the shortlang directory, and thus % cannot be used verbatim, the second expansion +# allows the actual stem from the target to be used in the macro calls +# there's no reason for the different directories thouch, so a janitorial cleanup would be +# TODO: get rid of the shortform:longform language names when assembling the autocorr files +$(call gb_CustomTarget_get_workdir,extras/source/autocorr)/acor_%.dat : \ + $$(addprefix \ + $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/$$(call extras_AUTOCORR_SHORTLANG,$$*)/,\ + mimetype \ + $$(call extras_AUTOCORR_XMLFILES_LANG,$$(call extras_AUTOCORR_SHORTLANG,$$*))) + $(call gb_Output_announce,autocorr/acor_$*.dat,$(true),ZIP,2) + $(call gb_Trace_StartRange,autocorr/acor_$*.dat,ZIP) $(call gb_Helper_abbreviate_dirs,\ - cd $(EXTRAS_AUTOCORR_DIR) && \ - zip -q0X --filesync --must-match $@ $(EXTRAS_AUTOCORR_MIMEFILES_FILTER) && \ - zip -qrX --must-match $@ $(EXTRAS_AUTOCORR_XMLFILES_FILTER) \ + cd $(dir $<) && \ + zip -q0X --filesync --must-match $@ mimetype && \ + zip -qrX --must-match $@ $(call extras_AUTOCORR_XMLFILES_LANG,$(call extras_AUTOCORR_SHORTLANG,$*)) \ ) - $(call gb_Trace_EndRange,autocorr/$*.dat,ZIP) - -define extras_Autocorr_make_file_deps -$(call gb_CustomTarget_get_workdir,$(1))/$(2) : $(SRCDIR)/$(1)/lang/$(2) \ - | $(dir $(call gb_CustomTarget_get_workdir,$(1))/$(2)).dir - -endef - -define extras_Autocorr_make_zip_deps -$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \ - $(addprefix $(call gb_CustomTarget_get_workdir,$(1))/,$(filter $(3)/%,$(extras_AUTOCORR_MIMETYPEFILES) $(extras_AUTOCORR_XMLFILES))) \ - | $(dir $(call gb_CustomTarget_get_workdir,$(1))/$(2)).dir - -$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \ - EXTRAS_AUTOCORR_MIMEFILES_FILTER := $(foreach file,$(filter $(3)/%,$(extras_AUTOCORR_MIMETYPEFILES)),$(subst $(3)/,,$(file))) -$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \ - EXTRAS_AUTOCORR_XMLFILES_FILTER := $(foreach file,$(filter $(3)/%,$(extras_AUTOCORR_XMLFILES)),$(subst $(3)/,,$(file))) -$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \ - EXTRAS_AUTOCORR_DIR := $(call gb_CustomTarget_get_workdir,$(1))/$(3) - -endef - -$(eval $(foreach file,$(extras_AUTOCORR_MIMETYPEFILES) $(extras_AUTOCORR_XMLFILES),\ - $(call extras_Autocorr_make_file_deps,extras/source/autocorr,$(file)) \ -)) - -$(eval $(foreach lang,$(extras_AUTOCORR_LANGS),\ - $(call extras_Autocorr_make_zip_deps,extras/source/autocorr,acor_$(lastword $(subst :, ,$(lang))).dat,$(firstword $(subst :, ,$(lang)))) \ -)) + $(call gb_Trace_EndRange,autocorr/acor_$*.dat,ZIP) # vim: set noet sw=4 ts=4: diff --git a/extras/source/autocorr/lang/af-ZA/mimetype b/extras/source/autocorr/lang/af-ZA/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/af-ZA/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/bg/mimetype b/extras/source/autocorr/lang/bg/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/bg/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ca/mimetype b/extras/source/autocorr/lang/ca/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ca/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/cs/mimetype b/extras/source/autocorr/lang/cs/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/cs/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/da/mimetype b/extras/source/autocorr/lang/da/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/da/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/de/mimetype b/extras/source/autocorr/lang/de/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/de/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/dsb/mimetype b/extras/source/autocorr/lang/dsb/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/dsb/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/el/mimetype b/extras/source/autocorr/lang/el/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/el/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/en-AU/mimetype b/extras/source/autocorr/lang/en-AU/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/en-AU/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/en-GB/mimetype b/extras/source/autocorr/lang/en-GB/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/en-GB/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/en-US/mimetype b/extras/source/autocorr/lang/en-US/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/en-US/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/en-ZA/mimetype b/extras/source/autocorr/lang/en-ZA/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/en-ZA/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/es/mimetype b/extras/source/autocorr/lang/es/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/es/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/fa/mimetype b/extras/source/autocorr/lang/fa/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/fa/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/fi/mimetype b/extras/source/autocorr/lang/fi/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/fi/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/fr/mimetype b/extras/source/autocorr/lang/fr/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/fr/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ga-IE/mimetype b/extras/source/autocorr/lang/ga-IE/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ga-IE/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/hr/mimetype b/extras/source/autocorr/lang/hr/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/hr/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/hsb/mimetype b/extras/source/autocorr/lang/hsb/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/hsb/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/hu/mimetype b/extras/source/autocorr/lang/hu/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/hu/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/is/mimetype b/extras/source/autocorr/lang/is/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/is/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/it/mimetype b/extras/source/autocorr/lang/it/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/it/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ja/mimetype b/extras/source/autocorr/lang/ja/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ja/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ko/mimetype b/extras/source/autocorr/lang/ko/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ko/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/lb-LU/mimetype b/extras/source/autocorr/lang/lb-LU/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/lb-LU/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/lt/mimetype b/extras/source/autocorr/lang/lt/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/lt/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/mn/mimetype b/extras/source/autocorr/lang/mn/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/mn/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/nl-BE/mimetype b/extras/source/autocorr/lang/nl-BE/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/nl-BE/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/nl/mimetype b/extras/source/autocorr/lang/nl/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/nl/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/pl/mimetype b/extras/source/autocorr/lang/pl/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/pl/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/pt-BR/mimetype b/extras/source/autocorr/lang/pt-BR/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/pt-BR/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/pt-PT/mimetype b/extras/source/autocorr/lang/pt-PT/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/pt-PT/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/pt/mimetype b/extras/source/autocorr/lang/pt/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/pt/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ro/mimetype b/extras/source/autocorr/lang/ro/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ro/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/ru/mimetype b/extras/source/autocorr/lang/ru/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/ru/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sk/mimetype b/extras/source/autocorr/lang/sk/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sk/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sl/mimetype b/extras/source/autocorr/lang/sl/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sl/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-CS/mimetype b/extras/source/autocorr/lang/sr-CS/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-CS/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-Latn-CS/mimetype b/extras/source/autocorr/lang/sr-Latn-CS/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-Latn-CS/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-Latn-ME/mimetype b/extras/source/autocorr/lang/sr-Latn-ME/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-Latn-ME/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-Latn-RS/mimetype b/extras/source/autocorr/lang/sr-Latn-RS/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-Latn-RS/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-ME/mimetype b/extras/source/autocorr/lang/sr-ME/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-ME/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sr-RS/mimetype b/extras/source/autocorr/lang/sr-RS/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sr-RS/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/sv/mimetype b/extras/source/autocorr/lang/sv/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/sv/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/tr/mimetype b/extras/source/autocorr/lang/tr/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/tr/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/vi/mimetype b/extras/source/autocorr/lang/vi/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/vi/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/vro/mimetype b/extras/source/autocorr/lang/vro/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/vro/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/zh-CN/mimetype b/extras/source/autocorr/lang/zh-CN/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/zh-CN/mimetype +++ /dev/null diff --git a/extras/source/autocorr/lang/zh-TW/mimetype b/extras/source/autocorr/lang/zh-TW/mimetype deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/extras/source/autocorr/lang/zh-TW/mimetype +++ /dev/null |