2 ### Sylvestre Ledru <sylvestre.ledru@inria.fr>
3 ### INRIA - Scilab 2006/2007
5 ### Makefile included stuff
6 ### Target, variable, suffixes which are supposed to be usefull in every makefile.am
9 # Where all the Scilab stuff is installed (macros, help, ...)
10 mydatadir=$(pkgdatadir)/modules/$(modulename)
12 # This target enables tests for Scilab
13 check-local: $(top_builddir)/scilab-bin
14 @if test -f build.xml; then \
17 COMMAND="test_run('$(modulename)');quit";\
19 $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"
21 ########################### JAVA ######################################
22 #### We are delegating java compilation to ant... Thanks to that
23 #### the procedure will be the same with Microsoft Windows (C)
25 #######################################################################
32 # Some configurations needs to export JAVA_HOME in the current env
33 @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \
34 if test -f build.xml; then \
39 # Some configurations needs to export JAVA_HOME in the current env
40 @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \
41 if test -f build.xml; then \
48 # If the user request for the SWIG generation of the wrappers Java => C/C++
49 # We call the target swig-build on the variable SWIG_WRAPPERS
51 ## build Swig Java => C wrappers
52 swig: $(SWIG_WRAPPERS)
53 @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \
54 SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \
55 if test ! -z "$(SWIG_WRAPPERS)"; then \
56 for file in $(SWIG_WRAPPERS) ; do \
57 echo "Swig process of $$file ..."; \
58 $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \
68 # If the user request for the SWIG generation of the wrappers Java => C/C++
69 # We call the target swig-build on the variable SWIG_WRAPPERS
71 ## build Swig Java => C wrappers
72 giws: $(GIWS_WRAPPERS)
73 @GIWS_OUTPUTDIR=src/jni/;\
74 if test ! -z "$(GIWS_WRAPPERS)"; then \
75 for file in $(GIWS_WRAPPERS) ; do \
76 echo "GIWS process of $$file ..."; \
77 $(GIWS_BIN) --output-dir $$GIWS_OUTPUTDIR --description-file $$file; \
83 ##�Build the macros of the module
84 macros: $(top_builddir)/scilab-bin $(top_builddir)/bin/scilab $(srcdir)/$(MACRODIRS)/$(MACROMASK)
85 -@( $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\
89 all-local: $(TARGETS_ALL)
91 ################ MACROS ######################"
92 # Rule to build a macro
93 # NOT USED AT THE MOMENT
97 -@( if test ! -x $(top_builddir)/scilab-bin; then \
98 echo "Error : Cannot build $< : Scilab has not been build"; \
100 echo "Creating $@"; \
101 $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \
104 ########### INSTALL DOCUMENTATION ###################
105 # Install HTML files into the right target
106 # We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because
107 # automake needs the html files to be present which is not the case when
108 # we are building Scilab
110 # Where it should be installed
111 pkgdocdir = $(mydatadir)
113 # Which directories we have to install
114 DOCDIRS = help/fr_FR help/en_US
115 # What is the mask of the help output
118 # Which directories we have to install
119 DOCIMGDIRS = help/images
120 # What is the mask of the help images
123 # What is the mask of the help source
127 echo "-- Install of htm help files --"; \
128 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
129 @for dir in $(DOCDIRS) ; do \
130 if test -d $$dir; then \
131 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
132 if ls -lLd $(srcdir)/$$dir/$(DOCMASK) >/dev/null 2>&1; then \
133 for file in $(srcdir)/$$dir/$(DOCMASK) ; do \
134 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
135 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
140 echo "-- Install of images help files --"; \
141 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
142 @for dir in $(DOCIMGDIRS) ; do \
143 if test -d $$dir; then \
144 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
145 if ls -lLd $(srcdir)/$$dir/$(DOCIMGMASK) >/dev/null 2>&1; then \
146 for file in $(srcdir)/$$dir/$(DOCIMGMASK) ; do \
147 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
148 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
155 # If the user wants the help sources to be installed
156 @for dir in $(DOCDIRS) ; do \
157 if test -d $$dir; then \
158 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
159 if ls -lLd $(srcdir)/$$dir/$(DOCMASKXML) >/dev/null 2>&1; then \
160 for file in $(srcdir)/$$dir/$(DOCMASKXML) ; do \
161 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
162 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
169 ########### INSTALL DATA ###################
171 # Where it should be installed
172 pkgmacrosdir = $(mydatadir)
173 # Which directory we process
175 # Mask of the Scilab sources macros
177 # Mask of the Scilab executable sources macros
178 MACROBUILDMASK = *.sce
179 # Mask of the Scilab compiled macros
181 # List of the function of a module
182 FUNCTION_NAMES=macros/names
183 # Tests directory name
184 TESTS_DIR=tests/benchmarks tests/nonreg_tests tests/unit_tests
186 HELP_CHAPTERDIR=help/en_US/
187 HELP_CHAPTERFILE=addchapter.sce
188 # Where to export JAVA files (.jar)
193 @if test -f $(FUNCTION_NAMES); then \
194 echo "-- Install of declaration files --"; \
195 echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir); \
196 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir); \
197 echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$(MACRODIRS); \
198 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$(MACRODIRS); \
199 echo "$(INSTALL_DATA) $(FUNCTION_NAMES) $(DESTDIR)$(pkgmacrosdir)/macros/"; \
200 $(INSTALL_DATA) $(FUNCTION_NAMES) $(DESTDIR)$(pkgmacrosdir)/$(MACRODIRS); \
202 # Install the help chapter
203 @HELPFILE=$(HELP_CHAPTERDIR)$(HELP_CHAPTERFILE); \
204 if test -f $$HELPFILE; then \
205 echo "-- Install of help --"; \
206 echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR); \
207 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR); \
208 echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \
209 $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \
212 @echo "-- Install tests (if any) --"; \
213 for dir in $(TESTS_DIR); do \
214 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \
215 if test -d $(srcdir)/$$dir/; then \
216 for file in `ls -1 $(srcdir)/$$dir/* 2>/dev/null`; do \
217 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \
218 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \
223 @echo "-- Install macros (if any) --"; \
224 for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \
225 $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \
226 if test -d $(srcdir)/$$dir/; then \
227 for file in `ls -1 $(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/lib 2>/dev/null`; do \
228 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \
229 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \
233 # Install java files (.jar)
234 @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \
235 echo "-- Install jar files --"; \
236 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \
237 for file in $(srcdir)/$(JARDIR)$(JARMASK); do\
238 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \
239 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \
244 ########### CLEAN ###################
245 # Clean macros and help (generated automatically by Scilab)
247 clean-local: clean-java
251 # Removes macros (*.bin generated from .sci)
252 @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \
253 echo "rm -f $(srcdir)/$$dir/$(MACROBINMASK)"; \
254 rm -f $(srcdir)/$$dir/$(MACROBINMASK); \
256 # Removes documentation (*.htm generated from .xml)
257 @for dir in $(DOCDIRS) ; do \
258 if test -d $$dir; then \
259 echo "rm -f $(srcdir)/$$dir/$(DOCMASK)"; \
260 rm -f $(srcdir)/$$dir/$(DOCMASK); \