better error msg
[scilab.git] / scilab / Makefile.am
1 ##########
2 ### Sylvestre Ledru <sylvestre.ledru@inria.fr>
3 ### INRIA - Scilab 2006/2008
4 ##########
5
6 ## Process this file with automake to produce Makefile.in (which will be changed by the ./configure)
7
8 AUTOMAKE_OPTIONS = 1.9 dist-zip dist-bzip2
9
10 SUBDIRS= libs \
11         modules
12
13 ACLOCAL_AMFLAGS = -I m4/
14
15 changelogs = CHANGES
16
17 bin_PROGRAMS            = scilab-bin
18
19 bin_SCRIPTS                     = bin/scilab
20
21 scilab_bin_SOURCES              = $(top_srcdir)/modules/core/src/c/main_linux.c
22
23 scilab_bin_LDFLAGS              = 
24 scilab_bin_CFLAGS               = 
25 # --no-undefined --relax
26
27
28 # libshell is mandatory here since main_linux.c depends on it.
29 scilab_bin_LDADD = $(top_builddir)/modules/libscilab.la \
30 $(top_builddir)/modules/shell/libscishell.la
31
32 if NEED_JAVA
33         scilab_bin_LDADD += $(JAVA_JNI_LIBS)
34 #       $(X_EXTRA_LIBS) -lXt -lX11 -lSM -lGLU
35 #else
36 #       scilab_bin_LDADD +=     $(X_EXTRA_LIBS)
37 endif
38
39
40 if ENABLE_STATIC
41 scilab_static_bin_LDFLAGS               = -static -static-libgcc --start-group
42 scilab_static_bin_CFLAGS =  -Wl,--start-group `$(CXX) -print-file-name=libstdc++.a`
43
44 #-static
45 bin_PROGRAMS                    += scilab-static-bin
46 scilab_static_bin_LDADD = $(top_builddir)/modules/libscilab.la
47
48 scilab_static_bin_SOURCES = $(scilab_bin_SOURCES)
49 endif
50
51
52 LANG_DOMAIN=scilab
53
54 TARGETS_ALL=macros
55 # doc
56
57 #  The user wants to compile the localization files
58 if GENERATE_LOCALIZATION_FILES
59 TARGETS_ALL+=localization
60 endif
61
62 all-local: $(TARGETS_ALL)
63
64 rootdir=$(pkgdatadir)/etc/
65 root_DATA = $(top_srcdir)/etc/scilab.start \
66 $(top_srcdir)/etc/scilab.quit \
67 $(top_srcdir)/etc/modules.xml \
68 $(top_srcdir)/etc/classpath.xml \
69 $(top_srcdir)/etc/librarypath.xml \
70 $(top_srcdir)/etc/toolboxes.xml
71
72
73 profilingdir=$(pkgdatadir)/tools/profiling/
74 profiling_DATA = $(top_srcdir)/tools/profiling/valgrind.supp
75
76
77 macros:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab
78         -@( cd $(top_builddir) ; \
79         echo "$(top_builddir)/bin/scilab -ns -nwni -f modules/functions/scripts/buildmacros/buildmacros.sce" ; \
80         $(top_builddir)/bin/scilab -ns -nwni -f modules/functions/scripts/buildmacros/buildmacros.sce)
81
82 doc:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab
83 if BUILD_HELP
84         -@if test -x $(top_builddir)/scilab-bin; then \
85                 cd $(top_builddir);\
86                 echo "-- Building documentation (English) --"; \
87                 echo "$(top_builddir)/bin/scilab -nb -l en_US -nouserstartup -nw -e \"xmltojar();exit;\"";\
88                 DOCBOOK_ROOT=$(DOCBOOK_ROOT) $(top_builddir)/bin/scilab -nb -l en_US -nouserstartup -nw -e "xmltojar();exit;";\
89                 echo "-- Building documentation (French) --"; \
90                 echo "$(top_builddir)/bin/scilab -nb -l fr_FR -nouserstartup -nw -e \"xmltojar();exit;\""; \
91                 DOCBOOK_ROOT=$(DOCBOOK_ROOT) $(top_builddir)/bin/scilab -nb -l fr_FR -nouserstartup -nw -e "xmltojar();exit;"; \
92         else \
93                 echo "Cannot find Scilab binary"; \
94         fi
95 else
96         @echo "Cannot buid help. Add --enable-build-help to the ./configure if you want to build it."
97 endif
98
99 check-help:$(top_builddir)/scilab-bin $(top_builddir)/bin/scilab
100         @if test -x $(top_builddir)/scilab-bin; then \
101                 echo "-- Checking documentation (English) --"; \
102                 $(top_builddir)/bin/scilab -nwni -nb -l en -e 'check_help();exit;';\
103                 echo "-- Checking documentation (French) --"; \
104                 $(top_builddir)/bin/scilab -nwni -nb -l fr -e 'check_help();exit;';\
105         else \
106                 echo "Cannot find Scilab binary"; \
107         fi
108
109 check-recursive: check-local
110 check-local:
111         @if test -x $(top_builddir)/scilab-bin; then \
112                 COMMAND="test_run();quit";\
113                 export LANG=C;\
114                 $(top_builddir)/bin/scilab -nw -nb -e "$$COMMAND"; \
115         else \
116                 echo "Cannot find Scilab binary"; \
117         fi
118
119 distclean-recursive: clean-recursive
120
121 clean-recursive: clean-doc clean-localization clean-macros
122
123 clean-macros:
124         @echo "-- Cleanning macros (*.bin) --"; \
125         find $(top_builddir) -name "*.bin" | xargs rm 2> /dev/null; \
126         echo "-- Cleanning names files (names) --"; \
127         find $(top_builddir)/modules/*/macros -name "names" | xargs rm 2> /dev/null; \
128         echo "-- Cleanning lib files (lib) --"; \
129         find $(top_builddir)/modules/*/macros -name "lib" | xargs rm 2> /dev/null
130
131
132 clean-doc:
133         @if test -x $(top_builddir)/scilab-bin; then \
134                 $(top_builddir)/bin/scilab -nwni -nb -l fr -e 'clean_help();exit;'; \
135                 $(top_builddir)/bin/scilab -nwni -nb -l en -e 'clean_help();exit;'; \
136         else \
137                 echo "Cannot find Scilab binary"; \
138         fi
139
140
141 clean-tests:
142         @if test -x $(top_builddir)/scilab-bin; then \
143                 $(top_builddir)/bin/scilab -nwni -nb -l fr -e 'test_clean();exit;'; \
144         else \
145                 echo "Cannot find Scilab binary"; \
146         fi
147
148
149 clean-localization:
150         rm -rf $(top_srcdir)/locale/
151
152
153 # The user wants to compile the localization files
154 # Please note that ALL_LINGUAS is defined in configure.ac 
155 if GENERATE_LOCALIZATION_FILES
156 localization:
157         @echo "-- Build localization (.mo from .po) --"; \
158         MASK="modules/*/locales/"; \
159         LC=LC_MESSAGES; \
160         MSGFMT_OPTS="$MSGFMT_OPTS --check"; \
161         FILENAME="*.po*"; \
162         rm modules/*/locales/*/*~ 2> /dev/null; \
163         for LOCALE in $(ALL_LINGUAS); do \
164                 echo "        -- Building for $$LOCALE --"; \
165                 FILES=`ls $$MASK/$$LOCALE/$$FILENAME`; \
166                 PATHTO=$(top_builddir)/locale/$$LOCALE/$$LC/; \
167                 if test ! -d $$PATHTO; then \
168                         echo "        Creating $$PATHTO"; \
169                         mkdir -p $$PATHTO; \
170                 fi; \
171                 POFILE=$$PATHTO/$(LANG_DOMAIN).po; \
172                 $(MSGCAT) -o $$POFILE $$FILES; \
173                 $(MSGFMT) $(MSGFMT_OPTS) --statistics -o $$PATHTO/$(LANG_DOMAIN).mo $$POFILE; \
174                 $(MSGFMT) $(MSGFMT_OPTS) --statistics --locale $$LOCALE -r org.scilab.modules.localization.Messages --java2 -d $(top_builddir)/modules/localization/build/classes/ $$POFILE; \
175         done; \
176         (cd $(top_srcdir)/modules/localization/; $(ANT) jar);
177 endif
178
179 # Misc variable for the documentation installation
180
181 # How help files look like.
182 DOCMASK=scilab_*_help.jar
183
184 # Path to builded files
185 PATHTOHELPFILES = modules/helptools/jar/
186
187 install-data-local:
188         @$(mkinstalldirs) $(DESTDIR)$(localedir); \
189         echo $(mkinstalldirs) $(DESTDIR)$(localedir); \
190         for lang in $(ALL_LINGUAS); do \
191                 LANG_PATH_DIST=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/; \
192                 echo $(mkinstalldirs) $$LANG_PATH_DIST; \
193                 $(mkinstalldirs) $$LANG_PATH_DIST; \
194                 echo $(INSTALL_DATA) locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
195                 $(INSTALL_DATA) locale/$$lang/LC_MESSAGES/$(LANG_DOMAIN).mo $$LANG_PATH_DIST/; \
196         done
197
198 ################ INSTALL DOCUMENTATION #################
199 # Starting from Scilab 5, documentation file are provided by Docbook
200 # In the Scilab application we are generating a JavaHelp file.
201 if BUILD_HELP
202         @$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
203         echo $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES); \
204         if ls -lLd $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK) >/dev/null 2>&1; then \
205                 for file in $(top_builddir)/$(PATHTOHELPFILES)/$(DOCMASK); do \
206                     echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES)" ; \
207                 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdatadir)/$(PATHTOHELPFILES) ; \
208                 done; \
209         fi
210 endif
211
212 # Pkgconfig directory
213 pkgconfigdir = $(libdir)/pkgconfig
214
215 # Files to install in Pkgconfig directory
216 pkgconfig_DATA = scilab.pc
217
218 .PHONY: macros localization doc
219
220 .NOTPARALLEL: macros doc
221
222