########## ### Sylvestre Ledru ### INRIA - Scilab 2006/2007 ### ### Makefile included stuff ### Target, variable, suffixes which are supposed to be usefull in every makefile.am ########## # Where headers (*.h) are installed (usually /usr/include/scilab/) sciincludedir=${includedir}/scilab # Where all the Scilab stuff is installed (macros, help, ...) datadir=${datarootdir}/scilab/modules #SUFFIXES = .xml .sci .htm SUFFIXES = .sci .java .class .jar ########################### JAVA ###################################### #### We had to create those rules because autotools does NOT provide #### a kind of mechanism like C or Fortran sources : #### libsciboolean_la_SOURCES = plop.c plip.f #### #### It is why those rules exist. ####################################################################### # Replace all the .java by .class in JAVAFILES CLASSFILES = $(JAVAFILES:.java=.class) # Create path without src/java and rename .java by .class (needed by the jar # creation) CLASSFILESRELATIVE = `echo "$(JAVAFILES)"| sed -e 's|src/java/||g'|sed -e 's|\.java|\.class|g'` BUILT_SOURCES=$(CLASSFILES) # Compilation of Java %.class:%.java @echo; \ echo "Compiling Java source :" $< $(JAVAC) -classpath "$(CLASSPATH):$(JAVA_CLASSPATH)" $(JAVAC_FLAGS) $< # creation of the jar %.jar: $(CLASSFILES) @(echo; \ echo "Creation of the jar archive :"; \ cd $(CLASSPATH); \ $(JAR) cvf ../../$(JARFILE) $(CLASSFILESRELATIVE) ) CLEANFILES=$(CLASSFILES) ################ MACROS ######################" # Rule to build a macro .sci.bin: -@( if test ! -x $(top_builddir)/scilab-bin; then \ echo "Error : Cannot build $< : Scilab has not been build"; \ else \ echo "Creating $@"; \ $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \ fi ) ## Test purpose macrossly: @( if test ! -x $(top_builddir)/scilab-bin; then \ echo "Error : Cannot build $< : Scilab has not been build"; \ else \ LD_LIBRARY_PATH="$(JAVA_HOME)/jre/lib/i386/:$(JAVA_HOME)/jre/lib/i386/server/:$(JAVA_HOME)/jre/lib/i386/native_threads/:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; \ SCI=`cd $(top_builddir); pwd;`; export SCI; \ echo $$SCI/modules/functions/macros/genlib.bin; \ if test ! -f $$SCI/modules/functions/macros/genlib.bin; then \ (cd $$SCI; $$SCI/scilab-bin -ns -nwni -f $$SCI/modules/functions/scripts/buildmacros/buildmacros.sce;) \ fi; \ echo $(top_builddir)/scilab-bin -ns -nwni -f macros/buildmacros.sce; \ $(top_builddir)/scilab-bin -nwni -f macros/buildmacros.sce; \ fi ) ########### INSTALL DOCUMENTATION ################### # Install HTML files into the right target # We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because # automake needs the html files to be present which is not the case when # we are building Scilab # Where it should be installed pkgdocdir = $(target) # Which directories we have to install DOCDIRS = help/fr_FR help/en_US # What is the mask of the help output DOCMASK = *.htm # What is the mask of the help source DOCMASKXML = *.xml install-html-local: $(mkinstalldirs) $(DESTDIR)$(pkgdocdir) @for dir in $(DOCDIRS) ; do \ if test -d $$dir; then \ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ if ls -lLd $(srcdir)/$$dir/$(DOCMASK) >/dev/null 2>&1; then \ for file in $(srcdir)/$$dir/$(DOCMASK) ; do \ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \ done ; \ fi; \ fi; \ done if INSTALL_HELP_XML # If the user wants the help sources to be installed @for dir in $(DOCDIRS) ; do \ if test -d $$dir; then \ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ if ls -lLd $(srcdir)/$$dir/$(DOCMASKXML) >/dev/null 2>&1; then \ for file in $(srcdir)/$$dir/$(DOCMASKXML) ; do \ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \ done ; \ fi; \ fi; \ done endif ########### INSTALL DATA ################### # Install macros # Where it should be installed pkgmacrosdir = $(target) # Which directory we process MACRODIRS = macros/ # Mask of the Scilab sources macros MACROMASK = *.sci # Mask of the Scilab executable sources macros MACROBUILDMASK = *.sce # Mask of the Scilab compiled macros MACROBINMASK = *.bin # List of the function of a module FUNCTION_NAMES=macros/names # Localisation directory name LOCALISATIONDIRS=languages/fr_FR/ languages/en_US/ # List of the localisation (languages) files LOCALISATIONFILES = errors.xml menus.xml messages.xml install-data-local: $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir) $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$(MACRODIRS) @if test -f $(FUNCTION_NAMES); then \ echo "$(INSTALL_DATA) $(FUNCTION_NAMES) $(DESTDIR)$(pkgmacrosdir)/macros/"; \ $(INSTALL_DATA) $(FUNCTION_NAMES) $(DESTDIR)$(pkgmacrosdir)/$(MACRODIRS); \ fi # Install the macros @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ if test -d $(srcdir)/$$dir/; then \ for file in `ls -1 $(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/lib 2>/dev/null`; do \ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \ done; \ fi; \ done # Install the localisation files @for dir in $(LOCALISATIONDIRS) ; do \ if test -d $$dir; then \ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ for file in $(LOCALISATIONFILES) ; do \ echo "$(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \ $(INSTALL_DATA) "$$dir/$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \ done ; \ fi; \ done ########### CLEAN ################### # Clean macros and help (generated automatically by Scilab) clean-local: # Removes macros (*.bin generated from .sci) @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ echo "rm -f $(srcdir)/$$dir/$(MACROBINMASK)"; \ rm -f $(srcdir)/$$dir/$(MACROBINMASK); \ done # Removes documentation (*.htm generated from .xml) @for dir in $(DOCDIRS) ; do \ if test -d $$dir; then \ echo "rm -f $(srcdir)/$$dir/$(DOCMASK)"; \ rm -f $(srcdir)/$$dir/$(DOCMASK); \ fi; \ done macros:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab $(srcdir)/$(MACRODIRS)/$(MACROMASK) -@( \ LD_LIBRARY_PATH="$(JAVA_HOME)/jre/lib/i386/:$(JAVA_HOME)/jre/lib/i386/server/:$(JAVA_HOME)/jre/lib/i386/native_threads/:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH; \ $(top_builddir)/bin/scilab -nb -nwni -f $(abs_srcdir)/macros/buildmacros.sce )