62481d1bfa2d8301d892695529c3680fa4cdd1d6
[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 # This file must be used under the terms of the CeCILL.
7 # This source file is licensed as described in the file COPYING, which
8 # you should have received as part of this distribution.  The terms
9 # are also available at
10 # http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11 #
12
13 ## Process this file with automake to produce Makefile.in (which will be changed by the ./configure)
14
15 AUTOMAKE_OPTIONS = 1.11 dist-zip dist-bzip2
16
17 SUBDIRS= libs \
18         modules \
19         contrib
20
21 ACLOCAL_AMFLAGS = -I m4/
22
23 changelogs = CHANGES CHANGES_5.1.X CHANGES_5.2.X CHANGES_5.3.X CHANGES_5.4.X
24
25 bin_PROGRAMS            = scilab-bin scilab-cli-bin
26
27 bin_SCRIPTS                     = bin/scilab bin/scilab-adv-cli bin/scilab-cli
28
29 if IS_MACOSX
30 bin_SCRIPTS             += bin/checkmacosx.applescript
31 endif
32
33 scilab_bin_LDFLAGS              =
34 scilab_cli_bin_LDFLAGS          =
35
36 if IS_MACOSX
37 scilab_bin_LDFLAGS              += -framework Cocoa
38 endif
39
40 scilab_bin_CFLAGS               = -I$(top_srcdir)/modules/io/includes
41 # --no-undefined --relax
42
43 # Localization dep already exists because of the `exportLocaleToSystem' symbol
44 # (causing issues on some platform)
45 COMMON_LIBS = $(top_builddir)/modules/core/libscicore.la \
46 $(top_builddir)/modules/completion/libscicompletion.la \
47 $(top_builddir)/modules/localization/libscilocalization.la \
48 $(top_builddir)/modules/io/libsciio.la \
49 $(LTLIBINTL)
50
51 SCILAB_LIB=$(top_builddir)/modules/libscilab.la
52 SCILAB_CLI_LIB=$(top_builddir)/modules/libscilab-cli.la
53
54
55 scilab_bin_SOURCES              = $(top_srcdir)/modules/console/src/c/others/mainscic.c
56
57 scilab_bin_LDADD                = $(COMMON_LIBS) $(SCILAB_LIB)
58
59 # Match scilab -nwni (ie command line without graphics)
60 scilab_cli_bin_SOURCES  = $(top_srcdir)/modules/console/src/c/others/mainscic.c
61
62 scilab_cli_bin_CFLAGS           = -DWITHOUT_GUI -I$(top_srcdir)/modules/io/includes
63 scilab_cli_bin_LDADD            = $(COMMON_LIBS) $(SCILAB_CLI_LIB)
64
65
66 if NEED_JAVA
67 # Don't do it for scilab_cli_bin. We want to be able to call it without
68 # the java libs
69         scilab_bin_LDADD += $(JAVA_JNI_LIBS)
70 endif
71
72 if IS_SOLARIS
73 # The binary itself needs this dep
74         scilab_bin_LDADD += $(BLAS_LIBS)
75 endif
76
77 if ENABLE_STATIC
78 scilab_static_bin_LDFLAGS               = -static -static-libgcc --start-group
79 scilab_static_bin_CFLAGS =  -Wl,--start-group `$(CXX) -print-file-name=libstdc++.a`
80
81 #-static
82 bin_PROGRAMS                    += scilab-static-bin
83 scilab_static_bin_LDADD = $(top_builddir)/modules/libscilab.la
84
85 scilab_static_bin_SOURCES = $(scilab_bin_SOURCES)
86 endif
87
88 LANG_DOMAIN=scilab
89
90 TARGETS_ALL=macros
91
92 #  The user wants to compile the localization files
93 if GENERATE_LOCALIZATION_FILES
94 TARGETS_ALL+=localization
95 endif
96
97 if COMPILATION_TESTS
98 TARGETS_ALL+=check-java
99 endif
100
101 all-local: $(TARGETS_ALL)
102
103 rootdir=$(pkgdatadir)/etc/
104 root_DATA = $(top_srcdir)/etc/scilab.start \
105 $(top_srcdir)/etc/scilab.quit \
106 $(top_srcdir)/etc/toolboxes.xml \
107 $(top_builddir)/etc/jvm_options.xml \
108 $(top_builddir)/etc/modules.xml \
109 $(top_builddir)/etc/classpath.xml \
110 $(top_builddir)/etc/logging.properties \
111 $(top_builddir)/etc/librarypath.xml
112
113 infofilesdir=$(pkgdatadir)/
114 infofiles_DATA = $(top_srcdir)/CHANGES_2.X \
115 $(top_srcdir)/CHANGES_3.X \
116 $(top_srcdir)/CHANGES_4.X \
117 $(top_srcdir)/CHANGES_5.0.X \
118 $(top_srcdir)/CHANGES_5.1.X \
119 $(top_srcdir)/CHANGES_5.2.X \
120 $(top_srcdir)/CHANGES_5.3.X \
121 $(top_srcdir)/CHANGES_5.4.X \
122 $(top_srcdir)/ACKNOWLEDGEMENTS \
123 $(top_srcdir)/COPYING \
124 $(top_srcdir)/COPYING-BSD \
125 $(top_srcdir)/COPYING-FR \
126 $(top_srcdir)/README_Unix \
127 $(top_srcdir)/RELEASE_NOTES_5.0.X \
128 $(top_srcdir)/RELEASE_NOTES_5.1.X \
129 $(top_srcdir)/RELEASE_NOTES_5.2.X \
130 $(top_srcdir)/RELEASE_NOTES_5.3.X \
131 $(top_srcdir)/Readme_Visual.txt \
132 $(top_srcdir)/README_Windows.txt \
133 $(top_builddir)/Version.incl
134
135 iconsdir=$(pkgdatadir)/desktop/
136 icons_DATA = $(top_srcdir)/desktop/scilab.png \
137 $(top_srcdir)/desktop/puffin_128.png \
138 $(top_srcdir)/desktop/puffin_256.png \
139 $(top_srcdir)/desktop/puffin_32.png \
140 $(top_srcdir)/desktop/puffin_48.png \
141 $(top_srcdir)/desktop/puffin.png \
142 $(top_srcdir)/desktop/puffin.icns \
143 $(top_srcdir)/desktop/scilab.icns
144
145 valgrinddir=$(pkgdatadir)/tools/profiling
146 valgrind_DATA = $(top_srcdir)/tools/profiling/valgrind.supp
147
148 # Desktop file
149 # Note that here, it is datadir and NOT pkgdatadir
150 desktopdir = $(datadir)/applications
151 desktop_DATA = $(top_srcdir)/desktop/scilab-adv-cli.desktop \
152 $(top_srcdir)/desktop/scilab-cli.desktop \
153 $(top_srcdir)/desktop/scilab.desktop
154
155 macros:$(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli
156         -@( cd $(top_builddir) ; \
157         echo "$(top_builddir)/bin/scilab-cli -ns -f modules/functions/scripts/buildmacros/buildmacros.sce" ; \
158         $(top_builddir)/bin/scilab-cli -ns -f modules/functions/scripts/buildmacros/buildmacros.sce) || exit 1
159
160
161 # Build the public Javadoc (javasci v2 and Java/Scilab types)
162 # This is not done in the module itself because its needs also the "types"
163 # module
164 javadoc:
165         $(JAVADOC) -noindex -nohelp -nonavbar -notree \
166         -d $(top_builddir)/modules/javasci/javadoc \
167         -sourcepath $(top_srcdir)/modules/javasci/src/java:$(top_srcdir)/modules/types/src/java \
168         org.scilab.modules.javasci org.scilab.modules.types
169
170 doc: javadoc $(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
171 if BUILD_HELP
172         @if test -x $(top_builddir)/scilab-bin; then \
173                 cd $(top_builddir);\
174                 for l in $(ALL_LINGUAS_DOC); do \
175                         echo "-- Building documentation ($$l) --"; \
176                         COMMAND="try xmltojar([],[],'$$l');catch exit(-1);end;exit(0);"; \
177                         echo "LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -nouserstartup -e \"$$COMMAND\"";\
178                         LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -l $$l -nouserstartup -e "$$COMMAND" || exit 1;\
179                 done; \
180         else \
181                 echo "Cannot find Scilab-adv-cli binary"; \
182         fi
183 else
184         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
185 endif
186
187 doc-web:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
188 if BUILD_HELP
189         @if test -x $(top_builddir)/scilab-bin; then \
190                 cd $(top_builddir);\
191                 for l in $(ALL_LINGUAS_DOC); do \
192                         echo "-- Building documentation ($$l) --"; \
193                         COMMAND="try xmltoweb([],[],'$$l');catch exit(-1);end;exit(0);";\
194                         echo "LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -nouserstartup -e \"$$COMMAND\"";\
195                         LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -l $$l -nouserstartup -e "$$COMMAND" || exit 1;\
196                         JAVADOC_TARGET=$(top_builddir)/modules/helptools/web/$$l/javasci; \
197                         if test ! -d $$JAVADOC_TARGET; then \
198                                 mkdir $$JAVADOC_TARGET; \
199                                 ln -s ../../../../javasci/javadoc/ $$JAVADOC_TARGET/; \
200                         fi; \
201                 done; \
202         else \
203                 echo "Cannot find Scilab-adv-cli binary"; \
204         fi
205 else
206         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
207 endif
208
209 check-help:$(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli
210         @if test -x $(top_builddir)/scilab-cli-bin; then \
211                 for l in $(ALL_LINGUAS_DOC); do \
212                         echo "-- Checking documentation ($$l) --"; \
213                         COMMAND="try check_help();catch exit(-1);end;exit(0);";\
214                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -e \"$$COMMAND\"";\
215                         $(top_builddir)/bin/scilab-cli -nb -l $$l -e "$$COMMAND" || exit 1;\
216                 done; \
217         else \
218                 echo "Cannot find Scilab binary"; \
219         fi
220
221 check-recursive: check-local
222 check-local:
223         @if test -x $(top_builddir)/scilab-bin; then \
224                 COMMAND="try test_run();catch exit(-1);end;exit(0)";\
225                 export LANG=C;\
226                 $(top_builddir)/bin/scilab-adv-cli -nb -e "$$COMMAND"; \
227         else \
228                 echo "Cannot find Scilab binary"; \
229         fi
230
231 code-coverage:
232 if CODE_COVERAGE
233         @if test ! -d $(top_builddir)/coverage/; then \
234                 mkdir $(top_builddir)/coverage/; \
235         fi; \
236         touch $(top_srcdir)/modules/differential_equations/callinter.h $(top_srcdir)/modules/linear_algebra/callinter.h $(top_srcdir)/modules/scicos/callinter.h $(top_srcdir)/modules/scicos_blocks/callinter.h; \
237         $(LCOV) --directory $(top_builddir) --capture --ignore-errors source --output-file $(top_builddir)/coverage/scilab-code-coverage.info; \
238         $(GENHTML) -o $(top_builddir)/coverage/results/ --show-details --highlight --legend $(top_builddir)/coverage/scilab-code-coverage.info; \
239         echo "To open the result: firefox  $(top_builddir)/coverage/results/index.html"; \
240         rm -f $(top_srcdir)/modules/differential_equations/callinter.h $(top_srcdir)/modules/linear_algebra/callinter.h $(top_srcdir)/modules/scicos/callinter.h $(top_srcdir)/modules/scicos_blocks/callinter.h
241 #--frames is disable because of : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=607206
242 else
243         @echo "Cannot start the code coverage. Add --enable-code-coverage to the ./configure and 'make clean all'."
244 endif
245
246 distclean-recursive: distclean-generated clean-recursive
247
248 clean-recursive: clean-help clean-localization clean-macros clean-generated
249
250 clean-macros:
251 # Find is necessary because of subdirs...
252         -@echo "-- Cleaning macros (*.bin) --"; \
253         find $(top_builddir) -name "*.bin" | xargs --no-run-if-empty rm 2> /dev/null; \
254         echo "-- Cleaning names files (names) --"; \
255         find $(top_builddir)/modules/*/macros -name "names" | xargs --no-run-if-empty rm 2> /dev/null; \
256         echo "-- Cleaning lib files (lib) --"; \
257         find $(top_builddir)/modules/*/macros -name "lib" | xargs --no-run-if-empty rm 2> /dev/null
258
259 # To ensure previous compatibility
260 clean-doc: clean-help
261
262 clean-help:
263         -@if test -x $(top_builddir)/scilab-cli-bin; then \
264                 COMMAND="try clean_help();catch exit(-1);end;exit(0)"; \
265                 for l in $(ALL_LINGUAS_DOC); do \
266                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -e '$$COMMAND'"; \
267                         $(top_builddir)/bin/scilab-cli -nb -l $$l -e "$$COMMAND" || exit 1; \
268                 done; \
269         else \
270                 echo "Cannot find Scilab binary"; \
271         fi; \
272         echo "rmdir $(top_builddir)/modules/helptools/javaHelp/"; \
273         rm -rf $(top_builddir)/modules/helptools/javaHelp/; \
274         echo "rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help"; \
275         rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help; \
276         echo "rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml"; \
277         rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml; \
278         echo "rm -f $(top_builddir)/modules/scicos/jar/"; \
279         rm -rf $(top_builddir)/modules/scicos/jar/; \
280         echo "rm -rf $(top_builddir)/modules/javasci/javadoc"; \
281         rm -rf $(top_builddir)/modules/javasci/javadoc;
282
283 clean-tests:
284         @if test -x $(top_builddir)/scilab-cli-bin; then \
285                 $(top_builddir)/bin/scilab-cli -nb -l fr -e 'try test_clean();catch exit(-1);end;exit(0);' || exit 1; \
286         else \
287                 echo "Cannot find Scilab binary"; \
288         fi
289
290 clean-localization:
291         rm -rf $(top_srcdir)/locale/
292
293 clean-generated:
294         rm -rf $(top_builddir)/modules/scicos_blocks/build/ 2> /dev/null
295
296 distclean-generated:
297         rm -f $(top_builddir)/modules/core/includes/stack.h 2> /dev/null
298
299
300 if IS_MACOSX
301 # Used for mac os x because it needs to remove the charset=UTF-8 because it is breaking the accents.
302 MACOSX=1
303 endif
304
305 # For each module, build and call Java unitary tests
306 # If fails, stops the call
307 check-java:
308         @echo "-- Launch all TestNG (Java) unitary tests"; \
309         MASK="$(top_srcdir)/modules/*/tests/java/"; \
310         MODULES=`ls -d $$MASK`; \
311         for M in $$MODULES; do \
312                 BASE=`echo $$M|sed -e "s|tests/java/$$||g"`; \
313                 $(ANT) -buildfile $$BASE/build.xml test || exit $$?; \
314         done
315
316 # The user wants to compile the localization files
317 # Please note that ALL_LINGUAS is defined in configure.ac
318 if GENERATE_LOCALIZATION_FILES
319 localization:
320         @echo "-- Build localization (.mo from .po) --"; \
321         MASK="modules/*/locales/"; \
322         LC="LC_MESSAGES"; \
323         MSGFMT_OPTS="$MSGFMT_OPTS --check"; \
324         EXTENSION="*.po"; \
325         rm modules/*/locales/*~ 2> /dev/null; \
326         for LOCALE in $(ALL_LINGUAS); do \
327                 echo "        -- Building for $$LOCALE --"; \
328                 FILES=`ls $$MASK/$$LOCALE$$EXTENSION`; \
329                 PATHTO=$(top_builddir)/locale/$$LOCALE/$$LC/; \
330                 if test ! -d $$PATHTO; then \
331                         echo "        Creating $$PATHTO"; \
332                         mkdir -p $$PATHTO; \
333                 fi; \
334                 POFILE=$$PATHTO/$(LANG_DOMAIN).po; \
335                 $(MSGCAT) --use-first -o $$POFILE $$FILES; \
336                 if test "$(MACOSX)" = "1"; then sed -i -e '/charset=UTF-8/d' $$POFILE; fi; \
337                 $(MSGFMT) $(MSGFMT_OPTS) --statistics -o $$PATHTO/$(LANG_DOMAIN).mo $$POFILE; \
338         done;
339
340
341 localization-status:
342         @for LOCALE in $(ALL_LINGUAS_DOC); do \
343                 PATHTO=$(top_builddir)/locale-status/$$LOCALE/; \
344                 if test ! -d $$PATHTO; then \
345                         echo "        Creating $$PATHTO"; \
346                         mkdir -p $$PATHTO; \
347                 fi; \
348                 echo "Building status for $$LOCALE"; \
349                 echo "SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html"; \
350                 SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html; \
351         done; 
352
353 endif
354
355 # Misc variable for the documentation installation
356
357 # How help files look like.
358 DOCMASK=scilab_*_help.jar
359
360 # Path to builded files
361 PATHTOHELPFILES = modules/helptools/jar/
362
363 # Path javasci to builded files
364 PATHTOJAVASCIDOC = modules/javasci/javadoc/
365 JAVASCI_DIRS = . resources \
366         org/scilab/modules/javasci/ \
367         org/scilab/modules/types/
368
369 if GENERATE_LOCALIZATION_FILES
370 install-data-local:
371         @$(mkinstalldirs) $(DESTDIR)$(localedir); \
372         echo $(mkinstalldirs) $(DESTDIR)$(localedir); \
373         for lang in $(ALL_LINGUAS); do \
374                 LANG_PATH_DIST=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/; \
375                 echo $(mkinstalldirs) $$LANG_PATH_DIST; \
376                 $(mkinstalldirs) $$LANG_PATH_DIST; \
377                 echo $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
378                 $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
379         done
380 endif
381
382 ################ INSTALL DOCUMENTATION #################
383 # Starting from Scilab 5, documentation file are provided by Docbook
384 # In the Scilab application we are generating a JavaHelp file.
385 if BUILD_HELP
386         @$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
387         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
388         if ls -lLd $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK) >/dev/null 2>&1; then \
389                 for file in $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK); do \
390                     echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES)" ; \
391                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES) ; \
392                 done; \
393         fi
394 ## Install Javasci documentation (javadoc)
395 ## See target javadoc in this file to see how it is build
396         @if test -d $(PATHTOJAVASCIDOC); then \
397         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
398         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
399         for dir in $(JAVASCI_DIRS) ; do \
400                 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
401                 echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
402                         for file in $(top_builddir)/$(PATHTOJAVASCIDOC)/$(dir)/*; do \
403                             echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir" ; \
404                                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir ; \
405                         done; \
406         done; \
407         fi
408 endif
409
410 # Pkgconfig directory
411 pkgconfigdir = $(libdir)/pkgconfig
412
413 # Files to install in Pkgconfig directory
414 pkgconfig_DATA = scilab.pc
415
416 .PHONY: macros localization doc
417
418 .NOTPARALLEL: macros doc
419
420 include $(top_srcdir)/Makefile.call_scilab.am