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