2 # Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 # Copyright (C) 2006-2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr>
4 # Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
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
14 ### Makefile included stuff
15 ### Target, variable, suffixes which are supposed to be useful in every makefile.am
18 # Where all the Scilab stuff is installed (macros, help, ...)
19 mydatadir=$(pkgdatadir)/modules/$(modulename)
21 # Set AM_* SCI detected settings
22 AM_CPPFLAGS = $(SCI_CPPFLAGS)
23 AM_CFLAGS = $(SCI_CFLAGS)
24 AM_CXXFLAGS = $(SCI_CXXFLAGS)
25 AM_FFLAGS = $(SCI_FFLAGS)
26 AM_LDFLAGS = $(SCI_LDFLAGS)
28 # Tag shared libraries with the Scilab version
29 AM_LDFLAGS += -version-number $(SCILAB_LIBRARY_VERSION)
30 # append includes to AM_FFLAGS to manage fortran includes
31 AM_FFLAGS += -I$(top_srcdir)/modules/core/includes/
33 # This target enables tests for Scilab
34 check-local: $(top_builddir)/scilab-bin test
35 if test -d $(mydatadir)/tests; then \
36 @COMMAND="try test_run('$(modulename)');catch exit(-1);end;exit(0)"; export LANG=C; $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"; \
40 SPLINT_OPTIONS=-weak -booltype BOOL
42 if test -f build.xml; then \
45 if test -x "$(SPLINT)"; then \
46 $(SPLINT) $(SPLINT_OPTIONS) -I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/ $(INCLUDE_FLAGS) $(CHECK_SRC); \
49 ########################### JAVA ######################################
50 #### We are delegating java compilation to ant... Thanks to that
51 #### the procedure will be the same with Microsoft Windows (C)
53 #######################################################################
59 # Some configurations needs to export JAVA_HOME in the current env
60 @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \
61 if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \
62 if test -f build.xml -a $$USEANT -eq 1; then \
67 # Some configurations needs to export JAVA_HOME in the current env
68 @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \
69 if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \
70 if test -f build.xml -a $$USEANT -eq 1; then \
77 # If the user request for the SWIG generation of the wrappers Java => C/C++
78 # We call the target swig-build on the variable SWIG_WRAPPERS
80 ## build Swig Java => C wrappers
81 swig: $(SWIG_WRAPPERS)
82 @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \
83 SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \
84 if test -n "$(SWIG_WRAPPERS)"; then \
85 for file in $(SWIG_WRAPPERS) ; do \
86 echo "Swig process of $$file ..."; \
87 $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \
94 # If the user request for the SWIG generation of the wrappers Java => C/C++
95 # We call the target swig-build on the variable SWIG_WRAPPERS
97 ## build Swig Java => C wrappers
98 giws: $(GIWS_WRAPPERS)
99 @GIWS_OUTPUTDIR=src/jni/;\
100 if test -n "$(GIWS_WRAPPERS)"; then \
101 for file in $(GIWS_WRAPPERS) ; do \
102 echo "GIWS process of $$file ..."; \
103 $(GIWS_BIN) --disable-return-size-array --output-dir $$GIWS_OUTPUTDIR --throws-exception-on-error --description-file $$file; \
107 ## build GIWS Exception
109 @GIWS_OUTPUTDIR=src/jni/;\
110 echo "GIWS: Generation of exception class ..."; \
111 $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR
116 ## Build the macros of the module
118 -@( if test ! -x $(top_builddir)/scilab-bin; then \
119 echo "Error : Cannot build $< : Scilab has not been built"; \
121 $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\
127 # Removes macros (*.bin generated from .sci)
128 @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \
129 echo "rm -f $(builddir)/$$dir/$(MACROBINMASK)"; \
130 rm -f $(builddir)/$$dir/$(MACROBINMASK); \
134 # More tests could be added here
135 @if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \
136 if test -f build.xml -a $$USEANT -eq 1; then \
142 all-local: $(TARGETS_ALL)
144 ################ MACROS ######################
145 # Rule to build a macro
146 # NOT USED AT THE MOMENT
150 -@( if test ! -x $(top_builddir)/scilab-bin; then \
151 echo "Error : Cannot build $< : Scilab has not been build"; \
153 echo "Creating $@"; \
154 $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \
157 ########### INSTALL DOCUMENTATION ###################
159 # Install documentation files into the right target
160 # We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because
161 # automake needs the html files to be present which is not the case when
162 # we are building Scilab
164 # Where it should be installed
165 pkgdocdir = $(mydatadir)
167 # What is the mask of the help source
170 # What is the mask of the MathML sources
175 install-data-local-local:
177 @if test -d $(srcdir)/javadoc; then \
178 cp -R $(srcdir)/javadoc $(DESTDIR)/$(mydatadir)/; \
181 # If the user wants the help sources to be installed
182 @echo "-------- Install of XML sources of help files --------"; \
183 for lang in $(ALL_LINGUAS); do \
184 if test -d $(srcdir)/help/$$lang; then \
185 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/$$lang && \
186 if ls -lLd $(srcdir)/help/$$lang/$(DOCMASKXML) >/dev/null 2>&1; then \
187 for file in $(srcdir)/help/$$lang/$(DOCMASKXML) ; do \
188 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/$$lang" ; \
189 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/$$lang ; \
194 @echo "-------- Install of MathML sources --------"; \
195 if test -d $(srcdir)/help/mml/; then \
196 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/mml/ && \
197 if ls -lLd $(srcdir)/help/mml/$(DOCMASKMML) >/dev/null 2>&1; then \
198 for file in $(srcdir)/help/mml/$(DOCMASKMML) ; do \
199 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/mml" ; \
200 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/mml ; \
206 ########### INSTALL DATA ###################
207 # Install macros, help & demos
208 # Where it should be installed
209 pkgmacrosdir = $(mydatadir)
210 # Which directory we process
212 # Mask of the Scilab sources macros
214 # Mask of the Scilab executable sources macros
215 MACROBUILDMASK = *.sce
216 # Mask of the Scilab compiled macros
218 # List of the standard directory for tests
219 TESTS_DIR=tests/benchmarks tests/nonreg_tests tests/unit_tests tests/java
220 # Where the demos should be installed
221 pkgdemosdir = $(mydatadir)
222 # List of the standard directory for demos
224 # List of the standard directory for examples
225 EXAMPLES_DIR=examples
226 # Where to export JAVA archives (.jar)
231 HELP_CHAPTERDIR=help/
232 HELP_CHAPTERFILE=addchapter.sce
233 HELP_CHAPTERLANG = en_US fr_FR pt_BR
236 @echo "-------- Install tests (if any) --------"; \
237 for dir in $(TESTS_DIR) $(TESTS_DIREXT) ; do \
238 if test -d $(srcdir)/$$dir/; then \
239 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \
240 for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \
241 if test -d "$(srcdir)/$$dir/$$file"; then \
242 echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir/$$file; \
243 $(mkinstalldirs) "$(DESTDIR)$(pkgmacrosdir)/$$dir/$$file"; \
245 echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \
246 $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \
251 # Install the help chapter
252 @echo "-------- Install the help chapter (if any) --------"; \
253 for lang in $(HELP_CHAPTERLANG); do \
254 HELPFILE=$(srcdir)/$(HELP_CHAPTERDIR)$$lang/$(HELP_CHAPTERFILE); \
255 if test -f $$HELPFILE; then \
256 echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \
257 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \
258 echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \
259 $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \
262 # Install the demos & examples
263 @echo "-------- Install demos & examples (if any) --------"; \
264 for dir in $(DEMOS_DIR) $(DEMOS_DIREXT) $(EXAMPLES_DIR) $(EXAMPLES_DIREXT) ; do \
265 if test -d $(srcdir)/$$dir/; then \
266 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
267 for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \
268 if test -d "$(srcdir)/$$dir/$$file"; then \
269 echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir/$$file; \
270 $(mkinstalldirs) "$(DESTDIR)$(pkgdocdir)/$$dir/$$file"; \
272 echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \
273 $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \
279 @echo "-------- Install macros (if any) --------"; \
280 for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \
281 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \
282 if test -d $(srcdir)/$$dir/; then \
283 FILELIST="$(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/names $(srcdir)/$$dir/lib";\
284 if test -n "$(MACROSSPECIALEXT)"; then \
286 for specialExt in $(MACROSSPECIALEXT); do \
287 specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \
289 FILELIST="$$FILELIST $$specialExtDir"; \
291 for file in `ls -1 $$FILELIST 2>/dev/null`; do \
292 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \
293 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \
297 # Install java files (.jar)
298 @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \
299 echo "-------- Install jar files --------"; \
300 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \
301 for file in $(srcdir)/$(JARDIR)$(JARMASK); do\
302 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \
303 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \
307 ########### CLEAN ###################
308 # Clean help (generated automatically by Scilab)
309 # It used to clean the macro (clean-macros) but this was causing
310 # make clean && make to fail Scilab startup
312 clean-local: clean-java
318 rm -f $(builddir)/help/*/.last_successful_build_javaHelp $(builddir)/help/*/.list_*
320 .PHONY: macros java swig giws