1# This file is part of MATE Utils.
2#
3# MATE Utils is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# MATE Utils is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.
15
16NULL =
17
18public_icons_themes = \
19	hicolor	\
20	$(NULL)
21
22png_icons = \
23        hicolor_apps_16x16_mate-system-log.png \
24        hicolor_apps_22x22_mate-system-log.png \
25        hicolor_apps_24x24_mate-system-log.png \
26        hicolor_apps_32x32_mate-system-log.png \
27        hicolor_apps_48x48_mate-system-log.png \
28        hicolor_apps_256x256_mate-system-log.png \
29	$(NULL)
30
31public_icons = \
32	$(png_icons) \
33	hicolor_apps_scalable_mate-system-log-symbolic.svg \
34	$(NULL)
35
36if HAVE_INKSCAPE
37hicolor_apps_16x16_mate-system-log.png: logview.svg
38	$(if $(wildcard $(INKSCAPE)), \
39		$(info $(shell $(INKSCAPE) -z $^ --export-area=303:65:319:81 -w=16 -h=16 -e=$@)), \
40		$(error could not locate inkscape) \
41	)
42
43hicolor_apps_22x22_mate-system-log.png: logview.svg
44	$(if $(wildcard $(INKSCAPE)), \
45		$(info $(shell $(INKSCAPE) -z $^ --export-area=303:101:325:123 -w=22 -h=22 -e=$@)), \
46		$(error could not locate inkscape) \
47	)
48
49hicolor_apps_24x24_mate-system-log.png: logview.svg
50	$(if $(wildcard $(INKSCAPE)), \
51		$(info $(shell $(INKSCAPE) -z $^ --export-area=302:100:326:124 -w=24 -h=24 -e=$@)), \
52		$(error could not locate inkscape) \
53	)
54
55hicolor_apps_32x32_mate-system-log.png: logview.svg
56	$(if $(wildcard $(INKSCAPE)), \
57		$(info $(shell $(INKSCAPE) -z $^ --export-area=304:142:336:174 -w=32 -h=32 -e=$@)), \
58		$(error could not locate inkscape) \
59	)
60
61hicolor_apps_48x48_mate-system-log.png: logview.svg
62	$(if $(wildcard $(INKSCAPE)), \
63		$(info $(shell $(INKSCAPE) -z $^ --export-area=296:202:344:250 -w=48 -h=48 -e=$@)), \
64		$(error could not locate inkscape) \
65	)
66
67hicolor_apps_256x256_mate-system-log.png: logview.svg
68	$(if $(wildcard $(INKSCAPE)), \
69		$(info $(shell $(INKSCAPE) -z $^ --export-area=33:11:289:267 -w=256 -h=256 -e=$@)), \
70		$(error could not locate inkscape) \
71	)
72endif
73
74noinst_DATA = \
75	logview.svg \
76	$(NULL)
77
78EXTRA_DIST = \
79	$(public_icons)		\
80	$(noinst_DATA)		\
81	$(NULL)
82
83###############################################################################
84
85install-icons: | $(public_icons)
86	for icon in $(public_icons); do \
87		THEME=`echo $$icon | cut -d_ -f1`; \
88		CONTEXT=`echo $$icon | cut -d_ -f2`; \
89		SIZE=`echo $$icon | cut -d_ -f3`; \
90		ICONFILE=`echo $$icon | cut -d_ -f4`; \
91		mkdir -p $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT; \
92		$(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \
93	done
94
95uninstall-icons:
96	-for icon in $(public_icons); do \
97		THEME=`echo $$icon | cut -d_ -f1`; \
98		CONTEXT=`echo $$icon | cut -d_ -f2`; \
99		SIZE=`echo $$icon | cut -d_ -f3`; \
100		ICONFILE=`echo $$icon | cut -d_ -f4`; \
101		rm -f $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \
102	done
103
104install-data-local: install-icons
105
106uninstall-local: uninstall-icons
107
108gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
109
110install-data-hook: update-icon-cache
111uninstall-hook: update-icon-cache
112update-icon-cache:
113	@-if test -z "$(DESTDIR)"; then \
114		echo "Updating Gtk icon cache."; \
115		$(gtk_update_icon_cache); \
116	else \
117		echo "*** Icon cache not updated.  After (un)install, run this:"; \
118		echo "***   $(gtk_update_icon_cache)"; \
119	fi
120
121.PHONY: build-png-icons clean-png-icons
122build-png-icons: | $(png_icons)
123
124clean-png-icons:
125	rm -f $(png_icons)
126
127-include $(top_srcdir)/git.mk
128