source: branches/dev-python-restructuring-20111129/Makefile.am @ 13800

Last change on this file since 13800 was 2972, checked in by jakesson, 8 years ago

Updated the build script for the python package restructure, see #1700.

File size: 11.8 KB
Line 
1#
2#    Copyright (C) 2009 Modelon AB
3#
4#    This program is free software: you can redistribute it and/or modify
5#    it under the terms of the Common Public License as published by
6#    IBM, version 1.0 of the License.
7#
8#    This program is distributed in the hope that it will be useful,
9#    but WITHOUT ANY WARRANTY. See the Common Public License for more details.
10#
11#    You should have received a copy of the Common Public License
12#    along with this program.  If not, see
13#     <http://www.ibm.com/developerworks/library/os-cpl.html/>.
14
15
16AUTOMAKE_OPTIONS = foreign
17
18# EXTRA_DIST =
19
20SUBDIRS = JMI/src ThirdParty/Blas ThirdParty/Lapack
21
22assimulo_install_dir=$(abs_builddir)/Assimulo_install
23jmodelica_install_dir=$(abs_builddir)/JModelica_install
24pyfmi_install_dir=$(abs_builddir)/PyFMI_install
25pyjmi_install_dir=$(abs_builddir)/PyJMI_install
26
27bindistdir=JModelica.org-$(VERSION)-bin
28
29all-local:
30if HAVE_ANT
31        cd $(abs_top_srcdir)/Compiler/ModelicaCompiler; \
32        $(ANT_OPTS) $(ANT)
33        cd $(abs_top_srcdir)/Compiler/OptimicaCompiler; \
34        $(ANT_OPTS) $(ANT)
35endif
36if WITH_SUNDIALS
37if WITH_SUPERLU
38        cd $(abs_top_srcdir)/Assimulo; \
39        python setup_source.py install --sundials-home=$(SUNDIALS_HOME) --superlu-home=$(SUPERLU_HOME) --blas-home=$(abs_builddir)/ThirdParty/Blas/ --prefix=$(assimulo_install_dir)
40endif
41endif
42if WITH_SUNDIALS
43if !WITH_SUPERLU
44        cd $(abs_top_srcdir)/Assimulo; \
45        python setup_source.py install --sundials-home=$(SUNDIALS_HOME) --prefix=$(assimulo_install_dir)
46endif
47endif
48
49        cd $(abs_top_srcdir)/Python/src; \
50        python setup_jmodelica.py install --prefix=$(jmodelica_install_dir); \
51        rm -rf build
52
53        cd $(abs_top_srcdir)/Python/src; \
54        python setup_pyfmi.py install --prefix=$(pyfmi_install_dir); \
55        rm -rf build
56
57        cd $(abs_top_srcdir)/Python/src; \
58        python setup_pyjmi.py install --prefix=$(pyjmi_install_dir); \
59        rm -rf build
60
61        $(abs_top_srcdir)/get_version.sh $(abs_top_srcdir) > $(abs_builddir)/version.txt
62        mkdir -p $(abs_builddir)/Options
63        $(abs_top_srcdir)/run_java.sh org.jmodelica.util.OptionRegistry $(abs_builddir)/Options/options.xml
64
65install-exec-local:
66if HAVE_ANT
67        cp $(abs_top_srcdir)/Compiler/ModelicaCompiler/bin/ModelicaCompiler.jar $(DESTDIR)$(prefix)/lib/
68        cp $(abs_top_srcdir)/Compiler/ModelicaCompiler/bin/util.jar $(DESTDIR)$(prefix)/lib/
69        cp $(abs_top_srcdir)/Compiler/ModelicaCompiler/bin/graphs.jar $(DESTDIR)$(prefix)/lib/
70        cp $(abs_top_srcdir)/Compiler/OptimicaCompiler/bin/OptimicaCompiler.jar $(DESTDIR)$(prefix)/lib/
71endif
72        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/LICENSE $(DESTDIR)$(prefix)/
73        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/lib/
74        cp $(abs_top_srcdir)/JMI/LICENSE_CPL $(DESTDIR)$(prefix)/lib/
75        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/include/
76        cp $(abs_top_srcdir)/JMI/LICENSE_CPL $(DESTDIR)$(prefix)/include/
77        mkdir -p $(DESTDIR)$(prefix)/Makefiles
78        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/Makefiles/LICENSE
79        case $(build) in \
80        *-cygwin*) \
81        cp $(abs_top_srcdir)/JMI/Makefiles/Makefile.windows $(DESTDIR)$(prefix)/Makefiles/Makefile ;; \
82        *-mingw*) \
83        cp $(abs_top_srcdir)/JMI/Makefiles/Makefile.windows $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
84        *-apple*) \
85        cp $(abs_top_srcdir)/JMI/Makefiles/Makefile.macosx $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
86        *) \
87        cp $(abs_top_srcdir)/JMI/Makefiles/Makefile.linux $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
88        esac
89        mkdir -p $(DESTDIR)$(prefix)/Options
90        cp $(abs_builddir)/Options/options.xml $(DESTDIR)$(prefix)/Options/options.xml
91        mkdir -p $(DESTDIR)$(prefix)/Python
92        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/Python/LICENSE $(DESTDIR)$(prefix)/Python
93        cd $(abs_top_srcdir)/Python/src/; find jmodelica -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python
94if WITH_SUNDIALS
95        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
96        if [ -e $(assimulo_install_dir)/$${pkgdir}/site-packages/ ]; \
97        then \
98        cd $(assimulo_install_dir)/$${pkgdir}/site-packages/; \
99        find assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
100        fi; \
101        done
102endif
103        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
104        if [ -e $(jmodelica_install_dir)/$${pkgdir}/site-packages/ ]; \
105        then \
106        cd $(jmodelica_install_dir)/$${pkgdir}/site-packages/; \
107        find jmodelica -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
108        fi; \
109        done
110        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
111        if [ -e $(pyjmi_install_dir)/$${pkgdir}/site-packages/ ]; \
112        then \
113        cd $(pyjmi_install_dir)/$${pkgdir}/site-packages/; \
114        find pyjmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
115        fi; \
116        done
117        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
118        if [ -e $(pyfmi_install_dir)/$${pkgdir}/site-packages/ ]; \
119        then \
120        cd $(pyfmi_install_dir)/$${pkgdir}/site-packages/; \
121        find pyfmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
122        fi; \
123        done
124        cd $(abs_top_srcdir)/Python/src/tests/; \
125        mkdir -p $(DESTDIR)$(prefix)/Python/tests; \
126        find . -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python/tests
127
128        mkdir -p $(DESTDIR)$(prefix)/bin
129        [ -e $(DESTDIR)$(prefix)/bin/jm_python.sh ] && echo "File exists, don't copy jm_python.sh" || cp Python/jm_python.sh $(DESTDIR)$(prefix)/bin/jm_python.sh
130        [ -e $(DESTDIR)$(prefix)/bin/jm_ipython.sh  ] && echo "File exists, don't jm_ipython.sh" || cp Python/jm_ipython.sh $(DESTDIR)$(prefix)/bin/jm_ipython.sh
131        cp $(abs_top_srcdir)/Python/src/startup.py $(DESTDIR)$(prefix)/
132        chmod ugo+x $(DESTDIR)$(prefix)/bin/jm_*.sh
133        mkdir -p $(DESTDIR)$(prefix)/ThirdParty
134        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Beaver
135        cp $(abs_top_srcdir)/ThirdParty/Beaver/beaver-0.9.6.1/LICENSE $(DESTDIR)$(prefix)/ThirdParty/Beaver/
136        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Beaver/lib
137        cp $(abs_top_srcdir)/ThirdParty/Beaver/beaver-0.9.6.1/lib/beaver.jar $(DESTDIR)$(prefix)/ThirdParty/Beaver/lib/
138        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD
139        cp $(CPPAD_HOME)/COPYING $(DESTDIR)$(prefix)/ThirdParty/CppAD
140        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad     
141        cp $(CPPAD_HOME)/cppad/*.h $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad
142        cp $(CPPAD_HOME)/cppad/*.hpp $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad
143        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad/local       
144        cp $(CPPAD_HOME)/cppad/local/*.hpp $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad/local
145        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy MSL" || cd $(abs_top_srcdir)/ThirdParty; find MSL -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/ThirdParty
146        mkdir -p $(DESTDIR)$(prefix)/CodeGenTemplates
147        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/CodeGenTemplates/LICENSE
148        cp  $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/jmi_modelica_template.c $(DESTDIR)$(prefix)/CodeGenTemplates
149        cp  $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/fmi_me_modelica_template.c $(DESTDIR)$(prefix)/CodeGenTemplates
150        cp  $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/fmi_cs_modelica_template.c $(DESTDIR)$(prefix)/CodeGenTemplates
151        cp  $(abs_top_srcdir)/Compiler/OptimicaCBackEnd/templates/jmi_optimica_template.c $(DESTDIR)$(prefix)/CodeGenTemplates
152        cp  $(abs_top_srcdir)/Compiler/ModelicaXMLBackEnd/templates/fmi_model_description.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
153        cp  $(abs_top_srcdir)/Compiler/ModelicaXMLBackEnd/templates/fmi_extended_model_description.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
154        cp  $(abs_top_srcdir)/Compiler/ModelicaXMLBackEnd/templates/jmodelica_model_description.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
155        cp  $(abs_top_srcdir)/Compiler/ModelicaXMLBackEnd/templates/jmodelica_model_values.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
156        mkdir -p $(DESTDIR)$(prefix)/XML
157        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML schemas"  || cp  $(abs_top_srcdir)/XML/*.xsd $(DESTDIR)$(prefix)/XML
158        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML LICENSE"  || cp  $(abs_top_srcdir)/XML/LICENSE $(DESTDIR)$(prefix)/XML
159        cp  $(abs_builddir)/version.txt $(DESTDIR)$(prefix)
160        cp jm_tests $(DESTDIR)$(prefix)/jm_tests
161        chmod ugo+x $(DESTDIR)$(prefix)/jm_tests
162
163
164bindistdir: install
165        rm -rf $(bindistdir)
166        mkdir -p $(bindistdir)
167        cp $(DESTDIR)$(prefix)/LICENSE $(bindistdir)
168        cp $(DESTDIR)$(prefix)/startup.py $(bindistdir)
169        cp $(DESTDIR)$(prefix)/version.txt $(bindistdir)
170        cp -r $(DESTDIR)$(prefix)/CodeGenTemplates $(bindistdir)
171        cp -r $(DESTDIR)$(prefix)/Makefiles $(bindistdir)
172        cp -r $(DESTDIR)$(prefix)/Options $(bindistdir)
173        cp -r $(DESTDIR)$(prefix)/Python $(bindistdir)
174        cp -r $(DESTDIR)$(prefix)/ThirdParty $(bindistdir)
175        cp -r $(DESTDIR)$(prefix)/XML $(bindistdir)
176        cp -r $(DESTDIR)$(prefix)/include $(bindistdir)
177        cp -r $(DESTDIR)$(prefix)/lib $(bindistdir)
178if COMPILE_WITH_IPOPT   
179        mkdir -p $(bindistdir)/ThirdParty/Ipopt
180# Copy files
181        cd $(IPOPT_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
182# Copy symbolic links
183        cd $(IPOPT_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
184endif
185
186if WITH_MINGW   
187        mkdir -p $(bindistdir)/ThirdParty/MinGW
188# Copy files
189        cd $(MINGW_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
190# Copy symbolic links
191        cd $(MINGW_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
192endif
193
194if WITH_SUNDIALS       
195        mkdir -p $(bindistdir)/ThirdParty/SUNDIALS
196# Copy files
197        cd $(SUNDIALS_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/SUNDIALS
198# Copy symbolic links
199        cd $(SUNDIALS_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/SUNDIALS
200endif
201
202bindist: bindistdir
203        tar -cf $(bindistdir).tar $(bindistdir)
204        gzip -c $(bindistdir).tar > $(bindistdir).tar.gz
205        rm -rf $(bindistdir)
206        rm -rf $(bindistdir).tar
207
208test: install
209        $(prefix)/jm_tests -i
210
211clean-local: clean-frontends clean-python-packages
212
213clean-python-packages:
214if WITH_SUNDIALS
215        cd $(abs_top_srcdir)/Assimulo; \
216        python setup_source.py clean --all --sundials-home=$(SUNDIALS_HOME)
217        rm -rf $(assimulo_install_dir)
218endif
219        cd $(abs_top_srcdir)/Python/src; \
220        python setup_jmodelica.py clean --all
221        rm -rf $(jmodelica_install_dir)
222        cd $(abs_top_srcdir)/Python/src; \
223        python setup_pyfmi.py clean --all
224        rm -rf $(pyfmi_install_dir)
225        cd $(abs_top_srcdir)/Python/src; \
226        python setup_pyjmi.py clean --all
227        rm -rf $(pyjmi_install_dir)
228
229clean-frontends:
230if HAVE_ANT
231        cd $(abs_top_srcdir)/Compiler/ModelicaCompiler; \
232        $(ANT_OPTS) $(ANT) clean
233        cd $(abs_top_srcdir)/Compiler/OptimicaCompiler; \
234        $(ANT_OPTS) $(ANT) clean
235endif
236
237docs:
238        cd $(abs_top_srcdir); doxygen doc/JMI/jmi_doxydoc.conf
239        cd $(abs_top_srcdir); doxygen doc/ModelicaCompiler/modelica_compiler_doxydoc.conf
240        cd $(abs_top_srcdir); doxygen doc/OptimicaCompiler/optimica_compiler_doxydoc.conf
241        make -C $(abs_top_srcdir)/doc/PyJMI html
242
243docbook-docs:
244        cd docbook/UsersGuide; $(MAKE) all
245
Note: See TracBrowser for help on using the repository browser.