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