zip-reader: Use xstrdup() instead of strdup().
[pspp.git] / Smake
blob91b4230f5cc2b040165449d769e8ef3fd4e5c17c
1 # -*- makefile -*-
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
21 all: everything
23 # Adjust these to reflect where you've installed gnulib.
24 GNULIB = ../gnulib
25 GNULIB_TOOL = $(GNULIB)/gnulib-tool
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         crc \
41         crypto/md4 \
42         crypto/rijndael \
43         dirname \
44         dtoastr \
45         environ \
46         fatal-signal \
47         fcntl \
48         fpieee \
49         fprintf-posix \
50         full-read \
51         full-write \
52         fseeko \
53         ftello \
54         fwriteerror \
55         getline \
56         getpass \
57         gettext \
58         gettimeofday \
59         getopt-gnu \
60         gitlog-to-changelog \
61         include_next \
62         isfinite \
63         isinf \
64         isnan \
65         intprops \
66         inttostr \
67         localcharset \
68         mbchar \
69         mbiter \
70         memcasecmp \
71         memchr \
72         memchr2 \
73         mempcpy \
74         memrchr \
75         minmax \
76         mkdtemp \
77         mkstemp \
78         pipe2 \
79         printf-posix \
80         printf-safe \
81         progname \
82         rawmemchr \
83         read-file \
84         regex \
85         relocatable-prog \
86         rename \
87         round \
88         select \
89         snprintf \
90         snprintf-posix \
91         sprintf-posix \
92         stdarg \
93         stdbool \
94         stdint \
95         strcasestr \
96         stpcpy \
97         strerror \
98         strftime \
99         strsep \
100         strtod \
101         strtok_r \
102         sys_stat \
103         tempname \
104         termios \
105         trunc \
106         unicase/u8-casecmp \
107         unicase/u8-casefold \
108         unicase/u8-tolower \
109         unicase/u8-toupper \
110         unictype/ctype-print \
111         unictype/category-of \
112         unigbrk/uc-is-grapheme-break \
113         unilbrk/u8-possible-linebreaks \
114         uninorm/nfkd \
115         unistd \
116         unistr/u8-check \
117         unistr/u8-cpy \
118         unistr/u8-mblen \
119         unistr/u8-mbtouc \
120         unistr/u8-mbtoucr \
121         unistr/u8-strlen \
122         unistr/u8-strmbtouc \
123         unistr/u8-strncat \
124         unistr/u8-uctomb \
125         uniwidth/u8-strwidth \
126         unitypes \
127         unlocked-io \
128         vasprintf-posix \
129         version-etc \
130         version-etc-fsf \
131         vfprintf-posix \
132         vprintf-posix \
133         vsnprintf \
134         vsnprintf-posix \
135         vsprintf-posix \
136         xalloc \
137         xalloc-die \
138         xmalloca \
139         xmemdup0 \
140         xsize \
141         xstrndup \
142         xvasprintf
144 APP_ICONS = \
145 src/ui/gui/icons/32x32/apps/pspp.png \
146 src/ui/gui/icons/22x22/apps/pspp.png \
147 src/ui/gui/icons/24x24/apps/pspp.png \
148 src/ui/gui/icons/16x16/apps/pspp.png \
149 src/ui/gui/icons/48x48/apps/pspp.png \
150 src/ui/gui/icons/256x256/apps/pspp.png \
151 src/ui/gui/icons/scalable/apps/pspp.svg
153 CATEGORY_ICONS = \
154 src/ui/gui/icons/16x16/categories/align-left.png \
155 src/ui/gui/icons/16x16/categories/align-center.png \
156 src/ui/gui/icons/16x16/categories/align-right.png \
157 src/ui/gui/icons/16x16/categories/measure-scale.png \
158 src/ui/gui/icons/16x16/categories/measure-ordinal.png \
159 src/ui/gui/icons/16x16/categories/measure-nominal.png \
160 src/ui/gui/icons/16x16/categories/measure-date-scale.png \
161 src/ui/gui/icons/16x16/categories/measure-date-nominal.png \
162 src/ui/gui/icons/16x16/categories/measure-date-ordinal.png \
163 src/ui/gui/icons/16x16/categories/measure-time-scale.png \
164 src/ui/gui/icons/16x16/categories/measure-time-nominal.png \
165 src/ui/gui/icons/16x16/categories/measure-time-ordinal.png \
166 src/ui/gui/icons/16x16/categories/measure-string-nominal.png \
167 src/ui/gui/icons/16x16/categories/measure-string-ordinal.png \
168 src/ui/gui/icons/16x16/categories/measure-currency-scale.png \
169 src/ui/gui/icons/16x16/categories/measure-currency-nominal.png \
170 src/ui/gui/icons/16x16/categories/measure-currency-ordinal.png \
171 src/ui/gui/icons/16x16/categories/role-input.png \
172 src/ui/gui/icons/16x16/categories/role-target.png \
173 src/ui/gui/icons/16x16/categories/role-both.png \
174 src/ui/gui/icons/16x16/categories/role-none.png \
175 src/ui/gui/icons/16x16/categories/role-partition.png \
176 src/ui/gui/icons/16x16/categories/role-split.png
178 MIMETYPE_ICONS = \
179 src/ui/gui/icons/32x32/mimetypes/application-x-spss-por.png \
180 src/ui/gui/icons/32x32/mimetypes/application-x-spss-sav.png \
181 src/ui/gui/icons/32x32/mimetypes/application-x-spss-sps.png \
182 src/ui/gui/icons/32x32/mimetypes/application-x-spss-zsav.png \
183 src/ui/gui/icons/22x22/mimetypes/application-x-spss-por.png \
184 src/ui/gui/icons/22x22/mimetypes/application-x-spss-sav.png \
185 src/ui/gui/icons/22x22/mimetypes/application-x-spss-sps.png \
186 src/ui/gui/icons/22x22/mimetypes/application-x-spss-zsav.png \
187 src/ui/gui/icons/24x24/mimetypes/application-x-spss-por.png \
188 src/ui/gui/icons/24x24/mimetypes/application-x-spss-sav.png \
189 src/ui/gui/icons/24x24/mimetypes/application-x-spss-sps.png \
190 src/ui/gui/icons/24x24/mimetypes/application-x-spss-zsav.png \
191 src/ui/gui/icons/256x256/mimetypes/application-x-spss-por.png \
192 src/ui/gui/icons/256x256/mimetypes/application-x-spss-sav.png \
193 src/ui/gui/icons/256x256/mimetypes/application-x-spss-sps.png \
194 src/ui/gui/icons/256x256/mimetypes/application-x-spss-zsav.png \
195 src/ui/gui/icons/16x16/mimetypes/application-x-spss-por.png \
196 src/ui/gui/icons/16x16/mimetypes/application-x-spss-sav.png \
197 src/ui/gui/icons/16x16/mimetypes/application-x-spss-sps.png \
198 src/ui/gui/icons/16x16/mimetypes/application-x-spss-zsav.png \
199 src/ui/gui/icons/48x48/mimetypes/application-x-spss-por.png \
200 src/ui/gui/icons/48x48/mimetypes/application-x-spss-sav.png \
201 src/ui/gui/icons/48x48/mimetypes/application-x-spss-sps.png \
202 src/ui/gui/icons/48x48/mimetypes/application-x-spss-zsav.png
205 src/ui/gui/artwork/splash-t.svg: src/ui/gui/artwork/splash.svg
206         cp $< $@
208 src/ui/gui/artwork/splash-r.svg: src/ui/gui/artwork/splash.svg
209         sed -e '/inkscape:label="Overlay"/s/inline/none/' $< > $@
212 MISC_ICONS = src/ui/gui/icons/splash-t.png \
213         src/ui/gui/icons/splash-r.png
216 ACTION_ICONS = \
217 src/ui/gui/icons/32x32/actions/data-split-file.png \
218 src/ui/gui/icons/32x32/actions/data-select-cases.png \
219 src/ui/gui/icons/32x32/actions/data-weight-cases.png \
220 src/ui/gui/icons/32x32/actions/transform-compute.png \
221 src/ui/gui/icons/32x32/actions/edit-find.png \
222 src/ui/gui/icons/32x32/actions/edit-go-to-case.png \
223 src/ui/gui/icons/32x32/actions/edit-go-to-variable.png \
224 src/ui/gui/icons/32x32/actions/edit-insert-case.png \
225 src/ui/gui/icons/32x32/actions/edit-insert-variable.png \
226 src/ui/gui/icons/32x32/actions/edit-cut.png \
227 src/ui/gui/icons/32x32/actions/edit-copy.png \
228 src/ui/gui/icons/32x32/actions/edit-paste.png \
229 src/ui/gui/icons/32x32/actions/edit-undo.png \
230 src/ui/gui/icons/32x32/actions/edit-redo.png \
231 src/ui/gui/icons/32x32/actions/edit-select-all.png \
232 src/ui/gui/icons/32x32/actions/file-open-data.png \
233 src/ui/gui/icons/32x32/actions/file-save-data.png \
234 src/ui/gui/icons/32x32/actions/file-export-data.png \
235 src/ui/gui/icons/32x32/actions/file-print.png \
236 src/ui/gui/icons/32x32/actions/view-value-labels.png \
237 src/ui/gui/icons/32x32/actions/utilities-variables.png \
238 src/ui/gui/icons/32x32/actions/run-all.png \
239 src/ui/gui/icons/24x24/actions/data-split-file.png \
240 src/ui/gui/icons/24x24/actions/data-select-cases.png \
241 src/ui/gui/icons/24x24/actions/data-weight-cases.png \
242 src/ui/gui/icons/24x24/actions/transform-compute.png \
243 src/ui/gui/icons/24x24/actions/edit-find.png \
244 src/ui/gui/icons/24x24/actions/edit-go-to-case.png \
245 src/ui/gui/icons/24x24/actions/edit-go-to-variable.png \
246 src/ui/gui/icons/24x24/actions/edit-insert-case.png \
247 src/ui/gui/icons/24x24/actions/edit-insert-variable.png \
248 src/ui/gui/icons/24x24/actions/edit-cut.png \
249 src/ui/gui/icons/24x24/actions/edit-copy.png \
250 src/ui/gui/icons/24x24/actions/edit-paste.png \
251 src/ui/gui/icons/24x24/actions/edit-undo.png \
252 src/ui/gui/icons/24x24/actions/edit-redo.png \
253 src/ui/gui/icons/24x24/actions/edit-select-all.png \
254 src/ui/gui/icons/24x24/actions/file-open-data.png \
255 src/ui/gui/icons/24x24/actions/file-save-data.png \
256 src/ui/gui/icons/24x24/actions/file-export-data.png \
257 src/ui/gui/icons/24x24/actions/file-print.png \
258 src/ui/gui/icons/24x24/actions/view-value-labels.png \
259 src/ui/gui/icons/24x24/actions/utilities-variables.png \
260 src/ui/gui/icons/24x24/actions/run-all.png \
261 src/ui/gui/icons/16x16/actions/file-new-data.png \
262 src/ui/gui/icons/16x16/actions/file-syntax-data.png \
263 src/ui/gui/icons/16x16/actions/file-system-data.png \
264 src/ui/gui/icons/16x16/actions/file-open-data.png \
265 src/ui/gui/icons/16x16/actions/file-import-data.png \
266 src/ui/gui/icons/16x16/actions/file-export-data.png \
267 src/ui/gui/icons/16x16/actions/file-save-data.png \
268 src/ui/gui/icons/16x16/actions/file-save-as.png \
269 src/ui/gui/icons/16x16/actions/file-print.png \
270 src/ui/gui/icons/16x16/actions/file-rename-data-set.png \
271 src/ui/gui/icons/16x16/actions/file-display-information.png \
272 src/ui/gui/icons/16x16/actions/display-information-working-file.png \
273 src/ui/gui/icons/16x16/actions/display-information-external-file.png \
274 src/ui/gui/icons/16x16/actions/file-recently-used.png \
275 src/ui/gui/icons/16x16/actions/file-quit.png \
276 src/ui/gui/icons/16x16/actions/file-display-information.png \
277 src/ui/gui/icons/16x16/actions/edit-insert-variable.png \
278 src/ui/gui/icons/16x16/actions/edit-insert-case.png \
279 src/ui/gui/icons/16x16/actions/edit-go-to-variable.png \
280 src/ui/gui/icons/16x16/actions/edit-go-to-case.png \
281 src/ui/gui/icons/16x16/actions/edit-cut.png \
282 src/ui/gui/icons/16x16/actions/edit-copy.png \
283 src/ui/gui/icons/16x16/actions/edit-paste.png \
284 src/ui/gui/icons/16x16/actions/edit-delete.png \
285 src/ui/gui/icons/16x16/actions/edit-undo.png \
286 src/ui/gui/icons/16x16/actions/edit-redo.png \
287 src/ui/gui/icons/16x16/actions/edit-select-all.png \
288 src/ui/gui/icons/16x16/actions/edit-clear.png \
289 src/ui/gui/icons/16x16/actions/edit-find.png \
290 src/ui/gui/icons/16x16/actions/view-font.png \
291 src/ui/gui/icons/16x16/actions/view-value-labels.png \
292 src/ui/gui/icons/16x16/actions/data-sort-cases.png \
293 src/ui/gui/icons/16x16/actions/data-transpose.png \
294 src/ui/gui/icons/16x16/actions/data-aggregate.png \
295 src/ui/gui/icons/16x16/actions/data-split-file.png \
296 src/ui/gui/icons/16x16/actions/data-select-cases.png \
297 src/ui/gui/icons/16x16/actions/data-weight-cases.png \
298 src/ui/gui/icons/16x16/actions/run-all.png \
299 src/ui/gui/icons/16x16/actions/run-selection.png \
300 src/ui/gui/icons/16x16/actions/run-current-line.png \
301 src/ui/gui/icons/16x16/actions/run-to-end.png \
302 src/ui/gui/icons/16x16/actions/transform-compute.png \
303 src/ui/gui/icons/16x16/actions/transform-count.png \
304 src/ui/gui/icons/16x16/actions/transform-rank-cases.png \
305 src/ui/gui/icons/16x16/actions/transform-automatic-recode.png \
306 src/ui/gui/icons/16x16/actions/transform-in-to-same-variables.png \
307 src/ui/gui/icons/16x16/actions/transform-in-to-different-variables.png \
308 src/ui/gui/icons/16x16/actions/transform-run-pending.png \
309 src/ui/gui/icons/16x16/actions/analyze-descriptive-statistics.png \
310 src/ui/gui/icons/16x16/actions/analyze-compare-means.png \
311 src/ui/gui/icons/16x16/actions/analyze-univariate-analysis.png \
312 src/ui/gui/icons/16x16/actions/analyze-bivariate-correlation.png \
313 src/ui/gui/icons/16x16/actions/analyze-kmeans-cluster.png \
314 src/ui/gui/icons/16x16/actions/analyze-factor-analysis.png \
315 src/ui/gui/icons/16x16/actions/analyze-reliability.png \
316 src/ui/gui/icons/16x16/actions/analyze-regression.png \
317 src/ui/gui/icons/16x16/actions/analyze-non-parametric-statistics.png \
318 src/ui/gui/icons/16x16/actions/analyze-roc-curve.png \
319 src/ui/gui/icons/16x16/actions/utilities-variables.png \
320 src/ui/gui/icons/16x16/actions/utilities-data-file-comments.png \
321 src/ui/gui/icons/16x16/actions/windows-minimize-all.png \
322 src/ui/gui/icons/16x16/actions/windows-split.png \
323 src/ui/gui/icons/16x16/actions/help-reference-manual.png \
324 src/ui/gui/icons/16x16/actions/help-about.png
327 ICONS=$(CATEGORY_ICONS) $(ACTION_ICONS) $(MIMETYPE_ICONS) $(APP_ICONS) $(MISC_ICONS)
329 everything: prep_ph  icons
330         $(MAKE) -f Smake Makefile.in configure
332 icons: $(ICONS)
334 src/ui/gui/icons/manifest: $(MAKEFILE_LIST)
335         $(RM) $@
336         printf '# This is a generated file. Do not edit.\n' >> $@
337         printf 'icons =' >> $@
338         for i in  $(ICONS); do \
339                 printf ' \\\n\t '$$i >> $@; \
340         done
341         echo >> $@
342         echo >> $@
343         printf 'icon_srcs = ' >> $@
344         for i in  $(ICONS); do \
345                 printf ' \\\n\t ' >> $@ ;\
346                 printf $$i | awk '{ gsub(".png",".svg")gsub("icons","artwork");printf $$0}' >> $@ ; \
347         done
348         echo ' ' >> $@
349         echo >> $@
352 src/ui/gui/resources.xml: $(ICONS)
353         printf '<?xml version="1.0" encoding="UTF-8"?>\n' > $@
354         printf '<gresources>\n' >> $@
355         printf ' <gresource prefix="gnu/pspp">\n' >> $@
356         for x in $^; do \
357           z=`echo "$$x" | sed -e 's%src/ui/gui/%%'` ; \
358           printf "  <file>$$z</file>\n" >> $@ ; \
359         done
360         printf ' </gresource>\n' >> $@
361         printf '</gresources>\n' >> $@
364 .PHONY: prep_ph
365 prep_ph: 
366         test -e ChangeLog || touch ChangeLog
367         test -d m4 || mkdir m4
368         touch m4/Makefile.am
369         $(GNULIB_TOOL) --add-import --no-changelog --m4-base=gl/m4 \
370                 --source-base=gl --lib=libgl --tests-base=tests \
371                 --doc-base=gl/doc --aux-dir=build-aux  \
372                 --libtool $(GNULIB_MODULES)
373         if (glibtoolize --version) >/dev/null 2>&1; then        \
374                 LIBTOOLIZE=glibtoolize;                         \
375         elif (libtoolize --version) >/dev/null 2>&1; then       \
376                 LIBTOOLIZE=libtoolize;                          \
377         else                                                    \
378                 echo >&2 "libtoolize not found";                \
379                 exit 1;                                         \
380         fi;                                                     \
381         $$LIBTOOLIZE --force --automake --copy
383 aclocal.m4:
384         aclocal -I m4 -I gl/m4
386 configure: configure.ac aclocal.m4
387         autoconf || rm $@  # autoconf 2.69 has (what I think is) a bug.  It will create configure even when failure is detected.
389 config.h.in: configure.ac
390         autoheader
392 Makefile.in: Makefile.am config.h.in aclocal.m4 src/ui/gui/resources.xml src/ui/gui/icons/manifest
393         automake --add-missing --copy --no-force --include-deps
396 gettextize:
397         test -d m4 || mkdir m4
398         touch m4/Makefile.am
399         gettextize --force --no-changelog
401 check: all
402         rm -rf _check
403         mkdir _check
404         cd _check && ../configure $(CONFIGUREFLAGS)
405         cd _check && make distcheck
406         rm -rf _check
408 _build: all
409         test -d _build || mkdir _build
410         cd _build && ../configure $(CONFIGUREFLAGS)
412 _debug: all
413         test -d _debug || mkdir _debug
414         cd _debug && ../configure $(CONFIGUREFLAGS) --enable-debug
418 PO_FILES = po/Rules-quot po/boldquot.sed \
419 po/cat-id-tbl.c po/en@boldquot.header po/en@quot.header                 \
420 po/insert-header.sin po/quot.sed po/remove-potcdate.sin po/stamp-po     \
421 po/Makevars.template po/pspp.pot
423 clean:
424         rm -f config.sub config.guess config.rpath
425         rm -fr autom4te.cache
426         rm -f aclocal.m4
427         rm -f missing mkinstalldirs
428         rm -f install-sh
429         rm -f configure Makefile 
430         rm -f depcomp
431         rm -rf intl gl
432         rm -f m4/*.m4
433         rm -f $(PO_FILES) po/*.gmo 
434         rm -f mdate-sh texinfo.tex
435         rm -f doc/stamp-vti
436         rm -f config.h.in~
437         rm -f config.h.in
438         rm -f gl/Makefile.in
439         rm -f Makefile.in
440         rm -f compile
441         rm -f ltmain.sh
442         rm -f reloc-ldflags install-reloc
444 .PHONY: all gettextize clean
447 # The "convert" program from imagemagick can be used to create png from svg but doesn't properly deal
448 # with the alpha channels.  Therefore, it is not recommended for production pspp builds, but might
449 # be useful to get something working on a platform which doesn't have a working gimp.
451 #svg2png=convert -background transparent $1 $3
453 src/ui/gui/icons/%.png: src/ui/gui/artwork/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
454         mkdir -p $(dir $@)
455         build-aux/svg2png "$<" "$(lastword $^)" "$@"
458 src/ui/gui/icons/%.svg: src/ui/gui/artwork/%.svg
459         mkdir -p $(dir $@)
460         cp $< $@