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