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