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/personal))
11
12extras_TEMPLATES_PERSONAL := \
13	CV \
14	Resume1page \
15
16
17extras_PERSONAL_XMLFILES := \
18	CV/content.xml \
19	CV/manifest.rdf \
20	CV/META-INF/manifest.xml \
21	CV/meta.xml \
22	CV/styles.xml \
23	CV/Thumbnails/thumbnail.png \
24	Resume1page/content.xml \
25	Resume1page/manifest.rdf \
26	Resume1page/META-INF/manifest.xml \
27	Resume1page/meta.xml \
28	Resume1page/styles.xml \
29	Resume1page/Thumbnails/thumbnail.png \
30
31
32extras_PERSONAL_MIMETYPEFILES := $(foreach atexts,$(extras_TEMPLATES_PERSONAL),$(atexts)/mimetype)
33
34
35$(call gb_CustomTarget_get_target,extras/source/templates/personal) : \
36	$(foreach atexts,$(extras_TEMPLATES_PERSONAL),$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/$(atexts).ott)
37
38$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%/mimetype : $(SRCDIR)/extras/source/templates/personal/%/mimetype
39	$(call gb_Output_announce,templates/personal/$*/mimetype,$(true),CPY,1)
40	cp $< $@
41
42$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.jpg : $(SRCDIR)/extras/source/templates/personal/%.jpg
43	$(call gb_Output_announce,templates/personal/$*.jpg,$(true),CPY,1)
44	cp $< $@
45
46$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.png : $(SRCDIR)/extras/source/templates/personal/%.png
47	$(call gb_Output_announce,templates/personal/$*.png,$(true),CPY,1)
48	cp $< $@
49
50$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.rdf : $(SRCDIR)/extras/source/templates/personal/%.rdf
51	$(call gb_Output_announce,templates/personal/$*.rdf,$(true),CPY,1)
52	cp $< $@
53
54$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.svg : $(SRCDIR)/extras/source/templates/personal/%.svg
55	$(call gb_Output_announce,templates/personal/$*.svg,$(true),CPY,1)
56	cp $< $@
57
58$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.svm : $(SRCDIR)/extras/source/templates/personal/%.svm
59	$(call gb_Output_announce,templates/personal/$*.svm,$(true),CPY,1)
60	cp $< $@
61
62$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.xml : $(SRCDIR)/extras/source/templates/personal/%.xml \
63		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
64	$(call gb_Output_announce,templates/personal/$*.xml,$(true),XSL,1)
65	$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
66
67$(call gb_CustomTarget_get_workdir,extras/source/templates/personal)/%.ott :
68	$(call gb_Output_announce,templates/personal/$*.ott,$(true),ZIP,2)
69	$(call gb_Helper_abbreviate_dirs,\
70		cd $(EXTRAS_PERSONAL_DIR) && \
71		zip -q0X --filesync --must-match $@ $(EXTRAS_PERSONAL_MIMEFILES_FILTER) && \
72		zip -qrX --must-match $@ $(EXTRAS_PERSONAL_XMLFILES_FILTER) \
73	)
74
75define extras_Tplpersonal_make_file_deps
76$(call gb_CustomTarget_get_workdir,$(1))/$(2) : $(SRCDIR)/$(1)/$(2) \
77	| $(dir $(call gb_CustomTarget_get_workdir,$(1))/$(2)).dir
78
79endef
80
81define extras_Tplpersonal_make_zip_deps
82$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \
83	$(addprefix $(call gb_CustomTarget_get_workdir,$(1))/,$(filter $(3)/%,$(extras_PERSONAL_MIMETYPEFILES) $(extras_PERSONAL_XMLFILES))) \
84	| $(dir $(call gb_CustomTarget_get_workdir,$(1))/$(2)).dir
85
86$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \
87	EXTRAS_PERSONAL_MIMEFILES_FILTER := $(foreach file,$(filter $(3)/%,$(extras_PERSONAL_MIMETYPEFILES)),$(subst $(3)/,,$(file)))
88$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \
89	EXTRAS_PERSONAL_XMLFILES_FILTER := $(foreach file,$(filter $(3)/%,$(extras_PERSONAL_XMLFILES)),$(subst $(3)/,,$(file)))
90$(call gb_CustomTarget_get_workdir,$(1))/$(2) : \
91	EXTRAS_PERSONAL_DIR := $(call gb_CustomTarget_get_workdir,$(1))/$(3)
92
93endef
94
95$(eval $(foreach file,$(extras_PERSONAL_MIMETYPEFILES) $(extras_PERSONAL_XMLFILES),\
96	$(call extras_Tplpersonal_make_file_deps,extras/source/templates/personal,$(file)) \
97))
98
99$(eval $(foreach atexts,$(extras_TEMPLATES_PERSONAL),\
100	$(call extras_Tplpersonal_make_zip_deps,extras/source/templates/personal,$(atexts).ott,$(atexts)) \
101))
102
103# vim: set noet sw=4 ts=4:
104