Desktop integration: provide some scilab mime types
[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.xml \
144 $(top_srcdir)/desktop/scilab.icns
145
146 valgrinddir=$(pkgdatadir)/tools/profiling
147 valgrind_DATA = $(top_srcdir)/tools/profiling/valgrind.supp
148
149 # Desktop file
150 # Note that here, it is datadir and NOT pkgdatadir
151 desktopdir = $(datadir)/applications
152 desktop_DATA = $(top_srcdir)/desktop/scilab-adv-cli.desktop \
153 $(top_srcdir)/desktop/scilab-cli.desktop \
154 $(top_srcdir)/desktop/scilab.desktop
155
156 macros:$(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli
157         -@( cd $(top_builddir) ; \
158         echo "$(top_builddir)/bin/scilab-cli -ns -f modules/functions/scripts/buildmacros/buildmacros.sce" ; \
159         $(top_builddir)/bin/scilab-cli -ns -f modules/functions/scripts/buildmacros/buildmacros.sce) || exit 1
160
161
162 # Build the public Javadoc (javasci v2 and Java/Scilab types)
163 # This is not done in the module itself because its needs also the "types"
164 # module
165 javadoc:
166         $(JAVADOC) -noindex -nohelp -nonavbar -notree \
167         -d $(top_builddir)/modules/javasci/javadoc \
168         -sourcepath $(top_srcdir)/modules/javasci/src/java:$(top_srcdir)/modules/types/src/java \
169         org.scilab.modules.javasci org.scilab.modules.types
170
171 doc: javadoc $(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
172 if BUILD_HELP
173         @if test -x $(top_builddir)/scilab-bin; then \
174                 cd $(top_builddir);\
175                 for l in $(ALL_LINGUAS_DOC); do \
176                         echo "-- Building documentation ($$l) --"; \
177                         COMMAND="try xmltojar([],[],'$$l');catch exit(-1);end;exit(0);"; \
178                         echo "LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -nouserstartup -e \"$$COMMAND\"";\
179                         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;\
180                 done; \
181         else \
182                 echo "Cannot find Scilab-adv-cli binary"; \
183         fi
184 else
185         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
186 endif
187
188 doc-web:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab-adv-cli
189 if BUILD_HELP
190         @if test -x $(top_builddir)/scilab-bin; then \
191                 cd $(top_builddir);\
192                 for l in $(ALL_LINGUAS_DOC); do \
193                         echo "-- Building documentation ($$l) --"; \
194                         COMMAND="try xmltoweb([],[],'$$l');catch exit(-1);end;exit(0);";\
195                         echo "LANG=C SCI_DISABLE_TK=1 SCI_JAVA_ENABLE_HEADLESS=1 $(top_builddir)/bin/scilab-adv-cli -nb -nouserstartup -e \"$$COMMAND\"";\
196                         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;\
197                         JAVADOC_TARGET=$(top_builddir)/modules/helptools/web/$$l/javasci; \
198                         if test ! -d $$JAVADOC_TARGET; then \
199                                 mkdir $$JAVADOC_TARGET; \
200                                 ln -s ../../../../javasci/javadoc/ $$JAVADOC_TARGET/; \
201                         fi; \
202                 done; \
203         else \
204                 echo "Cannot find Scilab-adv-cli binary"; \
205         fi
206 else
207         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
208 endif
209
210 check-help:$(top_builddir)/scilab-cli-bin $(top_builddir)/bin/scilab-cli
211         @if test -x $(top_builddir)/scilab-cli-bin; then \
212                 for l in $(ALL_LINGUAS_DOC); do \
213                         echo "-- Checking documentation ($$l) --"; \
214                         COMMAND="try check_help();catch exit(-1);end;exit(0);";\
215                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -e \"$$COMMAND\"";\
216                         $(top_builddir)/bin/scilab-cli -nb -l $$l -e "$$COMMAND" || exit 1;\
217                 done; \
218         else \
219                 echo "Cannot find Scilab binary"; \
220         fi
221
222 check-recursive: check-local
223 check-local:
224         @if test -x $(top_builddir)/scilab-bin; then \
225                 COMMAND="try test_run();catch exit(-1);end;exit(0)";\
226                 export LANG=C;\
227                 $(top_builddir)/bin/scilab-adv-cli -nb -e "$$COMMAND"; \
228         else \
229                 echo "Cannot find Scilab binary"; \
230         fi
231
232 code-coverage:
233 if CODE_COVERAGE
234         @if test ! -d $(top_builddir)/coverage/; then \
235                 mkdir $(top_builddir)/coverage/; \
236         fi; \
237         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; \
238         $(LCOV) --directory $(top_builddir) --capture --ignore-errors source --output-file $(top_builddir)/coverage/scilab-code-coverage.info; \
239         $(GENHTML) -o $(top_builddir)/coverage/results/ --show-details --highlight --legend $(top_builddir)/coverage/scilab-code-coverage.info; \
240         echo "To open the result: firefox  $(top_builddir)/coverage/results/index.html"; \
241         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
242 #--frames is disable because of : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=607206
243 else
244         @echo "Cannot start the code coverage. Add --enable-code-coverage to the ./configure and 'make clean all'."
245 endif
246
247 distclean-recursive: distclean-generated clean-recursive
248
249 clean-recursive: clean-help clean-localization clean-macros clean-generated
250
251 clean-macros:
252 # Find is necessary because of subdirs...
253         -@echo "-- Cleaning macros (*.bin) --"; \
254         find $(top_builddir) -name "*.bin" | xargs --no-run-if-empty rm 2> /dev/null; \
255         echo "-- Cleaning names files (names) --"; \
256         find $(top_builddir)/modules/*/macros -name "names" | xargs --no-run-if-empty rm 2> /dev/null; \
257         echo "-- Cleaning lib files (lib) --"; \
258         find $(top_builddir)/modules/*/macros -name "lib" | xargs --no-run-if-empty rm 2> /dev/null
259
260 # To ensure previous compatibility
261 clean-doc: clean-help
262
263 clean-help:
264         -@if test -x $(top_builddir)/scilab-cli-bin; then \
265                 COMMAND="try clean_help();catch exit(-1);end;exit(0)"; \
266                 for l in $(ALL_LINGUAS_DOC); do \
267                         echo "$(top_builddir)/bin/scilab-cli -nb -l $$l -e '$$COMMAND'"; \
268                         $(top_builddir)/bin/scilab-cli -nb -l $$l -e "$$COMMAND" || exit 1; \
269                 done; \
270         else \
271                 echo "Cannot find Scilab binary"; \
272         fi; \
273         echo "rmdir $(top_builddir)/modules/helptools/javaHelp/"; \
274         rm -rf $(top_builddir)/modules/helptools/javaHelp/; \
275         echo "rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help"; \
276         rm -rf $(top_builddir)/modules/scicos/help/*/scilab_*_help; \
277         echo "rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml"; \
278         rm -f $(top_builddir)/modules/scicos/help/en_US/master_help.xml; \
279         echo "rm -f $(top_builddir)/modules/scicos/jar/"; \
280         rm -rf $(top_builddir)/modules/scicos/jar/; \
281         echo "rm -rf $(top_builddir)/modules/javasci/javadoc"; \
282         rm -rf $(top_builddir)/modules/javasci/javadoc;
283
284 clean-tests:
285         @if test -x $(top_builddir)/scilab-cli-bin; then \
286                 $(top_builddir)/bin/scilab-cli -nb -l fr -e 'try test_clean();catch exit(-1);end;exit(0);' || exit 1; \
287         else \
288                 echo "Cannot find Scilab binary"; \
289         fi
290
291 clean-localization:
292         rm -rf $(top_srcdir)/locale/
293
294 clean-generated:
295         rm -rf $(top_builddir)/modules/scicos_blocks/build/ 2> /dev/null
296
297 distclean-generated:
298         rm -f $(top_builddir)/modules/core/includes/stack.h 2> /dev/null
299
300
301 if IS_MACOSX
302 # Used for mac os x because it needs to remove the charset=UTF-8 because it is breaking the accents.
303 MACOSX=1
304 endif
305
306 # For each module, build and call Java unitary tests
307 # If fails, stops the call
308 check-java:
309         @echo "-- Launch all TestNG (Java) unitary tests"; \
310         MASK="$(top_srcdir)/modules/*/tests/java/"; \
311         MODULES=`ls -d $$MASK`; \
312         for M in $$MODULES; do \
313                 BASE=`echo $$M|sed -e "s|tests/java/$$||g"`; \
314                 $(ANT) -buildfile $$BASE/build.xml test || exit $$?; \
315         done
316
317 # The user wants to compile the localization files
318 # Please note that ALL_LINGUAS is defined in configure.ac
319 if GENERATE_LOCALIZATION_FILES
320 localization:
321         @echo "-- Build localization (.mo from .po) --"; \
322         MASK="modules/*/locales/"; \
323         LC="LC_MESSAGES"; \
324         MSGFMT_OPTS="$MSGFMT_OPTS --check"; \
325         EXTENSION="*.po"; \
326         rm modules/*/locales/*~ 2> /dev/null; \
327         for LOCALE in $(ALL_LINGUAS); do \
328                 echo "        -- Building for $$LOCALE --"; \
329                 FILES=`ls $$MASK/$$LOCALE$$EXTENSION`; \
330                 PATHTO=$(top_builddir)/locale/$$LOCALE/$$LC/; \
331                 if test ! -d $$PATHTO; then \
332                         echo "        Creating $$PATHTO"; \
333                         mkdir -p $$PATHTO; \
334                 fi; \
335                 POFILE=$$PATHTO/$(LANG_DOMAIN).po; \
336                 $(MSGCAT) --use-first -o $$POFILE $$FILES; \
337                 if test "$(MACOSX)" = "1"; then sed -i -e '/charset=UTF-8/d' $$POFILE; fi; \
338                 $(MSGFMT) $(MSGFMT_OPTS) --statistics -o $$PATHTO/$(LANG_DOMAIN).mo $$POFILE; \
339         done;
340
341
342 localization-status:
343         @for LOCALE in $(ALL_LINGUAS_DOC); do \
344                 PATHTO=$(top_builddir)/locale-status/$$LOCALE/; \
345                 if test ! -d $$PATHTO; then \
346                         echo "        Creating $$PATHTO"; \
347                         mkdir -p $$PATHTO; \
348                 fi; \
349                 echo "Building status for $$LOCALE"; \
350                 echo "SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html"; \
351                 SCI=$(top_srcdir) php tools/localization/revcheck.php $$LOCALE > $$PATHTO/index.html; \
352         done; 
353
354 endif
355
356 # Misc variable for the documentation installation
357
358 # How help files look like.
359 DOCMASK=scilab_*_help.jar
360
361 # Path to builded files
362 PATHTOHELPFILES = modules/helptools/jar/
363
364 # Path javasci to builded files
365 PATHTOJAVASCIDOC = modules/javasci/javadoc/
366 JAVASCI_DIRS = . resources \
367         org/scilab/modules/javasci/ \
368         org/scilab/modules/types/
369
370 if GENERATE_LOCALIZATION_FILES
371 install-data-local:
372         @$(mkinstalldirs) $(DESTDIR)$(localedir); \
373         echo $(mkinstalldirs) $(DESTDIR)$(localedir); \
374         for lang in $(ALL_LINGUAS); do \
375                 LANG_PATH_DIST=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/; \
376                 echo $(mkinstalldirs) $$LANG_PATH_DIST; \
377                 $(mkinstalldirs) $$LANG_PATH_DIST; \
378                 echo $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
379                 $(INSTALL_DATA) $(top_builddir)/locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
380         done
381 endif
382
383 ################ INSTALL DOCUMENTATION #################
384 # Starting from Scilab 5, documentation file are provided by Docbook
385 # In the Scilab application we are generating a JavaHelp file.
386 if BUILD_HELP
387         @$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
388         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
389         if ls -lLd $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK) >/dev/null 2>&1; then \
390                 for file in $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK); do \
391                     echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES)" ; \
392                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES) ; \
393                 done; \
394         fi
395 ## Install Javasci documentation (javadoc)
396 ## See target javadoc in this file to see how it is build
397         @if test -d $(PATHTOJAVASCIDOC); then \
398         $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
399         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC); \
400         for dir in $(JAVASCI_DIRS) ; do \
401                 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
402                 echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir; \
403                         for file in $(top_builddir)/$(PATHTOJAVASCIDOC)/$(dir)/*; do \
404                             echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir" ; \
405                                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOJAVASCIDOC)/$$dir ; \
406                         done; \
407         done; \
408         fi
409 endif
410
411 # Pkgconfig directory
412 pkgconfigdir = $(libdir)/pkgconfig
413
414 # Files to install in Pkgconfig directory
415 pkgconfig_DATA = scilab.pc
416
417 .PHONY: macros localization doc
418
419 .NOTPARALLEL: macros doc
420
421 include $(top_srcdir)/Makefile.call_scilab.am