|
| 1 | +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- |
| 2 | +# |
| 3 | +# This file is part of the LibreOffice project. |
| 4 | +# |
| 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/. |
| 8 | +# |
| 9 | + |
| 10 | +$(eval $(call gb_CustomTarget_CustomTarget,extras/source/templates)) |
| 11 | + |
| 12 | +# # for OTT templates: mimetype, styles.xml, META-INF/manifest.xml and |
| 13 | +# Thumbnails/thumbnail.png files are automatically added for each template |
| 14 | +# # for OTG templates: mimetype, content.xml, styles.xml, META-INF/manifest.xml and |
| 15 | +# Thumbnails/thumbnail.png files are automatically added for each template |
| 16 | +# list of meta.xml files (one per template) + other files (content.xml, manifest.rdf, settings.xml, pictures...) |
| 17 | +extras_TEMPLATES_XMLFILES := \ |
| 18 | + officorr/Modern_business_letter_sans_serif/meta.xml \ |
| 19 | + officorr/Modern_business_letter_serif/meta.xml \ |
| 20 | + offimisc/Businesscard-with-logo/meta.xml \ |
| 21 | + personal/CV/meta.xml \ |
| 22 | + personal/Resume1page/meta.xml \ |
| 23 | + styles/Default/meta.xml \ |
| 24 | + styles/Modern/meta.xml \ |
| 25 | + styles/Simple/meta.xml \ |
| 26 | + officorr/Modern_business_letter_sans_serif/content.xml \ |
| 27 | + officorr/Modern_business_letter_serif/content.xml \ |
| 28 | + offimisc/Businesscard-with-logo/content.xml \ |
| 29 | + personal/CV/content.xml \ |
| 30 | + personal/Resume1page/content.xml \ |
| 31 | + officorr/Modern_business_letter_sans_serif/manifest.rdf \ |
| 32 | + officorr/Modern_business_letter_serif/manifest.rdf \ |
| 33 | + offimisc/Businesscard-with-logo/manifest.rdf \ |
| 34 | + personal/CV/manifest.rdf \ |
| 35 | + personal/Resume1page/manifest.rdf \ |
| 36 | + offimisc/Businesscard-with-logo/settings.xml \ |
| 37 | + offimisc/Businesscard-with-logo/Pictures/10000201000001F4000000A0108F3F06.png \ |
| 38 | + draw/bpmn/meta.xml \ |
| 39 | + |
| 40 | +# param: style-base (e.g. Modern) |
| 41 | +extras_TEMPLATES_XMLFILES_RELATIVE = $(subst $(1)/,,$(filter $(1)/%,$(extras_TEMPLATES_XMLFILES))) |
| 42 | + |
| 43 | +.SECONDEXPANSION: |
| 44 | +# secondexpansion since the patterns not just cover a filename portion, but also include a |
| 45 | +# directory portion with different number of elements |
| 46 | +# copy regular files (mimetype, *.jpg, *.png, *.rdf, *.svg, *.svm, …) |
| 47 | +$(call gb_CustomTarget_get_workdir,extras/source/templates)/% : $(SRCDIR)/extras/source/templates/% \ |
| 48 | + | $$(dir $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*).dir |
| 49 | + $(call gb_Output_announce,templates/$*,$(true),CPY,1) |
| 50 | + $(call gb_Trace_StartRange,templates/$*,CPY) |
| 51 | + cp $< $@ |
| 52 | + $(call gb_Trace_EndRange,templates/$*,CPY) |
| 53 | + |
| 54 | +# test and copy xml files |
| 55 | +$(call gb_CustomTarget_get_workdir,extras/source/templates)/%.xml : $(SRCDIR)/extras/source/templates/%.xml \ |
| 56 | + | $(call gb_ExternalExecutable_get_dependencies,xsltproc) \ |
| 57 | + $$(dir $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*.xml).dir |
| 58 | + $(call gb_Output_announce,templates/$*.xml,$(true),XSL,1) |
| 59 | + $(call gb_Trace_StartRange,templates/$*.xml,XSL) |
| 60 | + $(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $< |
| 61 | + $(call gb_Trace_EndRange,templates/$*.xml,XSL) |
| 62 | + |
| 63 | +# zip files to OTT |
| 64 | +$(call gb_CustomTarget_get_workdir,extras/source/templates)/%.ott : \ |
| 65 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 66 | + mimetype $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 67 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 68 | + styles.xml $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 69 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 70 | + META-INF/manifest.xml $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 71 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 72 | + Thumbnails/thumbnail.png $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) |
| 73 | + $(call gb_Output_announce,templates/$*.ott,$(true),ZIP,2) |
| 74 | + $(call gb_Trace_StartRange,templates/$*.ott,ZIP) |
| 75 | + $(call gb_Helper_abbreviate_dirs,\ |
| 76 | + cd $(dir $<) && \ |
| 77 | + zip -q0X --filesync --must-match $@ mimetype && \ |
| 78 | + zip -qrX --must-match $@ styles.xml META-INF/manifest.xml Thumbnails/thumbnail.png && \ |
| 79 | + zip -qrX --must-match $@ $(call extras_TEMPLATES_XMLFILES_RELATIVE,$*) \ |
| 80 | + ) |
| 81 | + $(call gb_Trace_EndRange,templates/$*.ott,ZIP) |
| 82 | + |
| 83 | +# zip files to OTG |
| 84 | +$(call gb_CustomTarget_get_workdir,extras/source/templates)/%.otg : \ |
| 85 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 86 | + mimetype $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 87 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 88 | + content.xml $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 89 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 90 | + styles.xml $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 91 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 92 | + META-INF/manifest.xml $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) \ |
| 93 | + $$(addprefix $(call gb_CustomTarget_get_workdir,extras/source/templates)/$$*/,\ |
| 94 | + Thumbnails/thumbnail.png $$(call extras_TEMPLATES_XMLFILES_RELATIVE,$$*) ) |
| 95 | + $(call gb_Output_announce,templates/$*.otg,$(true),ZIP,2) |
| 96 | + $(call gb_Trace_StartRange,templates/$*.otg,ZIP) |
| 97 | + $(call gb_Helper_abbreviate_dirs,\ |
| 98 | + cd $(dir $<) && \ |
| 99 | + zip -q0X --filesync --must-match $@ mimetype && \ |
| 100 | + zip -qrX --must-match $@ content.xml styles.xml META-INF/manifest.xml Thumbnails/thumbnail.png && \ |
| 101 | + zip -qrX --must-match $@ $(call extras_TEMPLATES_XMLFILES_RELATIVE,$*) \ |
| 102 | + ) |
| 103 | + $(call gb_Trace_EndRange,templates/$*.otg,ZIP) |
| 104 | + |
| 105 | +# vim: set noet sw=4 ts=4: |
0 commit comments