Simplify this a bit
[LibreOffice.git] / extras / CustomTarget_tpl_styles.mk
blob6f1cce959d62ac154354d6b3f2fe60efdfe48752
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,extras/source/templates/styles))
12 extras_STYLES_XMLFILES := \
13 Default/META-INF/manifest.xml \
14 Default/meta.xml \
15 Default/styles.xml \
16 Default/Thumbnails/thumbnail.png \
17 Modern/META-INF/manifest.xml \
18 Modern/meta.xml \
19 Modern/styles.xml \
20 Modern/Thumbnails/thumbnail.png \
21 Simple/META-INF/manifest.xml \
22 Simple/meta.xml \
23 Simple/styles.xml \
24 Simple/Thumbnails/thumbnail.png \
26 # param: style-base (e.g. Modern)
27 extras_STYLES_XMLFILES_RELATIVE = $(subst $(1)/,,$(filter $(1)/%,$(extras_STYLES_XMLFILES)))
29 .SECONDEXPANSION:
30 # secondexpansion since the patterns not just cover a filename portion, but also include a
31 # directory portion withdifferent number of elements
32 # copy regular files (mimetype, *.jpg, *.png, *.rdf, *.svg, *.svm, …)
33 $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/% : $(SRCDIR)/extras/source/templates/styles/% \
34 | $$(dir $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/$$*).dir
35 $(call gb_Output_announce,templates/styles/$*,$(true),CPY,1)
36 $(call gb_Trace_StartRange,templates/styles/$*,CPY)
37 cp $< $@
38 $(call gb_Trace_EndRange,templates/styles/$*,CPY)
40 $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/%.xml : $(SRCDIR)/extras/source/templates/styles/%.xml \
41 | $(call gb_ExternalExecutable_get_dependencies,xsltproc) \
42 $$(dir $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/$$*.xml).dir
43 $(call gb_Output_announce,templates/styles/$*.xml,$(true),XSL,1)
44 $(call gb_Trace_StartRange,templates/styles/$*.xml,XSL)
45 $(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
46 $(call gb_Trace_EndRange,templates/styles/$*.xml,XSL)
48 $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/%.ott : \
49 $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates/styles)/$$*/,\
50 mimetype $$(call extras_STYLES_XMLFILES_RELATIVE,$$*))
51 $(call gb_Output_announce,templates/styles/$*.ott,$(true),ZIP,2)
52 $(call gb_Trace_StartRange,templates/styles/$*.ott,ZIP)
53 $(call gb_Helper_abbreviate_dirs,\
54 cd $(dir $<) && \
55 zip -q0X --filesync --must-match $@ mimetype && \
56 zip -qrX --must-match $@ $(call extras_STYLES_XMLFILES_RELATIVE,$*) \
58 $(call gb_Trace_EndRange,templates/styles/$*.ott,ZIP)
60 # vim: set noet sw=4 ts=4: