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 $(foreach theme
,$(WITH_THEMES
),$(theme
)_links.txt
) \
18 commandimagelist.ilst \
19 sourceimagelist.ilst \
23 $(packimages_DIR
)/images.zip
: DEFAULT_THEME
:= $(true
)
24 $(packimages_DIR
)/images_
%.zip
: DEFAULT_THEME
:=
26 # tdf#124023 make links.txt depend on phony sorted.lst depend
27 # so this is evaluated every time
28 $(packimages_DIR
)/%_links.txt
: $(packimages_DIR
)/sorted.lst
29 @if
test -f
"$(SRCDIR)/icon-themes/$*/links.txt"; then \
30 cp
"$(SRCDIR)/icon-themes/$*/links.txt" $@.tmp
; \
32 THEME_FILE
="$(SRCDIR)/icon-themes/$(subst _svg,,$*)/links.txt" ; \
33 if
test -f
"$${THEME_FILE}"; then \
34 sed
's/\.png/\.svg/g' "$${THEME_FILE}" > $@.tmp
; \
36 THEME_FILE
="$(SRCDIR)/icon-themes/$(subst _dark,,$*)/links.txt" ; \
37 if
test -f
"$${THEME_FILE}"; then \
38 cp
"$${THEME_FILE}" $@.tmp
; \
41 $(call gb_Helper_replace_if_different_and_touch
,$@.tmp
,$@
)
43 $(packimages_DIR
)/images_
%.zip
: \
44 $(packimages_DIR
)/sorted.lst \
45 $(packimages_DIR
)/commandimagelist.ilst \
46 $(packimages_DIR
)/sourceimagelist.ilst \
47 $(SRCDIR
)/wizards
/source
/imagelists
/imagelists.ilst \
48 $(packimages_DIR
)/%_links.txt \
49 $(call gb_Helper_get_imagelists
) \
50 |
$(call gb_ExternalExecutable_get_dependencies
,python
)
51 $(call gb_Output_announce
,$(subst $(WORKDIR
)/,,$@
),$(true
),PRL
,2)
52 $(call gb_Trace_StartRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
53 $(call gb_Helper_abbreviate_dirs
, \
54 ILSTFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(filter %.ilst
,$^
)) && \
55 $(call gb_ExternalExecutable_get_command
,python
) \
56 $(SRCDIR
)/solenv
/bin
/pack_images.py \
57 $(if
$(DEFAULT_THEME
),\
58 -g
$(packimages_DIR
) -m
$(packimages_DIR
) -c
$(packimages_DIR
),\
59 -g
$(SRCDIR
)/icon-themes
/$* -m
$(SRCDIR
)/icon-themes
/$* -c
$(SRCDIR
)/icon-themes
/$* \
62 -L
$(packimages_DIR
)/$*_links.txt \
64 $(if
$(findstring s
,$(MAKEFLAGS
)),> /dev
/null
) && \
66 $(call gb_Trace_EndRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
68 # turn the #defines foo "resource.png" of hlst into the final ilst format
69 $(packimages_DIR
)/sourceimagelist.ilst
: \
70 $(SRCDIR
)/avmedia
/inc
/bitmaps.hlst \
71 $(SRCDIR
)/basctl
/inc
/bitmaps.hlst \
72 $(SRCDIR
)/connectivity
/inc
/bitmaps.hlst \
73 $(SRCDIR
)/cui
/inc
/bitmaps.hlst \
74 $(SRCDIR
)/chart2
/inc
/bitmaps.hlst \
75 $(SRCDIR
)/dbaccess
/inc
/bitmaps.hlst \
76 $(SRCDIR
)/desktop
/inc
/bitmaps.hlst \
77 $(SRCDIR
)/extensions
/inc
/bitmaps.hlst \
78 $(SRCDIR
)/formula
/inc
/bitmaps.hlst \
79 $(SRCDIR
)/fpicker
/inc
/bitmaps.hlst \
80 $(SRCDIR
)/framework
/inc
/bitmaps.hlst \
81 $(SRCDIR
)/reportdesign
/inc
/bitmaps.hlst \
82 $(SRCDIR
)/sc
/inc
/bitmaps.hlst \
83 $(SRCDIR
)/sd
/inc
/bitmaps.hlst \
84 $(SRCDIR
)/sdext
/inc
/bitmaps.hlst \
85 $(SRCDIR
)/sfx2
/inc
/bitmaps.hlst \
86 $(SRCDIR
)/svtools
/inc
/bitmaps.hlst \
87 $(SRCDIR
)/svx
/inc
/bitmaps.hlst \
88 $(SRCDIR
)/sw
/inc
/bitmaps.hlst \
89 $(SRCDIR
)/vcl
/inc
/bitmaps.hlst \
90 $(SRCDIR
)/xmlsecurity
/inc
/bitmaps.hlst
91 grep res
$^ | cut
-d
'"' -f2 | sed
"s/^/%MODULE%\//" | sed
"s/%MODULE%.res/%GLOBALRES%/g" > $@.png
92 sed
's/\.png/\.svg/g' $@.png
> $@.svg
93 cat
$@.png
$@.svg
> $@
95 # commandimagelist.ilst and sorted.lst are phony to rebuild everything each time
96 .PHONY
: $(packimages_DIR
)/commandimagelist.ilst
$(packimages_DIR
)/sorted.lst
98 $(packimages_DIR
)/commandimagelist.ilst
:
99 $(call gb_Output_announce
,$(subst $(WORKDIR
)/,,$@
),$(true
),PRL
,1)
100 $(call gb_Trace_StartRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
101 $(call gb_Helper_abbreviate_dirs
, \
102 $(FIND
) $(SRCDIR
)/icon-themes
-name
"*.png" -o
-name
"*.svg" | \
103 grep
-e
'/cmd/' | sed
's#^.*/icon-themes/[^/]*##' | \
104 sed
"s#^#%MODULE%#" | \
105 LC_ALL
=C
$(SORT
) -u
> $@.tmp
&& \
106 $(call gb_Helper_replace_if_different_and_touch
,$@.tmp
,$@
))
107 $(call gb_Trace_EndRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
109 $(packimages_DIR
)/sorted.lst
: \
110 $(SRCDIR
)/postprocess
/packimages
/image-sort.lst \
111 $(call gb_Postprocess_get_target
,AllUIConfigs
) \
112 $(call gb_ExternalExecutable_get_dependencies
,python
)
113 $(call gb_Output_announce
,$(subst $(WORKDIR
)/,,$@
),$(true
),PRL
,1)
114 $(call gb_Trace_StartRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
115 $(call gb_Helper_abbreviate_dirs
, \
116 $(call gb_ExternalExecutable_get_command
,python
) \
117 $(SRCDIR
)/solenv
/bin
/image-sort.py \
118 $(if
$(filter build
,$(gb_Side
)),--quiet
) \
119 $< $(INSTROOT
)/$(gb_UIConfig_INSTDIR
) $@
)
120 $(call gb_Trace_EndRange
,$(subst $(WORKDIR
)/,,$@
),PRL
)
122 # vim: set noet sw=4 ts=4: