PageActions: make LoadLayout() static
[xcsoar.git] / build / resource.mk
blob6275d1504a5f91926e97f69ec8a1ae3c5f030c5c
1 include build/rsvg.mk
2 include build/imagemagick.mk
4 ####### market icons
6 SVG_MARKET_ICONS = Data/graphics/logo.svg Data/graphics/logo_red.svg
7 PNG_MARKET_ICONS = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_market.png,$(SVG_MARKET_ICONS))
9 market-icons: $(PNG_MARKET_ICONS)
10 $(eval $(call rsvg-convert,$(PNG_MARKET_ICONS),$(DATA)/graphics/%_market.png,Data/graphics/%.svg,--width=512))
12 ####### bitmaps
14 BMP_BITMAPS = $(wildcard Data/bitmaps/*.bmp)
15 PNG_BITMAPS = $(patsubst Data/bitmaps/%.bmp,$(DATA)/bitmaps/%.png,$(BMP_BITMAPS))
17 $(PNG_BITMAPS): $(DATA)/bitmaps/%.png: Data/bitmaps/%.bmp | $(DATA)/bitmaps/dirstamp
18 $(Q)$(IM_PREFIX)convert +dither -define png:color-type=0 $< $@
20 ####### icons
22 SVG_ICONS = $(wildcard Data/icons/*.svg)
23 SVG_NOALIAS_ICONS = $(patsubst Data/icons/%.svg,$(DATA)/icons/%.svg,$(SVG_ICONS))
24 PNG_ICONS = $(patsubst Data/icons/%.svg,$(DATA)/icons/%.png,$(SVG_ICONS))
25 BMP_ICONS = $(PNG_ICONS:.png=.bmp)
26 PNG_ICONS_160 = $(patsubst Data/icons/%.svg,$(DATA)/icons/%_160.png,$(SVG_ICONS))
27 BMP_ICONS_160 = $(PNG_ICONS_160:.png=.bmp)
29 # modify working copy of SVG to improve rendering
30 $(SVG_NOALIAS_ICONS): $(DATA)/icons/%.svg: build/svg_preprocess.xsl Data/icons/%.svg | $(DATA)/icons/dirstamp
31 @$(NQ)echo " XSLT $@"
32 $(Q)xsltproc --stringparam DisableAA_Select "MASK_NOAA_" --output $@ $^
34 # render from SVG to PNG
35 # Default 100PPI (eg 320x240 4" display)
36 $(eval $(call rsvg-convert,$(PNG_ICONS),$(DATA)/icons/%.png,$(DATA)/icons/%.svg,--x-zoom=1.0 --y-zoom=1.0))
38 #160PPI (eg 640x480 5" display)
39 $(eval $(call rsvg-convert,$(PNG_ICONS_160),$(DATA)/icons/%_160.png,$(DATA)/icons/%.svg,--x-zoom=1.6316 --y-zoom=1.6316))
41 # convert to uncompressed 8-bit BMP
42 $(eval $(call convert-to-bmp,$(BMP_ICONS) $(BMP_ICONS_160),%.bmp,%_tile.png))
44 ####### splash logo
46 SVG_SPLASH = Data/graphics/logo.svg Data/graphics/logo_red.svg
47 PNG_SPLASH_160 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_160.png,$(SVG_SPLASH))
48 BMP_SPLASH_160 = $(PNG_SPLASH_160:.png=.bmp)
49 PNG_SPLASH_80 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_80.png,$(SVG_SPLASH))
50 BMP_SPLASH_80 = $(PNG_SPLASH_80:.png=.bmp)
51 PNG_SPLASH_128 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_128.png,$(SVG_SPLASH))
52 ICNS_SPLASH_128 = $(PNG_SPLASH_128:.png=.icns)
54 # render from SVG to PNG
55 $(eval $(call rsvg-convert,$(PNG_SPLASH_160),$(DATA)/graphics/%_160.png,Data/graphics/%.svg,--width=160))
56 $(eval $(call rsvg-convert,$(PNG_SPLASH_80),$(DATA)/graphics/%_80.png,Data/graphics/%.svg,--width=80))
57 $(eval $(call rsvg-convert,$(PNG_SPLASH_128),$(DATA)/graphics/%_128.png,Data/graphics/%.svg,--width=128))
59 # convert to uncompressed 8-bit BMP
60 $(eval $(call convert-to-bmp-white,$(BMP_SPLASH_160) $(BMP_SPLASH_80),%.bmp,%.png))
62 # convert to icns (mac os x icon)
63 $(ICNS_SPLASH_128): %.icns: %.png
64 @$(NQ)echo " ICNS $@"
65 $(Q)$(IM_PREFIX)png2icns $@ $<
67 ####### version
69 SVG_TITLE = Data/graphics/title.svg Data/graphics/title_red.svg
70 PNG_TITLE_110 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_110.png,$(SVG_TITLE))
71 BMP_TITLE_110 = $(PNG_TITLE_110:.png=.bmp)
72 PNG_TITLE_320 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_320.png,$(SVG_TITLE))
73 BMP_TITLE_320 = $(PNG_TITLE_320:.png=.bmp)
75 # render from SVG to PNG
76 $(eval $(call rsvg-convert,$(PNG_TITLE_110),$(DATA)/graphics/%_110.png,Data/graphics/%.svg,--width=110))
77 $(eval $(call rsvg-convert,$(PNG_TITLE_320),$(DATA)/graphics/%_320.png,Data/graphics/%.svg,--width=320))
79 # convert to uncompressed 8-bit BMP
80 $(eval $(call convert-to-bmp-white,$(BMP_TITLE_110) $(BMP_TITLE_320),%.bmp,%.png))
82 ####### dialog title
84 SVG_DIALOG_TITLE = Data/graphics/dialog_title.svg Data/graphics/dialog_title_red.svg
85 PNG_DIALOG_TITLE = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%.png,$(SVG_DIALOG_TITLE))
86 BMP_DIALOG_TITLE = $(PNG_DIALOG_TITLE:.png=.bmp)
88 # render from SVG to PNG
89 $(eval $(call rsvg-convert,$(PNG_DIALOG_TITLE),$(DATA)/graphics/%.png,Data/graphics/%.svg,))
91 # convert to uncompressed 8-bit BMP
92 $(eval $(call convert-to-bmp-white,$(BMP_DIALOG_TITLE),%.bmp,%.png))
94 ####### progress bar border
96 SVG_PROGRESS_BORDER = Data/graphics/progress_border.svg Data/graphics/progress_border_red.svg
97 PNG_PROGRESS_BORDER = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%.png,$(SVG_PROGRESS_BORDER))
98 BMP_PROGRESS_BORDER = $(PNG_PROGRESS_BORDER:.png=.bmp)
100 # render from SVG to PNG
101 $(eval $(call rsvg-convert,$(PNG_PROGRESS_BORDER),$(DATA)/graphics/%.png,Data/graphics/%.svg,))
103 # convert to uncompressed 8-bit BMP
104 $(eval $(call convert-to-bmp-white,$(BMP_PROGRESS_BORDER),%.bmp,%.png))
106 ####### launcher graphics
108 SVG_LAUNCH = Data/graphics/launcher.svg Data/graphics/launcher_red.svg
109 PNG_LAUNCH_224 = $(patsubst Data/graphics/%.svg,$(DATA)/graphics/%_224.png,$(SVG_LAUNCH))
110 BMP_LAUNCH_FLY_224 = $(PNG_LAUNCH_224:.png=_1.bmp)
111 BMP_LAUNCH_SIM_224 = $(PNG_LAUNCH_224:.png=_2.bmp)
112 BMP_LAUNCH_DLL_FLY_224 = $(PNG_LAUNCH_224:.png=_dll_1.bmp)
113 BMP_LAUNCH_DLL_SIM_224 = $(PNG_LAUNCH_224:.png=_dll_2.bmp)
115 BMP_LAUNCH_ALL = $(BMP_LAUNCH_FLY_224) $(BMP_LAUNCH_SIM_224)
116 ifeq ($(HAVE_WIN32),y)
117 BMP_LAUNCH_ALL += $(BMP_LAUNCH_DLL_FLY_224) $(BMP_LAUNCH_DLL_SIM_224)
118 endif
120 # render from SVG to PNG
121 $(eval $(call rsvg-convert,$(PNG_LAUNCH_224),$(DATA)/graphics/%_224.png,Data/graphics/%.svg,--width=224))
123 # split into two uncompressed 8-bit BMPs (single 'convert' operation)
124 $(eval $(call convert-to-bmp-half,$(BMP_LAUNCH_FLY_224),%_1.bmp,%.png,-background white))
125 $(eval $(call convert-to-bmp-half,$(BMP_LAUNCH_SIM_224),%_2.bmp,%.png,-background white))
127 # split into two uncompressed 8-bit BMPs (single 'convert' operation)
128 $(eval $(call convert-to-bmp-half,$(BMP_LAUNCH_DLL_FLY_224),%_dll_1.bmp,%.png,-background blue))
129 $(eval $(call convert-to-bmp-half,$(BMP_LAUNCH_DLL_SIM_224),%_dll_2.bmp,%.png,-background blue))
131 # back to PNG
133 PNG_LAUNCH_ALL = $(patsubst %.bmp,%.png,$(BMP_LAUNCH_ALL))
134 $(PNG_LAUNCH_ALL): %.png: %.bmp
135 $(Q)$(IM_PREFIX)convert $< $@
137 #######
139 DIALOG_FILES = $(wildcard Data/Dialogs/*.xml)
140 DIALOG_FILES += $(wildcard Data/Dialogs/Infobox/*.xml)
141 DIALOG_FILES += $(wildcard Data/Dialogs/Configuration/*.xml)
143 DIALOG_COMPRESSED = $(patsubst Data/Dialogs/%.xml,$(DATA)/dialogs/%.xml.gz,$(DIALOG_FILES))
144 $(DIALOG_COMPRESSED): $(DATA)/dialogs/%.xml.gz: Data/Dialogs/%.xml \
145 | $(DATA)/dialogs/Configuration/dirstamp $(DATA)/dialogs/Infobox/dirstamp
146 @$(NQ)echo " GZIP $@"
147 $(Q)gzip --best <$< >$@.tmp
148 $(Q)mv $@.tmp $@
150 TEXT_FILES = AUTHORS COPYING
152 TEXT_COMPRESSED = $(patsubst %,$(DATA)/%.gz,$(TEXT_FILES))
153 $(TEXT_COMPRESSED): $(DATA)/%.gz: % | $(DATA)/dirstamp
154 @$(NQ)echo " GZIP $@"
155 $(Q)gzip --best <$< >$@.tmp
156 $(Q)mv $@.tmp $@
158 RESOURCE_FILES = $(DIALOG_COMPRESSED) $(TEXT_COMPRESSED)
160 ifeq ($(TARGET),ANDROID)
161 RESOURCE_FILES += $(patsubst po/%.po,$(OUT)/po/%.mo,$(wildcard po/*.po))
162 else
164 ifeq ($(HAVE_WIN32),y)
165 RESOURCE_FILES += $(BMP_BITMAPS)
166 else
167 RESOURCE_FILES += $(PNG_BITMAPS)
168 endif
170 RESOURCE_FILES += $(BMP_ICONS) $(BMP_ICONS_160)
171 RESOURCE_FILES += $(BMP_SPLASH_160) $(BMP_SPLASH_80)
172 RESOURCE_FILES += $(BMP_DIALOG_TITLE) $(BMP_PROGRESS_BORDER)
173 RESOURCE_FILES += $(BMP_TITLE_320) $(BMP_TITLE_110)
174 RESOURCE_FILES += $(BMP_LAUNCH_ALL)
176 ifeq ($(HAVE_WIN32),n)
178 $(patsubst $(DATA)/icons/%.bmp,$(DATA)/icons2/%.png,$(filter $(DATA)/icons/%.bmp,$(RESOURCE_FILES))): $(DATA)/icons2/%.png: $(DATA)/icons/%.bmp | $(DATA)/icons2/dirstamp
179 $(Q)$(IM_PREFIX)convert $< $@
181 $(patsubst $(DATA)/graphics/%.bmp,$(DATA)/graphics2/%.png,$(filter $(DATA)/graphics/%.bmp,$(RESOURCE_FILES))): $(DATA)/graphics2/%.png: $(DATA)/graphics/%.bmp | $(DATA)/graphics2/dirstamp
182 $(Q)$(IM_PREFIX)convert $< $@
184 RESOURCE_FILES := $(patsubst $(DATA)/graphics/%.bmp,$(DATA)/graphics2/%.png,$(RESOURCE_FILES))
185 RESOURCE_FILES := $(patsubst $(DATA)/icons/%.bmp,$(DATA)/icons2/%.png,$(RESOURCE_FILES))
186 RESOURCE_FILES := $(patsubst %.bmp,%.png,$(RESOURCE_FILES))
187 endif
189 endif
191 ifeq ($(HAVE_WIN32),y)
193 RESOURCE_TEXT = Data/XCSoar.rc
194 RESOURCE_BINARY = $(TARGET_OUTPUT_DIR)/$(notdir $(RESOURCE_TEXT:.rc=.rsc))
195 RESOURCE_FILES += $(patsubst po/%.po,$(OUT)/po/%.mo,$(wildcard po/*.po))
197 $(RESOURCE_BINARY): $(RESOURCE_TEXT) $(RESOURCE_FILES) | $(TARGET_OUTPUT_DIR)/%/../dirstamp
198 @$(NQ)echo " WINDRES $@"
199 $(Q)$(WINDRES) $(WINDRESFLAGS) -o $@ $<
201 else
203 # no resources on UNIX
204 RESOURCE_BINARY =
206 endif