Update git submodules
[LibreOffice.git] / readlicense_oo / CustomTarget_readme.mk
blobbb3b41e768a87fb3eb09aad31517edd7f1aa2dea
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 $(eval $(call gb_CustomTarget_CustomTarget,readlicense_oo/readme))
12 readlicense_oo_DIR := $(call gb_CustomTarget_get_workdir,readlicense_oo/readme)
14 # gb_WITH_LANG is empty if --with-lang is not set
15 # what we need here is: gb_WITH_LANG_OR_DEFAULT ;-)
16 readlicense_oo_LANGS := en-US $(filter-out en-US,$(gb_WITH_LANG))
18 $(call gb_CustomTarget_get_target,readlicense_oo/readme) : \
19 $(foreach lang,$(readlicense_oo_LANGS),$(readlicense_oo_DIR)/$(call gb_README,$(lang)))
21 ifeq ($(strip $(gb_WITH_LANG)),)
22 readlicense_oo_README_XRM := $(SRCDIR)/readlicense_oo/docs/readme.xrm
23 else
24 readlicense_oo_README_XRM := $(readlicense_oo_DIR)/readme.xrm
26 $(readlicense_oo_DIR)/readme.xrm : \
27 $(SRCDIR)/readlicense_oo/docs/readme.xrm \
28 $(call gb_Executable_get_runtime_dependencies,xrmex) \
29 $(foreach lang,$(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG))),$(gb_POLOCATION)/$(lang)/readlicense_oo/docs.po) \
30 | $(readlicense_oo_DIR)/.dir
31 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XRM,1)
32 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),XRM)
33 $(call gb_Helper_abbreviate_dirs, \
34 MERGEINPUT=`$(gb_MKTEMP)` && \
35 echo $(foreach lang,$(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG))),$(gb_POLOCATION)/$(lang)/readlicense_oo/docs.po) > $${MERGEINPUT} && \
36 $(call gb_Executable_get_command,xrmex) \
37 -i $< \
38 -o $@ \
39 -m $${MERGEINPUT} \
40 -l all && \
41 rm -rf $${MERGEINPUT})
42 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),XRM)
44 endif
46 readlicense_oo_README_SED := \
47 -e 's,$${PRODUCTNAME},$(PRODUCTNAME),g' \
48 -e 's,$${PRODUCTVERSION},$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR),g' \
50 $(readlicense_oo_DIR)/$(call gb_README,%) : \
51 $(SRCDIR)/readlicense_oo/docs/readme.xsl \
52 $(readlicense_oo_README_XRM) \
53 | $(readlicense_oo_DIR)/.dir \
54 $(call gb_ExternalExecutable_get_dependencies,xsltproc)
55 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1)
56 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),XSL)
57 $(call gb_Helper_abbreviate_dirs, \
58 $(call gb_ExternalExecutable_get_command,xsltproc) --nonet --novalid -o $@.out \
59 --stringparam com1 $(COM) \
60 --stringparam cp1 $(CPUNAME) \
61 --stringparam lang1 $(word 2,$(subst _, ,$(basename $(notdir $@)))) \
62 --stringparam os1 $(OS) \
63 --stringparam type text \
64 $< \
65 $(readlicense_oo_README_XRM) \
66 $(if $(filter WNT,$(OS)), \
67 && $(gb_AWK) 'sub("$$","\r")' $@.out > $@.tmp \
68 && mv $@.tmp $@.out \
69 ) \
70 && sed $(readlicense_oo_README_SED) $@.out > $@ \
71 && rm $@.out \
73 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),XSL)
75 # vim:set shiftwidth=4 tabstop=4 noexpandtab: