Smake: added 16x16, 32x32 and 256x256 pspp.png icons
[pspp] / Smake
1 # -*- makefile -*-
2
3 # PSPP - a program for statistical analysis.
4 # Copyright (C) 2017 Free Software Foundation, Inc.
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20
21 all: everything
22
23 # Adjust these to reflect where you've installed gnulib.
24 GNULIB = ../gnulib
25 GNULIB_TOOL = $(GNULIB)/gnulib-tool
26
27 GNULIB_MODULES = \
28         assert \
29         byteswap \
30         c-snprintf \
31         c-strcase \
32         c-strcasestr \
33         c-ctype \
34         c-strtod \
35         c-xvasprintf \
36         clean-temp \
37         close \
38         configmake \
39         count-one-bits \
40         count-leading-zeros \
41         crc \
42         crypto/md4 \
43         crypto/rijndael \
44         dirname \
45         dtoastr \
46         environ \
47         fatal-signal \
48         fcntl \
49         fpieee \
50         fprintf-posix \
51         full-read \
52         full-write \
53         fseeko \
54         ftello \
55         fwriteerror \
56         getline \
57         getpass \
58         gettext \
59         gettimeofday \
60         getopt-gnu \
61         gitlog-to-changelog \
62         include_next \
63         isfinite \
64         isinf \
65         isnan \
66         intprops \
67         inttostr \
68         localcharset \
69         mbchar \
70         mbiter \
71         memcasecmp \
72         memchr \
73         memchr2 \
74         memmem \
75         mempcpy \
76         memrchr \
77         minmax \
78         mkdtemp \
79         mkstemp \
80         pipe2 \
81         printf-posix \
82         printf-safe \
83         progname \
84         rawmemchr \
85         read-file \
86         regex \
87         relocatable-prog \
88         rename \
89         round \
90         select \
91         snprintf \
92         snprintf-posix \
93         sprintf-posix \
94         stdarg \
95         stdbool \
96         stdint \
97         strcasestr \
98         stpcpy \
99         strerror \
100         strftime \
101         strsep \
102         strtod \
103         strtok_r \
104         sys_stat \
105         tempname \
106         termios \
107         trunc \
108         unicase/u8-casecmp \
109         unicase/u8-casefold \
110         unicase/u8-tolower \
111         unicase/u8-toupper \
112         unicase/u8-totitle \
113         unictype/ctype-print \
114         unictype/category-of \
115         unigbrk/uc-is-grapheme-break \
116         unilbrk/u8-possible-linebreaks \
117         uninorm/nfkd \
118         unistd \
119         unistr/u8-check \
120         unistr/u8-cpy \
121         unistr/u8-mblen \
122         unistr/u8-mbtouc \
123         unistr/u8-mbtoucr \
124         unistr/u8-strlen \
125         unistr/u8-strmbtouc \
126         unistr/u8-strncat \
127         unistr/u8-uctomb \
128         uniwidth/u8-strwidth \
129         unitypes \
130         unlocked-io \
131         vasprintf-posix \
132         version-etc \
133         version-etc-fsf \
134         vfprintf-posix \
135         vprintf-posix \
136         vsnprintf \
137         vsnprintf-posix \
138         vsprintf-posix \
139         xalloc \
140         xalloc-die \
141         xmalloca \
142         xmemdup0 \
143         xsize \
144         xstrndup \
145         xvasprintf
146
147 APP_ICONS = \
148 src/ui/gui/icons/16x16/apps/pspp.png \
149 src/ui/gui/icons/32x32/apps/pspp.png \
150 src/ui/gui/icons/48x48/apps/pspp.png \
151 src/ui/gui/icons/256x256/apps/pspp.png \
152 src/ui/gui/icons/scalable/apps/pspp.svg
153
154 CATEGORY_ICONS = \
155 src/ui/gui/icons/48x48/categories/align-left.png \
156 src/ui/gui/icons/48x48/categories/align-center.png \
157 src/ui/gui/icons/48x48/categories/align-right.png \
158 src/ui/gui/icons/48x48/categories/measure-scale.png \
159 src/ui/gui/icons/48x48/categories/measure-ordinal.png \
160 src/ui/gui/icons/48x48/categories/measure-nominal.png \
161 src/ui/gui/icons/48x48/categories/measure-date-scale.png \
162 src/ui/gui/icons/48x48/categories/measure-date-nominal.png \
163 src/ui/gui/icons/48x48/categories/measure-date-ordinal.png \
164 src/ui/gui/icons/48x48/categories/measure-time-scale.png \
165 src/ui/gui/icons/48x48/categories/measure-time-nominal.png \
166 src/ui/gui/icons/48x48/categories/measure-time-ordinal.png \
167 src/ui/gui/icons/48x48/categories/measure-string-nominal.png \
168 src/ui/gui/icons/48x48/categories/measure-string-ordinal.png \
169 src/ui/gui/icons/48x48/categories/measure-currency-scale.png \
170 src/ui/gui/icons/48x48/categories/measure-currency-nominal.png \
171 src/ui/gui/icons/48x48/categories/measure-currency-ordinal.png \
172 src/ui/gui/icons/48x48/categories/role-input.png \
173 src/ui/gui/icons/48x48/categories/role-target.png \
174 src/ui/gui/icons/48x48/categories/role-both.png \
175 src/ui/gui/icons/48x48/categories/role-none.png \
176 src/ui/gui/icons/48x48/categories/role-partition.png \
177 src/ui/gui/icons/48x48/categories/role-split.png \
178 src/ui/gui/icons/scalable/categories/align-left.svg \
179 src/ui/gui/icons/scalable/categories/align-center.svg \
180 src/ui/gui/icons/scalable/categories/align-right.svg \
181 src/ui/gui/icons/scalable/categories/measure-scale.svg \
182 src/ui/gui/icons/scalable/categories/measure-ordinal.svg \
183 src/ui/gui/icons/scalable/categories/measure-nominal.svg \
184 src/ui/gui/icons/scalable/categories/measure-date-scale.svg \
185 src/ui/gui/icons/scalable/categories/measure-date-nominal.svg \
186 src/ui/gui/icons/scalable/categories/measure-date-ordinal.svg \
187 src/ui/gui/icons/scalable/categories/measure-time-scale.svg \
188 src/ui/gui/icons/scalable/categories/measure-time-nominal.svg \
189 src/ui/gui/icons/scalable/categories/measure-time-ordinal.svg \
190 src/ui/gui/icons/scalable/categories/measure-string-nominal.svg \
191 src/ui/gui/icons/scalable/categories/measure-string-ordinal.svg \
192 src/ui/gui/icons/scalable/categories/measure-currency-scale.svg \
193 src/ui/gui/icons/scalable/categories/measure-currency-nominal.svg \
194 src/ui/gui/icons/scalable/categories/measure-currency-ordinal.svg \
195 src/ui/gui/icons/scalable/categories/role-input.svg \
196 src/ui/gui/icons/scalable/categories/role-target.svg \
197 src/ui/gui/icons/scalable/categories/role-both.svg \
198 src/ui/gui/icons/scalable/categories/role-none.svg \
199 src/ui/gui/icons/scalable/categories/role-partition.svg \
200 src/ui/gui/icons/scalable/categories/role-split.svg
201
202 # Mimetype icons have size dependent layouts
203 MIMETYPE_ICONS = \
204 src/ui/gui/icons/16x16/mimetypes/application-x-spss-por.png \
205 src/ui/gui/icons/16x16/mimetypes/application-x-spss-sav.png \
206 src/ui/gui/icons/16x16/mimetypes/application-x-spss-sps.png \
207 src/ui/gui/icons/16x16/mimetypes/application-x-spss-zsav.png \
208 src/ui/gui/icons/22x22/mimetypes/application-x-spss-por.png \
209 src/ui/gui/icons/22x22/mimetypes/application-x-spss-sav.png \
210 src/ui/gui/icons/22x22/mimetypes/application-x-spss-sps.png \
211 src/ui/gui/icons/22x22/mimetypes/application-x-spss-zsav.png \
212 src/ui/gui/icons/24x24/mimetypes/application-x-spss-por.png \
213 src/ui/gui/icons/24x24/mimetypes/application-x-spss-sav.png \
214 src/ui/gui/icons/24x24/mimetypes/application-x-spss-sps.png \
215 src/ui/gui/icons/24x24/mimetypes/application-x-spss-zsav.png \
216 src/ui/gui/icons/32x32/mimetypes/application-x-spss-por.png \
217 src/ui/gui/icons/32x32/mimetypes/application-x-spss-sav.png \
218 src/ui/gui/icons/32x32/mimetypes/application-x-spss-sps.png \
219 src/ui/gui/icons/32x32/mimetypes/application-x-spss-zsav.png \
220 src/ui/gui/icons/48x48/mimetypes/application-x-spss-por.png \
221 src/ui/gui/icons/48x48/mimetypes/application-x-spss-sav.png \
222 src/ui/gui/icons/48x48/mimetypes/application-x-spss-sps.png \
223 src/ui/gui/icons/48x48/mimetypes/application-x-spss-zsav.png \
224 src/ui/gui/icons/256x256/mimetypes/application-x-spss-por.png \
225 src/ui/gui/icons/256x256/mimetypes/application-x-spss-sav.png \
226 src/ui/gui/icons/256x256/mimetypes/application-x-spss-sps.png \
227 src/ui/gui/icons/256x256/mimetypes/application-x-spss-zsav.png
228
229 src/ui/gui/artwork/splash-t.svg: src/ui/gui/artwork/splash.svg
230         cp $< $@
231
232 src/ui/gui/artwork/splash-r.svg: src/ui/gui/artwork/splash.svg
233         sed -e '/inkscape:label="Overlay"/s/inline/none/' $< > $@
234
235 MISC_ICONS = src/ui/gui/icons/splash-t.png \
236         src/ui/gui/icons/splash-r.png
237
238 ACTION_ICONS = \
239 src/ui/gui/icons/24x24/actions/pspp-file-open-data.png \
240 src/ui/gui/icons/24x24/actions/pspp-file-save-data.png \
241 src/ui/gui/icons/24x24/actions/pspp-edit-go-to-variable.png \
242 src/ui/gui/icons/24x24/actions/pspp-edit-go-to-case.png \
243 src/ui/gui/icons/24x24/actions/pspp-edit-find.png \
244 src/ui/gui/icons/24x24/actions/pspp-edit-insert-case.png \
245 src/ui/gui/icons/24x24/actions/pspp-edit-insert-variable.png \
246 src/ui/gui/icons/24x24/actions/pspp-data-split-file.png \
247 src/ui/gui/icons/24x24/actions/pspp-data-weight-cases.png \
248 src/ui/gui/icons/24x24/actions/pspp-view-value-labels.png \
249 src/ui/gui/icons/48x48/actions/pspp-file-open-data.png \
250 src/ui/gui/icons/48x48/actions/pspp-file-save-data.png \
251 src/ui/gui/icons/48x48/actions/pspp-edit-go-to-variable.png \
252 src/ui/gui/icons/48x48/actions/pspp-edit-go-to-case.png \
253 src/ui/gui/icons/48x48/actions/pspp-edit-find.png \
254 src/ui/gui/icons/48x48/actions/pspp-edit-insert-case.png \
255 src/ui/gui/icons/48x48/actions/pspp-edit-insert-variable.png \
256 src/ui/gui/icons/48x48/actions/pspp-data-split-file.png \
257 src/ui/gui/icons/48x48/actions/pspp-data-weight-cases.png \
258 src/ui/gui/icons/48x48/actions/pspp-view-value-labels.png \
259 src/ui/gui/icons/96x96/actions/pspp-file-open-data.png \
260 src/ui/gui/icons/96x96/actions/pspp-file-save-data.png \
261 src/ui/gui/icons/96x96/actions/pspp-edit-go-to-variable.png \
262 src/ui/gui/icons/96x96/actions/pspp-edit-go-to-case.png \
263 src/ui/gui/icons/96x96/actions/pspp-edit-find.png \
264 src/ui/gui/icons/96x96/actions/pspp-edit-insert-case.png \
265 src/ui/gui/icons/96x96/actions/pspp-edit-insert-variable.png \
266 src/ui/gui/icons/96x96/actions/pspp-data-split-file.png \
267 src/ui/gui/icons/96x96/actions/pspp-data-weight-cases.png \
268 src/ui/gui/icons/96x96/actions/pspp-view-value-labels.png \
269 src/ui/gui/icons/scalable/actions/pspp-file-open-data.svg \
270 src/ui/gui/icons/scalable/actions/pspp-file-save-data.svg \
271 src/ui/gui/icons/scalable/actions/pspp-edit-go-to-variable.svg \
272 src/ui/gui/icons/scalable/actions/pspp-edit-go-to-case.svg \
273 src/ui/gui/icons/scalable/actions/pspp-edit-find.svg \
274 src/ui/gui/icons/scalable/actions/pspp-edit-insert-case.svg \
275 src/ui/gui/icons/scalable/actions/pspp-edit-insert-variable.svg \
276 src/ui/gui/icons/scalable/actions/pspp-data-split-file.svg \
277 src/ui/gui/icons/scalable/actions/pspp-data-weight-cases.svg \
278 src/ui/gui/icons/scalable/actions/pspp-view-value-labels.svg
279
280 ICONS=$(CATEGORY_ICONS) $(ACTION_ICONS) $(MIMETYPE_ICONS) $(APP_ICONS) $(MISC_ICONS)
281
282 ICON_SOURCES = $(wildcard src/ui/gui/artwork/*/*/*.svg)
283 ICON_SOURCES += $(wildcard src/ui/gui/artwork/splash*.svg)
284
285 everything: prep_ph  icons
286         $(MAKE) -f Smake Makefile.in configure
287
288 icons: $(ICONS)
289
290 src/ui/gui/icons/manifest: $(MAKEFILE_LIST)
291         $(RM) $@
292         printf '# This is a generated file. Do not edit.\n' >> $@
293         printf 'icons =' >> $@
294         for i in  $(ICONS); do \
295                 printf ' \\\n\t '$$i >> $@; \
296         done
297         echo >> $@
298         echo >> $@
299         printf 'icon_srcs = ' >> $@
300         for i in  $(ICON_SOURCES); do \
301                 printf ' \\\n\t '$$i  >> $@ ;\
302         done
303         echo ' ' >> $@
304         echo >> $@
305
306
307 src/ui/gui/resources.xml: $(ICONS)
308         printf '<?xml version="1.0" encoding="UTF-8"?>\n' > $@
309         printf '<gresources>\n' >> $@
310         printf ' <gresource prefix="gnu/pspp">\n' >> $@
311         for x in $^; do \
312           z=`echo "$$x" | sed -e 's%src/ui/gui/%%'` ; \
313           printf "  <file>$$z</file>\n" >> $@ ; \
314         done
315         printf ' </gresource>\n' >> $@
316         printf '</gresources>\n' >> $@
317
318
319 .PHONY: prep_ph
320 prep_ph:
321         test -e ChangeLog || touch ChangeLog
322         test -d m4 || mkdir m4
323         touch m4/Makefile.am
324         $(GNULIB_TOOL) --add-import --no-changelog --m4-base=gl/m4 \
325                 --source-base=gl --lib=libgl --tests-base=tests \
326                 --doc-base=gl/doc --aux-dir=build-aux  \
327                 --libtool $(GNULIB_MODULES)
328         if (glibtoolize --version) >/dev/null 2>&1; then        \
329                 LIBTOOLIZE=glibtoolize;                         \
330         elif (libtoolize --version) >/dev/null 2>&1; then       \
331                 LIBTOOLIZE=libtoolize;                          \
332         else                                                    \
333                 echo >&2 "libtoolize not found";                \
334                 exit 1;                                         \
335         fi;                                                     \
336         $$LIBTOOLIZE --force --automake --copy
337
338 aclocal.m4:
339         aclocal -I m4 -I gl/m4
340
341 configure: configure.ac aclocal.m4
342         autoconf || rm $@  # autoconf 2.69 has (what I think is) a bug.  It will create configure even when failure is detected.
343
344 config.h.in: configure.ac
345         autoheader
346
347 Makefile.in: Makefile.am config.h.in aclocal.m4 src/ui/gui/resources.xml src/ui/gui/icons/manifest
348         automake --add-missing --copy --no-force --include-deps
349
350
351 gettextize:
352         test -d m4 || mkdir m4
353         touch m4/Makefile.am
354         gettextize --force --no-changelog
355
356 check: all
357         rm -rf _check
358         mkdir _check
359         cd _check && ../configure $(CONFIGUREFLAGS)
360         cd _check && make distcheck
361         rm -rf _check
362
363 _build: all
364         test -d _build || mkdir _build
365         cd _build && ../configure $(CONFIGUREFLAGS)
366
367 _debug: all
368         test -d _debug || mkdir _debug
369         cd _debug && ../configure $(CONFIGUREFLAGS) --enable-debug
370
371
372
373 PO_FILES = po/Rules-quot po/boldquot.sed \
374 po/cat-id-tbl.c po/en@boldquot.header po/en@quot.header                 \
375 po/insert-header.sin po/quot.sed po/remove-potcdate.sin po/stamp-po     \
376 po/Makevars.template po/pspp.pot
377
378 clean:
379         rm -f config.sub config.guess config.rpath
380         rm -fr autom4te.cache
381         rm -f aclocal.m4
382         rm -f missing mkinstalldirs
383         rm -f install-sh
384         rm -f configure Makefile
385         rm -f depcomp
386         rm -rf intl gl
387         rm -f m4/*.m4
388         rm -f $(PO_FILES) po/*.gmo
389         rm -f mdate-sh texinfo.tex
390         rm -f doc/stamp-vti
391         rm -f config.h.in~
392         rm -f config.h.in
393         rm -f gl/Makefile.in
394         rm -f Makefile.in
395         rm -f build-aux/compile
396         rm -f build-aux/ltmain.sh
397         rm -f build-aux/reloc-ldflags
398         rm -f build-aux/install-reloc
399         rm -f build-aux/config.rpath
400         rm -f build-aux/config.libpath
401         rm -f build-aux/libtool-reloc
402         rm -f build-aux/gitlog-to-changelog
403
404 .PHONY: all gettextize clean
405
406
407 # The "convert" program from imagemagick can be used to create png from svg but doesn't properly deal
408 # with the alpha channels.  Therefore, it is not recommended for production pspp builds, but might
409 # be useful to get something working on a platform which doesn't have a working gimp.
410
411 #svg2png=convert -background transparent $1 $3
412
413 # Graphical layout of icons and our portfolio
414 # ===========================================
415 #
416 # We have two different kinds of icons in our artwork collection
417 #
418 #   a) The mimetype icons have a different graphical layout depending on resolution
419 #      This assumes that a higher resolution means a bigger size. On the bigger
420 #      size you can identify more details and this is used in the design.
421 #   b) Icons which are designed based on 16x16 pixels which are just scaled
422 #      This are all other icons.
423 #
424 # Icon resolutions
425 #
426 # The different icon resolutions are historically derived for bitmaps when an icon
427 # is displayed in different sizes. Then a scaled version of the icon requires a new
428 # bitmap image. All our icons are now svg type and can be scaled from one svg file as
429 # the names suggests - scalable vector format.
430 #
431 # The strategy for pspp gui
432 #
433 # All icons which are simply scaled provide a default 48x48 bitmap png image plus
434 # an svg version in the scalable directory.
435 # The mimetype icons with different layouts provide png bitmaps in their original resolutions
436 #
437 # The artwork directory contains only the pure source svg files. No copies and no
438 # version has another size indication although it is an svg.
439 #
440 #  => mimetype icons are located in 16x16, 32x32, ... , 256x256 (different designs)
441 #  => all others are in scaled (just one design svg)
442 #
443
444 # Rule for icons with size dependent graphical design
445 src/ui/gui/icons/%.png: src/ui/gui/artwork/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
446         mkdir -p $(dir $@)
447         build-aux/svg2png "$<" "$(lastword $^)" "$@"
448
449 # Rules for icons which are simply scaled - Attention multitarget would trigger only once...
450 src/ui/gui/icons/16x16/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
451         mkdir -p $(dir $@)
452         build-aux/svg2png "$<" "$(lastword $^)" "$@"
453 src/ui/gui/icons/22x22/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
454         mkdir -p $(dir $@)
455         build-aux/svg2png "$<" "$(lastword $^)" "$@"
456 src/ui/gui/icons/24x24/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
457         mkdir -p $(dir $@)
458         build-aux/svg2png "$<" "$(lastword $^)" "$@"
459 src/ui/gui/icons/32x32/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
460         mkdir -p $(dir $@)
461         build-aux/svg2png "$<" "$(lastword $^)" "$@"
462 src/ui/gui/icons/48x48/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
463         mkdir -p $(dir $@)
464         build-aux/svg2png "$<" "$(lastword $^)" "$@"
465 src/ui/gui/icons/96x96/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
466         mkdir -p $(dir $@)
467         build-aux/svg2png "$<" "$(lastword $^)" "$@"
468 src/ui/gui/icons/256x256/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
469         mkdir -p $(dir $@)
470         build-aux/svg2png "$<" "$(lastword $^)" "$@"
471
472 # Copy svg
473 src/ui/gui/icons/%.svg: src/ui/gui/artwork/%.svg
474         mkdir -p $(dir $@)
475         cp $< $@