Allow Scilab compilation under OSX Catalina
[scilab.git] / scilab / Makefile.am
1 #
2 # Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 # Copyright (C) INRIA - 2006-2008 - Sylvestre Ledru
4 # Copyright (C) DIGITEO - 2009 - Sylvestre Ledru
5 #
6 # Copyright (C) 2012 - 2016 - Scilab Enterprises
7 #
8 # This file is hereby licensed under the terms of the GNU GPL v2.0,
9 # pursuant to article 5.3.4 of the CeCILL v.2.1.
10 # This file was originally licensed under the terms of the CeCILL v2.1,
11 # and continues to be available under such terms.
12 # For more information, see the COPYING file which you should have received
13 # along with this program.
14 #
15
16 ## Process this file with automake to produce Makefile.in (which will be changed by the ./configure)
17
18 AUTOMAKE_OPTIONS = 1.11 dist-zip dist-bzip2
19
20 SUBDIRS= modules \
21         contrib \
22         desktop
23
24 ACLOCAL_AMFLAGS = -I m4
25
26 # Set AM_* SCI detected settings
27 AM_CPPFLAGS = $(SCI_CPPFLAGS)
28 AM_CFLAGS   = $(SCI_CFLAGS)
29 AM_CXXFLAGS = $(SCI_CXXFLAGS)
30 AM_FFLAGS   = $(SCI_FFLAGS)
31 AM_LDFLAGS  = $(SCI_LDFLAGS)
32
33 if GUI
34 bin_PROGRAMS            = scilab-bin scilab-cli-bin
35 bin_SCRIPTS             = bin/scilab bin/scilab-adv-cli bin/scilab-cli bin/scinotes bin/xcos
36 else
37 bin_PROGRAMS            = scilab-cli-bin
38 bin_SCRIPTS             = bin/scilab-cli
39 endif
40 if IS_MACOSX
41 bin_SCRIPTS             += bin/checkmacosx.applescript
42 endif
43
44 scilab_bin_LDFLAGS      = $(AM_LDFLAGS) $(OPENMPI_LIBS)
45 scilab_cli_bin_LDFLAGS  = $(AM_LDFLAGS) $(OPENMPI_LIBS)
46
47 #
48 # using the static system libs might produce linkage issue (eg.
49 # std::nothrow for instance) but it seems to be the only acceptable
50 # solution for now.
51 #
52 if USE_STATIC_SYSTEM_LIB
53 scilab_bin_LDFLAGS += -static-libstdc++ -static-libgcc -static-libgfortran
54 scilab_cli_bin_LDFLAGS += -static-libstdc++ -static-libgcc -static-libgfortran
55 else
56 # Clang (for example) needs an explicit reference to the lib
57 scilab_bin_LDFLAGS += -lstdc++ -lgfortran
58 scilab_cli_bin_LDFLAGS += -lstdc++ -lgfortran
59 endif
60
61
62 if IS_MACOSX
63 scilab_bin_LDFLAGS              += -framework Cocoa
64 endif
65
66 scilab_bin_CPPFLAGS = \
67     -I$(top_srcdir)/modules/ast/includes/ast/ \
68     -I$(top_srcdir)/modules/ast/includes/exps/ \
69     -I$(top_srcdir)/modules/ast/includes/operations/ \
70     -I$(top_srcdir)/modules/ast/includes/parse/ \
71     -I$(top_srcdir)/modules/ast/includes/symbol/ \
72     -I$(top_srcdir)/modules/ast/includes/system_env/ \
73     -I$(top_srcdir)/modules/ast/includes/types/ \
74     -I$(top_srcdir)/modules/ast/includes/analysis/ \
75     -I$(top_srcdir)/modules/console/includes/ \
76     -I$(top_srcdir)/modules/output_stream/includes/ \
77     -I$(top_srcdir)/modules/functions_manager/includes/ \
78     -I$(top_srcdir)/modules/elementary_functions/includes/ \
79     -I$(top_srcdir)/modules/fileio/includes/ \
80     -I$(top_srcdir)/modules/string/includes/ \
81     -I$(top_srcdir)/modules/history_manager/includes/ \
82     -I$(top_srcdir)/modules/threads/includes/ \
83     -I$(top_srcdir)/modules/api_scilab/includes/ \
84     -I$(top_srcdir)/modules/localization/includes/ \
85     -I$(top_srcdir)/modules/core/src/c/ \
86     -I$(top_srcdir)/modules/dynamic_link/includes/ \
87     -I$(top_srcdir)/modules/startup/src/c/ \
88     $(AM_CPPFLAGS)
89
90 # --no-undefined --relax
91
92 # Localization dep already exists because of the `exportLocaleToSystem' symbol
93 # (causing issues on some platform)
94 COMMON_LIBS = $(LTLIBINTL)
95
96 # Link against valgrind library as on some systems (eg. Fedora) it should be
97 # link on the final binary
98 COMMON_LIBS += $(VALGRIND_LIBS)
99
100 scilab_bin_SOURCES = modules/startup/src/cpp/scilab.cpp
101
102 # the scilab-bin object file itself uses symbols from at least libscilab-cli.la,
103 # libsciconsole-minimal.la and libscijvm-disable.la, so we have to link with these
104 # libraries explicitly unless we link with -Wl,--copy-dt-needed-entries
105 scilab_bin_LDADD        = \
106                         $(top_builddir)/modules/libscilab.la \
107                         $(top_builddir)/modules/libscilab-cli.la \
108                         $(OPENMPI_LIBS) $(XML_LIBS) \
109                         $(COMMON_LIBS) $(FLIBS)
110
111 if NEED_JAVA
112 scilab_bin_LDADD += \
113                         $(top_builddir)/modules/console/libsciconsole.la \
114                         $(top_builddir)/modules/jvm/libscijvm.la \
115                         $(top_builddir)/modules/commons/libscicommons.la
116 else
117 scilab_bin_LDADD += \
118                         $(top_builddir)/modules/console/libsciconsole-minimal.la \
119                         $(top_builddir)/modules/jvm/libscijvm-disable.la
120 endif
121
122 # BLAS_LIBS & LAPACK_LIBS are explicitly linked at the end. Unlike Scilab 5 in which the binary
123 # is in C, Scilab 6 main is in C++. For some reasons (ie, I don't know why), libtool places blas and
124 # lapack at the beginning of the order of the link. This caused some issues with the overload of the
125 # xerbla function
126 scilab_bin_LDADD += $(top_builddir)/modules/libscilab.la $(BLAS_LIBS) $(LAPACK_LIBS) $(FLIBS)
127
128 # Match scilab -nwni (ie command line without graphics)
129
130 scilab_cli_bin_SOURCES  = modules/startup/src/cpp/scilab.cpp
131
132 scilab_cli_bin_CPPFLAGS = -DWITHOUT_GUI $(scilab_bin_CPPFLAGS)
133
134 # See the comment about scilab_bin_LDADD (relative to BLAS_LIBS & LAPACK_LIBS)
135 scilab_cli_bin_LDADD    = $(COMMON_LIBS) $(top_builddir)/modules/libscilab-cli.la $(BLAS_LIBS) $(LAPACK_LIBS) $(FLIBS)
136
137 if MPI
138 CXX = $(OPENMPI_CXX)
139 scilab_bin_SOURCES += modules/startup/src/c/initMPI.c
140 scilab_bin_CPPFLAGS += $(OPENMPI_CXXFLAGS)
141 scilab_cli_bin_SOURCES += modules/startup/src/c/initMPI.c
142 scilab_cli_bin_CPPFLAGS += $(OPENMPI_CXXFLAGS)
143 endif
144
145
146 if NEED_JAVA
147 # Don't do it for scilab_cli_bin. We want to be able to call it without
148 # the java libs
149         scilab_bin_LDADD += $(JAVA_JNI_LIBS)
150 endif
151
152 if IS_SOLARIS
153 # The binary itself needs this dep
154         scilab_bin_LDADD += $(BLAS_LIBS)
155 endif
156
157 LANG_DOMAIN=scilab
158
159 TARGETS_ALL=macros
160
161 #  The user wants to compile the localization files
162 if GENERATE_LOCALIZATION_FILES
163 TARGETS_ALL+=localization
164 endif
165
166 if COMPILATION_TESTS
167 TARGETS_ALL+=check-java
168 endif
169
170 # check is performed with scilab, so use the serial-tests on purpose
171 TESTS_ENVIRONMENT = LANG=C HOME=/tmp $(top_builddir)/bin/scilab-cli -nb -noatomsautoload -nouserstartup -f
172 TESTS = $(top_builddir)/modules/development_tools/tests/unit_tests/test_run_level_1.tst
173
174 all-local: $(TARGETS_ALL)
175
176 rootdir=$(pkgdatadir)/etc/
177 root_DATA = $(top_srcdir)/etc/scilab.start \
178 $(top_srcdir)/etc/scilab.quit \
179 $(top_srcdir)/etc/toolboxes.xml \
180 $(top_builddir)/etc/jvm_options.xml \
181 $(top_builddir)/etc/modules.xml \
182 $(top_builddir)/etc/classpath.xml \
183 $(top_builddir)/etc/logging.properties \
184 $(top_builddir)/etc/librarypath.xml
185
186 infofilesdir=$(pkgdatadir)/
187 infofiles_DATA = $(top_srcdir)/CHANGES.md \
188 $(top_srcdir)/ACKNOWLEDGEMENTS \
189 $(top_srcdir)/COPYING \
190 $(top_srcdir)/COPYING-BSD \
191 $(top_srcdir)/README.md \
192 $(top_builddir)/Version.incl
193
194 valgrinddir=$(pkgdatadir)/tools/profiling
195 valgrind_DATA = $(top_srcdir)/tools/profiling/valgrind.supp
196
197 macros: $(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli check-jvm-dep check-libstdcpp-dep
198         -@( cd $(top_builddir) ; \
199         echo "$(top_builddir)/bin/scilab-cli -ns -noatomsautoload -nouserstartup -quit -f modules/functions/scripts/buildmacros/buildmacros.sce" ; \
200         HOME=/tmp $(top_builddir)/bin/scilab-cli -ns -noatomsautoload -nouserstartup -quit -f modules/functions/scripts/buildmacros/buildmacros.sce) || exit 1
201
202 strip-debug:
203         find $(top_builddir) -name '*.so.?.?.?' | while read file ; \
204         do \
205             if [ ! -f $$file.debug ]; then \
206                 objcopy --only-keep-debug $$file $$file.debug; \
207                 objcopy --strip-debug $$file; \
208                 objcopy --add-gnu-debuglink=$$file.debug $$file; \
209             fi \
210         done;
211
212 check-jvm-dep:
213 # Check that scilab-cli does not have a dependency on libjvm
214 if !IS_MACOSX
215         @ldd .libs/scilab-cli-bin|grep libjvm > /dev/null; \
216         if test $$? == 0; then \
217                 echo "Found dependency from scilab-cli-bin to libjvm found"; exit 2;\
218         fi
219 endif
220
221
222 check-libstdcpp-dep:
223 if USE_STATIC_SYSTEM_LIB
224 # Check that scilab-cli does not have a dependency on libstdc++ (should be static)
225         @readelf -d .libs/scilab-bin .libs/scilab-cli-bin modules/.libs/libscilab*so* |grep libstdc++ > /dev/null; \
226         if test $$? == 0; then \
227                 echo "Found dependency from scilab-cli-bin to libstdc++ found"; exit 2;\
228         fi
229 else
230         echo "libstdc++ presence test skipped"
231 endif
232
233 # Build the public Javadoc (javasci v2 and Java/Scilab types)
234 # This is not done in the module itself because its needs also the "types"
235 # module
236 javadoc:
237         $(JAVADOC) -noindex -nohelp -nonavbar -notree \
238         -d $(top_builddir)/modules/javasci/javadoc \
239         -sourcepath $(top_srcdir)/modules/javasci/src/java:$(top_srcdir)/modules/types/src/java::$(top_srcdir)/modules/localization/src/java \
240         org.scilab.modules.javasci org.scilab.modules.types
241
242 javadoc-all:
243         MASK="$(top_srcdir)/modules/*/src/java/"; \
244         MODULES=`ls -d $$MASK`; \
245         for M in $$MODULES; do \
246                 LISTMODULES="$$M:$$LISTMODULES"; \
247                 MODULE=$$(echo $$M|cut -d/ -f3); \
248                 LISTPKG="$$LISTPKG org.scilab.modules.$$MODULE"; \
249         done; \
250         $(JAVADOC) \
251         -d $(top_builddir)/javadocall \
252         -sourcepath $$LISTMODULES \
253         $$LISTPKG
254
255 doc-fr_FR:
256         @$(MAKE) $(AM_MAKEFLAGS) doc ALL_LINGUAS_DOC=fr_FR
257
258 doc-en_US:
259         @$(MAKE) $(AM_MAKEFLAGS) doc ALL_LINGUAS_DOC=en_US
260
261 doc-pt_BR:
262         @$(MAKE) $(AM_MAKEFLAGS) doc ALL_LINGUAS_DOC=pt_BR
263
264 doc-ru_RU:
265         @$(MAKE) $(AM_MAKEFLAGS) doc ALL_LINGUAS_DOC=ru_RU
266
267 doc-ja_JP:
268         @$(MAKE) $(AM_MAKEFLAGS) doc ALL_LINGUAS_DOC=ja_JP
269
270 # Regenerate all images
271 doc-images:
272         rm -rf $(top_srcdir)/modules/helptools/images/
273         mkdir $(top_srcdir)/modules/helptools/images/
274         $(MAKE) doc
275
276 doc: javadoc $(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
277 if BUILD_HELP
278         @if test -x $(top_builddir)/scilab-bin; then \
279                 cd $(top_builddir);\
280                 for l in $(ALL_LINGUAS_DOC); do \
281                         echo "-- Building documentation ($$l) --"; \
282                         COMMAND="try xmltojar([],[],'$$l');catch disp(lasterror()); exit(-1);end;exit(0);"; \
283                         echo "LANG=$$l.UTF-8 LC_ALL=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 _JAVA_OPTIONS='-Djava.awt.headless=true' HOME=/tmp $(top_builddir)/bin/scilab-adv-cli -noatomsautoload -nb -l $$l -nouserstartup -e \"$$COMMAND\"";\
284                         LANG=$$l.UTF-8 LC_ALL=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 _JAVA_OPTIONS='-Djava.awt.headless=true' HOME=/tmp $(top_builddir)/bin/scilab-adv-cli -noatomsautoload -nb -l $$l -nouserstartup -e "$$COMMAND" || exit 1;\
285                 done; \
286         else \
287                 echo "Cannot find Scilab-adv-cli binary"; \
288         fi
289 else
290         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
291 endif
292
293 doc-web: javadoc $(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
294 if BUILD_HELP
295         @if test -x $(top_builddir)/scilab-bin; then \
296                 cd $(top_builddir);\
297                 for l in $(ALL_LINGUAS_DOC); do \
298                         echo "-- Building documentation ($$l) --"; \
299                         COMMAND="try xmltoweb([],[],'$$l');catch exit(-1);end;exit(0);";\
300                         echo "LANG=$$l.UTF-8 SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 HOME=/tmp $(top_builddir)/bin/scilab-adv-cli -nb -l $$l -noatomsautoload -nouserstartup -e \"$$COMMAND\"";\
301                         LANG=$$l.UTF-8 SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 HOME=/tmp $(top_builddir)/bin/scilab-adv-cli -nb -l $$l -noatomsautoload -nouserstartup -e "$$COMMAND" || exit 1;\
302                         JAVADOC_TARGET=$(top_builddir)/modules/helptools/web/$$l/javasci; \
303                         if test ! -d $$JAVADOC_TARGET; then \
304                                 mkdir $$JAVADOC_TARGET; \
305                                 ln -s ../../../../javasci/javadoc/ $$JAVADOC_TARGET/; \
306                         fi; \
307                 done; \
308         else \
309                 echo "Cannot find Scilab-adv-cli binary"; \
310         fi
311 else
312         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
313 endif
314
315 $(top_builddir)/modules/helptools/data/pages/CHANGES.html: $(top_builddir)/CHANGES.md
316         sed -n '1,/html rendered CHANGES.md/{p;}' $@ >$@~
317         cmark $< >>$@~
318         sed -n '/End of the html rendered CHANGES.md/,$${p;}' $@ >>$@~
319         mv $@~ $@
320
321 doxygen: modules/development_tools/etc/doxyfile
322 if DOXYGEN
323         mkdir $(top_builddir)/reports/
324         $(DOXYGEN_BIN) modules/development_tools/etc/doxyfile
325 endif
326
327 check-help:$(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli
328         @if test -x $(top_builddir)/scilab-cli-bin; then \
329                 for l in $(ALL_LINGUAS_DOC); do \
330                         echo "-- Checking documentation ($$l) --"; \
331                         COMMAND="try check_help();catch exit(-1);end;exit(0);";\
332                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -noatomsautoload -nouserstartup -e \"$$COMMAND\"";\
333                         HOME=/tmp $(top_builddir)/bin/scilab-cli -nb -l $$l -noatomsautoload -nouserstartup -e "$$COMMAND" || exit 1;\
334                 done; \
335         else \
336                 echo "Cannot find Scilab binary"; \
337         fi
338
339 code-coverage:
340 if CODE_COVERAGE
341         @if test ! -d $(top_builddir)/coverage/; then \
342                 mkdir $(top_builddir)/coverage/; \
343         fi; \
344         $(LCOV) --directory $(top_builddir) --capture --ignore-errors source --output-file $(top_builddir)/coverage/scilab-code-coverage.info; \
345         if test ! -f ~/.lcovrc; then echo -e "genhtml_hi_limit = 85\ngenhtml_med_limit = 70" > ~/.lcovrc; fi; \
346         $(GENHTML) -o $(top_builddir)/coverage/results/ --show-details --highlight --legend $(top_builddir)/coverage/scilab-code-coverage.info; \
347         rm -f $(top_builddir)/coverage/lcovrc; \
348         echo "To open the result: firefox  $(top_builddir)/coverage/results/index.html";
349 #--frames is disable because of : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=607206
350 else
351         @echo "Cannot start the code coverage. Add --enable-code-coverage to the ./configure and 'make clean all'."
352 endif
353
354 distclean-recursive: distclean-generated clean-recursive
355
356 clean-recursive: clean-help clean-localization clean-macros clean-generated
357
358 clean-macros:
359 # Find is necessary because of subdirs...
360         -@echo "-- Cleaning macros (*.bin) --"; \
361         find $(top_builddir) -name "*.bin" | xargs --no-run-if-empty rm 2> /dev/null; \
362         echo "-- Cleaning lib files (lib) --"; \
363         find $(top_builddir)/modules/*/macros -name "lib" | xargs --no-run-if-empty rm 2> /dev/null
364
365 # To ensure previous compatibility
366 clean-doc: clean-help
367
368 clean-help:
369         -@if test -x $(top_builddir)/scilab-cli-bin; then \
370                 COMMAND="try clean_help();catch exit(-1);end;exit(0)"; \
371                 for l in $(ALL_LINGUAS_DOC); do \
372                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -noatomsautoload -nouserstartup -e '$$COMMAND'"; \
373                         HOME=/tmp $(top_builddir)/bin/scilab-cli -nb -l $$l -noatomsautoload -nouserstartup -e "$$COMMAND" || exit 1; \
374                 done; \
375         else \
376                 echo "Cannot find Scilab binary"; \
377         fi; \
378         echo "rmdir $(top_builddir)/modules/helptools/javaHelp/"; \
379         rm -rf $(top_builddir)/modules/helptools/javaHelp/; \
380         echo "rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help"; \
381         rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help; \
382         echo "rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml"; \
383         rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml; \
384         echo "rm -f $(top_builddir)/modules/scicos/jar/"; \
385         rm -rf $(top_builddir)/modules/scicos/jar/; \
386         echo "rm -rf $(top_builddir)/modules/javasci/javadoc"; \
387         rm -rf $(top_builddir)/modules/javasci/javadoc; \
388         echo "rm -rf $(top_builddir)/html"; \
389         rm -rf $(top_builddir)/html;
390
391 clean-tests:
392         @if test -x $(top_builddir)/scilab-cli-bin; then \
393                 HOME=/tmp $(top_builddir)/bin/scilab-cli -nb -noatomsautoload -nouserstartup -l fr -e 'try test_clean();catch exit(-1);end;exit(0);' || exit 1; \
394         else \
395                 echo "Cannot find Scilab binary"; \
396         fi
397
398 clean-localization:
399         rm -rf $(top_srcdir)/locale/*
400
401 clean-generated:
402 # Deleted junit + code coverage
403         rm -rf $(top_builddir)/reports/
404         rm -rf $(top_builddir)/modules/scicos_blocks/build/ 2> /dev/null
405
406 distclean-generated:
407         rm -f $(top_builddir)/modules/core/includes/stack.h 2> /dev/null
408
409
410 if IS_MACOSX
411 # Used for mac os x because it needs to remove the charset=UTF-8 because it is breaking the accents.
412 MACOSX=1
413 endif
414
415 clean-reports:
416         rm -f reports/xml/TEST-org.scilab.*.xml
417
418 # For each module, build and call Java unitary tests
419 # If fails, stops the call
420 check-java: clean-reports
421         @echo "-- Launch all Junit (Java) unitary tests"; \
422         MASK="$(top_srcdir)/modules/*/tests/java/"; \
423         MODULES=`ls -d $$MASK`; \
424         for M in $$MODULES; do \
425                 BASE=`echo $$M|sed -e "s|tests/java/$$||g"`; \
426                 $(ANT) -buildfile $$BASE/build.xml test || exit $$?; \
427         done
428         rm -f reports/xml/TEST-org.scilab.*.xml
429
430 codecoverage-java: clean-reports
431         @echo "Check if --enable-debug-java has been set"; \
432         grep "build.debug=on" $(top_srcdir)/scilab.properties > /dev/null || exit 10; \
433         echo "-- Launch all Junit (Java) unitary tests + code coverage"; \
434         MASK="$(top_srcdir)/modules/*/tests/java/"; \
435         MODULES=`ls -d $$MASK`; \
436         for M in $$MODULES; do \
437                 BASE=`echo $$M|sed -e "s|tests/java/$$||g"`; \
438                 $(ANT) -buildfile $$BASE/build.xml codecoverage || exit $$?; \
439         done
440         rm -f reports/xml/TEST-org.scilab.*.xml
441
442 # The user wants to compile the localization files
443 # Please note that ALL_LINGUAS is defined in configure.ac
444 if GENERATE_LOCALIZATION_FILES
445 localization:
446         @echo "-- Build localization (.mo from .po) --"; \
447         MASK="modules/*/locales/"; \
448         LC="LC_MESSAGES"; \
449         MSGFMT_OPTS="$MSGFMT_OPTS --check"; \
450         EXTENSION="*.po"; \
451         rm modules/*/locales/*~ 2> /dev/null; \
452         for LOCALE in $(ALL_LINGUAS); do \
453                 echo "        -- Building for $$LOCALE --"; \
454                 if test "$$LOCALE" == "en_US"; then \
455                         LOCFILE=$$MASK/*.pot; \
456                 else \
457                         LOCFILE=$$MASK/$$LOCALE$$EXTENSION; \
458                 fi; \
459                 FILES=`ls $$LOCFILE`; \
460                 PATHTO=$(top_builddir)/locale/$$LOCALE/$$LC/; \
461                 if test ! -d $$PATHTO; then \
462                         echo "        Creating $$PATHTO"; \
463                         mkdir -p $$PATHTO; \
464                 fi; \
465                 POFILE=$$PATHTO/$(LANG_DOMAIN).po; \
466                 $(MSGCAT) --use-first -o $$POFILE $$FILES || exit 2; \
467                 if test "$(MACOSX)" = "1"; then sed -i -e '/charset=UTF-8/d' $$POFILE; fi; \
468                 $(MSGFMT) $(MSGFMT_OPTS) --statistics -o $$PATHTO/$(LANG_DOMAIN).mo $$POFILE || exit 2; \
469         done;
470
471
472 localization-status:
473         @for LOCALE in $(ALL_LINGUAS_DOC); do \
474                 if test "$$LOCALE" != "en_US"; then \
475                         PATHTO=$(top_builddir)/locale-status/$$LOCALE/; \
476                         if test ! -d $$PATHTO; then \
477                                 echo "        Creating $$PATHTO"; \
478                                 mkdir -p $$PATHTO; \
479                         fi; \
480                         echo "Building status for $$LOCALE"; \
481                         echo "SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html"; \
482                         SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html; \
483                 fi; \
484         done;
485
486 endif
487
488 # Misc variable for the documentation installation
489
490 # How help files look like.
491 DOCMASK=scilab_*_help.jar
492 DOCIMAGES=scilab_images.jar
493
494 # Path to built files
495 PATHTOHELPFILES = modules/helptools/jar/
496
497 # Path to scirenderer jar
498 PATHTOSCIRENDERER = modules/scirenderer/jar/
499 SCIRENDERERJAR = scirenderer.jar
500
501 # Path javasci to built files
502 PATHTOJAVASCIDOC = modules/javasci/javadoc/
503 JAVASCI_DIRS = . resources \
504         org/scilab/modules/javasci/ \
505         org/scilab/modules/types/
506
507 install-data-local:
508 if GENERATE_LOCALIZATION_FILES
509         @$(mkinstalldirs) $(DESTDIR)$(localedir); \
510         echo $(mkinstalldirs) $(DESTDIR)$(localedir); \
511         for lang in $(ALL_LINGUAS); do \
512                 LANG_PATH_DIST=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/; \
513                 echo $(mkinstalldirs) $$LANG_PATH_DIST; \
514                 $(mkinstalldirs) $$LANG_PATH_DIST; \
515                 echo $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
516                 $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
517         done
518 endif
519 ################ INSTALL DOCUMENTATION #################
520 # Starting from Scilab 5, documentation file are provided by Docbook
521 # In the Scilab application we are generating a JavaHelp file.
522 if BUILD_HELP
523         @$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
524         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
525         if ls -lLd $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK) >/dev/null 2>&1; then \
526                 for file in $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK) $(top_builddir)/$(PATHTOHELPFILES)/$(DOCIMAGES); do \
527                     echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES)" ; \
528                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES) ; \
529                 done; \
530         fi
531 ## Install Javasci documentation (javadoc)
532 ## See target javadoc in this file to see how it is build
533         @if test -d $(PATHTOJAVASCIDOC); then \
534         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
535         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
536         for dir in $(JAVASCI_DIRS) ; do \
537                 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
538                 echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
539                         for file in $(top_builddir)/$(PATHTOJAVASCIDOC)/$(dir)/*; do \
540                             echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir" ; \
541                                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir ; \
542                         done; \
543         done; \
544         fi
545 endif
546 if !EXTERNAL_SCIRENDERER
547 if GUI
548 # Also install scirenderer.jar
549         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOSCIRENDERER)
550         $(INSTALL_DATA) $(top_builddir)/$(PATHTOSCIRENDERER)/$(SCIRENDERERJAR) $(DESTDIR)$(pkgdatadir)/$(PATHTOSCIRENDERER)/
551 endif
552 endif
553
554 # Pkgconfig directory
555 pkgconfigdir = $(libdir)/pkgconfig
556
557 # Files to install in Pkgconfig directory
558 pkgconfig_DATA = scilab.pc
559
560 .PHONY: macros localization doc strip-debug
561
562 .NOTPARALLEL: macros doc
563
564 include $(top_srcdir)/Makefile.call_scilab.am