tdf#118517: Use xStg before resetting it
[LibreOffice.git] / postprocess / CustomTarget_images.mk
blob0768ee973c5e658f5d5968ced4b7149abe316994
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 $(eval $(call gb_CustomTarget_CustomTarget,postprocess/images))
13 packimages_DIR := $(call gb_CustomTarget_get_workdir,postprocess/images)
15 $(eval $(call gb_CustomTarget_register_targets,postprocess/images,\
16 $(foreach theme,$(WITH_THEMES),images_$(theme).zip) \
17 commandimagelist.ilst \
18 sourceimagelist.ilst \
19 sorted.lst \
22 $(packimages_DIR)/images.zip : DEFAULT_THEME := $(true)
23 $(packimages_DIR)/images_%.zip : DEFAULT_THEME :=
24 $(packimages_DIR)/images_tango.zip : INDUSTRIAL_FALLBACK := -c $(SRCDIR)/icon-themes/industrial
25 $(packimages_DIR)/images%.zip : INDUSTRIAL_FALLBACK :=
27 $(packimages_DIR)/%.zip : \
28 $(packimages_DIR)/sorted.lst \
29 $(packimages_DIR)/commandimagelist.ilst \
30 $(packimages_DIR)/sourceimagelist.ilst \
31 $(SRCDIR)/wizards/source/imagelists/imagelists.ilst \
32 $(call gb_Helper_get_imagelists) \
33 | $(call gb_ExternalExecutable_get_dependencies,python)
34 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
35 $(call gb_Helper_abbreviate_dirs, \
36 ILSTFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,$(filter %.ilst,$^)) && \
37 $(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/solenv/bin/pack_images.py \
38 $(if $(DEFAULT_THEME),\
39 -g $(packimages_DIR) -m $(packimages_DIR) -c $(packimages_DIR),\
40 -g $(SRCDIR)/icon-themes/$(subst images_,,$*) -m $(SRCDIR)/icon-themes/$(subst images_,,$*) -c $(SRCDIR)/icon-themes/$(subst images_,,$*) \
41 ) \
42 $(INDUSTRIAL_FALLBACK) \
43 -l $${ILSTFILE} \
44 -s $< -o $@ \
45 $(if $(findstring s,$(MAKEFLAGS)),> /dev/null) && \
46 rm -rf $${ILSTFILE})
48 # turn the #defines foo "resource.png" of hlst into the final ilst format
49 $(packimages_DIR)/sourceimagelist.ilst : \
50 $(SRCDIR)/avmedia/inc/bitmaps.hlst \
51 $(SRCDIR)/basctl/inc/bitmaps.hlst \
52 $(SRCDIR)/connectivity/inc/bitmaps.hlst \
53 $(SRCDIR)/cui/inc/bitmaps.hlst \
54 $(SRCDIR)/chart2/inc/bitmaps.hlst \
55 $(SRCDIR)/dbaccess/inc/bitmaps.hlst \
56 $(SRCDIR)/desktop/inc/bitmaps.hlst \
57 $(SRCDIR)/extensions/inc/bitmaps.hlst \
58 $(SRCDIR)/formula/inc/bitmaps.hlst \
59 $(SRCDIR)/fpicker/inc/bitmaps.hlst \
60 $(SRCDIR)/framework/inc/bitmaps.hlst \
61 $(SRCDIR)/reportdesign/inc/bitmaps.hlst \
62 $(SRCDIR)/sc/inc/bitmaps.hlst \
63 $(SRCDIR)/sd/inc/bitmaps.hlst \
64 $(SRCDIR)/sdext/inc/bitmaps.hlst \
65 $(SRCDIR)/sfx2/inc/bitmaps.hlst \
66 $(SRCDIR)/svtools/inc/bitmaps.hlst \
67 $(SRCDIR)/svx/inc/bitmaps.hlst \
68 $(SRCDIR)/sw/inc/bitmaps.hlst \
69 $(SRCDIR)/vcl/inc/bitmaps.hlst \
70 $(SRCDIR)/xmlsecurity/inc/bitmaps.hlst
71 grep res $^ | cut -d'"' -f2 | sed "s/^/%MODULE%\//" | sed "s/%MODULE%.res/%GLOBALRES%/g" > $@
73 # commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
74 .PHONY : $(packimages_DIR)/commandimagelist.ilst $(packimages_DIR)/sorted.lst
76 $(packimages_DIR)/commandimagelist.ilst :
77 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
78 $(call gb_Helper_abbreviate_dirs, \
79 $(FIND) $(SRCDIR)/icon-themes -name "*.png" -o -name "*.svg" | \
80 grep -e '/cmd/' | sed 's#^.*/icon-themes/[^/]*##' | $(SORT) | uniq | \
81 sed "s#^#%MODULE%#" | \
82 LC_ALL=C $(SORT) > $@.tmp && \
83 $(call gb_Helper_replace_if_different_and_touch,$@.tmp,$@))
85 $(packimages_DIR)/sorted.lst : \
86 $(SRCDIR)/postprocess/packimages/image-sort.lst \
87 $(call gb_Postprocess_get_target,AllUIConfigs)
88 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
89 $(call gb_Helper_abbreviate_dirs, \
90 $(PERL) $(SRCDIR)/solenv/bin/image-sort.pl \
91 $< $(INSTROOT)/$(gb_UIConfig_INSTDIR) $@)
93 # vim: set noet sw=4 ts=4: