source: branches/1.16.x/Makefile.am @ 13800

Last change on this file since 13800 was 8035, checked in by Jonathan Kämpe, 4 years ago

#4578 Update casadi_interface build target

File size: 22.9 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
17ACLOCAL_AMFLAGS = -I m4
18
19
20# EXTRA_DIST =
21
22# SUBDIRS = ThirdParty/Sundials ThirdParty/Zlib ThirdParty/Minizip ThirdParty/Expat JMI/src ThirdParty/Blas ThirdParty/Lapack external/FMILibrary
23SUBDIRS = ThirdParty/Sundials ThirdParty/Minpack JMI/src ThirdParty/Blas ThirdParty/Lapack external/FMILibrary RuntimeLibrary Python/src/tests_jmodelica/files/Modelica/Resources
24
25assimulo_install_dir=$(abs_builddir)/Assimulo_install
26pymodelica_install_dir=$(abs_builddir)/pymodelica_install
27pyfmi_install_dir=$(abs_builddir)/PyFMI_install
28pyjmi_install_dir=$(abs_builddir)/PyJMI_install
29
30bindistdir=JModelica.org-$(VERSION)-bin
31
32casadi:
33        cd $(abs_builddir)/ThirdParty/CasADi; \
34        make -f Makefile CMAKE_PYTHON_LIBRARY=$(PYTHON_LIB) CMAKE_PYTHON_INCLUDE_DIR=$(PYTHON_INCLUDE)
35
36install_casadi: casadi
37        cd $(abs_builddir)/ThirdParty/CasADi; \
38        make -f Makefile install CMAKE_PYTHON_LIBRARY=$(PYTHON_LIB) CMAKE_PYTHON_INCLUDE_DIR=$(PYTHON_INCLUDE) 
39        mkdir -p $(DESTDIR)$(prefix)/Python/
40        cp -r $(abs_builddir)/casadi_install/casadi $(DESTDIR)$(prefix)/Python/
41        ## temp fix
42        cp $(abs_builddir)/casadi_build/swig/casadi_core.py $(DESTDIR)$(prefix)/Python/casadi
43
44## Install for CasADiInterface, Variables and targets.
45## MC_interface installs the system with Python.
46## If C++ compilation/tests are wanted there is the target MC_interface_cplusplus
47
48MC_INTERFACE=$(abs_top_srcdir)/ModelicaCasADiInterface
49
50export CASADI_HOME=$(abs_top_srcdir)/ThirdParty/CasADi/CasADi
51MC_SRC="$(JAVA_CASADI_BASE_DIR)/ModelicaCompilerCasADi"
52OC_SRC=$(JAVA_CASADI_BASE_DIR)/OptimicaCompilerCasADi
53MC_SRC_SWIG=$(abs_top_srcdir)/Compiler/ModelicaCompilerCasADi/src/swig
54
55# Export location to put the 'ifcasadi' directory containing java files generated by swig
56export IFCASADI_OUTDIR=$(MC_SRC)
57
58# Export basedir where the casadi interface jcc generation can find
59# compiler jars, also unquote.
60export IFCASADI_JAR_BASE=$(shell echo $(JAVA_CASADI_BASE_DIR))
61
62# The modelica casadi interface is built into a build folder
63MC_BUILD=$(abs_builddir)/ModelicaCasADiInterfaceBuild
64# Jars from the modified modelica and optimica compilers are put into the JModelica folder
65MC_COMPILERS_DIR=$(MC_BUILD)/JModelica.org
66MC_LIB=$(DESTDIR)$(prefix)/lib/casadi_interface
67
68CASADI_BUILD_DIR=$(abs_builddir)/casadi_build
69SWIGCHECK_BUILD_DIR=$(abs_builddir)/swig_check
70
71
72# The CMake for ModelicaCasADi needs these variables.
73export MODELICA_CASADI_HOME= $(MC_INTERFACE)
74export MC_BUILD
75export IPOPT_HOME
76export CASADI_BUILD_DIR
77export SWIGCHECK_BUILD_DIR
78
79casadi_interface: install_casadi_interface
80build_casadi_interface: casadi modelicacasadi_wrapper
81install_casadi_interface: install_casadi $(MC_LIB) $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/modelica_casadi_transfer_wrapper.py
82        if [ "$(INSTALL_EXTRA_CASADI)" ]; then exec "$(INSTALL_EXTRA_CASADI)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
83
84ifcasadi: casadi
85        mkdir -p $(MC_BUILD)/ifcasadi; \
86        cd $(MC_BUILD)/ifcasadi; \
87        case $(build) in \
88        *-cygwin*) \
89        cmake $(MC_SRC_SWIG) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" ;; \
90        *-mingw*) \
91        cmake $(MC_SRC_SWIG) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" ;; \
92        *) \
93        cmake $(MC_SRC_SWIG) ;; \
94        esac
95        cd $(MC_BUILD)/ifcasadi;  make
96
97$(MC_LIB): $(MC_SRC)/bin/ModelicaCompiler.jar $(OC_SRC)/bin/OptimicaCompiler.jar $(MC_SRC)/bin/util.jar ifcasadi
98        rm -rf $(MC_LIB)
99        mkdir -p $(MC_LIB)
100        cp $(MC_SRC)/bin/ModelicaCompiler.jar $(MC_LIB)
101        cp $(OC_SRC)/bin/OptimicaCompiler.jar $(MC_LIB)
102        cp $(MC_SRC)/bin/util.jar $(MC_LIB)
103        case $(build) in \
104        *-cygwin*) \
105        cp $(MC_BUILD)/ifcasadi/ifcasadi.dll $(MC_LIB) ;; \
106        *-mingw*) \
107        cp $(MC_BUILD)/ifcasadi/ifcasadi.dll $(MC_LIB) ;; \
108        *) \
109        cp $(MC_BUILD)/ifcasadi/libifcasadi.so $(MC_LIB) ;; \
110        esac
111
112mc_modelica: ifcasadi
113        cd $(MC_SRC); $(ANT_OPTS) $(ANT) "-Dcompiler=$(COMPILER_DIR)"
114
115mc_optimica: ifcasadi
116        mkdir -p $(OC_SRC)/src/java-generated
117        cp -pr $(MC_SRC)/src/java-generated/ifcasadi $(OC_SRC)/src/java-generated
118        cd $(OC_SRC); $(ANT_OPTS) $(ANT) "-Dcompiler=$(COMPILER_DIR)"
119
120$(MC_SRC)/bin/ModelicaCompiler.jar: mc_modelica
121$(MC_SRC)/bin/util.jar:             mc_modelica
122$(MC_SRC)/bin/separateProcess.jar:  mc_modelica
123
124$(OC_SRC)/bin/OptimicaCompiler.jar: mc_optimica
125$(OC_SRC)/bin/util.jar:             mc_optimica
126$(OC_SRC)/bin/separateProcess.jar:  mc_optimica
127
128$(MC_BUILD)/modelicacasadi_wrapper/swig/modelicacasadi_wrapper.py: modelicacasadi_wrapper
129
130# Hook for using a specific Python installation
131PYTHON_LIB=
132PYTHON_INCLUDE=
133
134modelicacasadi_wrapper: $(MC_SRC)/bin/ModelicaCompiler.jar $(OC_SRC)/bin/OptimicaCompiler.jar $(MC_SRC)/bin/util.jar ifcasadi # $(MC_LIB)
135        if [ "$(PYTHON_LIB)" ] && [ "$(PYTHON_INCLUDE)" ]; then \
136          CMAKE_EXTRA_ARGS="-DPYTHON_LIBRARY=$(PYTHON_LIB) -DPYTHON_INCLUDE_DIR=$(PYTHON_INCLUDE)"; \
137        else \
138          CMAKE_EXTRA_ARGS=""; \
139        fi; \
140        mkdir -p $(MC_BUILD)/modelicacasadi_wrapper; \
141        cd $(MC_BUILD)/modelicacasadi_wrapper; \
142        case $(build) in \
143        *-cygwin*) \
144        cmake $(MC_INTERFACE) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" $${CMAKE_EXTRA_ARGS} ;; \
145        *-mingw*) \
146        cmake $(MC_INTERFACE) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" $${CMAKE_EXTRA_ARGS} ;; \
147        *) \
148        cmake $(MC_INTERFACE) $${CMAKE_EXTRA_ARGS} ;; \
149        esac
150        cd $(MC_BUILD)/modelicacasadi_wrapper;  make modelicacasadi_wrapper
151
152
153 $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py: install_modelicacasadi_transfer
154 $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/modelica_casadi_transfer_wrapper.py: install_modelicacasadi_transfer
155 
156 $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py: install_modelicacasadi_wrapper
157 
158 install_modelicacasadi_wrapper: $(MC_BUILD)/modelicacasadi_wrapper/swig/modelicacasadi_wrapper.py
159        mkdir -p $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper
160        cp $(MC_BUILD)/modelicacasadi_wrapper/swig/*modelicacasadi_wrapper* $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper
161        rm -f $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
162        touch $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
163        echo "from modelicacasadi_wrapper import *" >> $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
164
165 install_modelicacasadi_transfer: $(MC_INTERFACE)/python/modelica_casadi_transfer_wrapper.py
166        mkdir -p $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
167        rm -f $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
168        touch $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
169        echo "from modelica_casadi_transfer_wrapper import *" >> $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
170        cp $(MC_INTERFACE)/python/modelica_casadi_transfer_wrapper.py $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
171
172build-python-packages:
173if WITH_SUNDIALS
174if WITH_SUPERLU
175        cd $(abs_top_srcdir)/external/Assimulo; \
176        case $(build) in \
177        *-cygwin*) \
178        python setup.py install --sundials-home=$(SUNDIALS_HOME) --superlu-home=$(SUPERLU_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --force-32bit="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(assimulo_install_dir) ;; \
179        *-mingw*) \
180        python setup.py install --sundials-home=$(SUNDIALS_HOME) --superlu-home=$(SUPERLU_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --force-32bit="true" --no-msvcr="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(assimulo_install_dir) ;; \
181        *) \
182        python setup.py install --sundials-home=$(SUNDIALS_HOME) --superlu-home=$(SUPERLU_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --prefix=$(assimulo_install_dir) ;; \
183        esac
184endif
185endif
186if WITH_SUNDIALS
187if !WITH_SUPERLU
188        cd $(abs_top_srcdir)/external/Assimulo; \
189        case $(build) in \
190        *-cygwin*) \
191        python setup.py install --sundials-home=$(SUNDIALS_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --force-32bit="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(assimulo_install_dir) ;; \
192        *-mingw*) \
193        python setup.py install --sundials-home=$(SUNDIALS_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --force-32bit="true" --no-msvcr="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(assimulo_install_dir) ;; \
194        *) \
195        python setup.py install --sundials-home=$(SUNDIALS_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --prefix=$(assimulo_install_dir) ;; \
196        esac
197endif
198endif
199        cd $(abs_top_srcdir)/Python/src; \
200        python setup_pymodelica.py install --prefix=$(pymodelica_install_dir); \
201        rm -rf build
202
203        cd $(abs_top_srcdir)/external/PyFMI; \
204        case $(build) in \
205        *-cygwin*) \
206        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install/ --force-32bit="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(pyfmi_install_dir) ;; \
207        *-mingw*) \
208        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install/ --force-32bit="true" --no-msvcr="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(pyfmi_install_dir) ;; \
209        *) \
210        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install/ --prefix=$(pyfmi_install_dir) ;; \
211        esac
212        rm -rf build
213
214        cd $(abs_top_srcdir)/Python/src; \
215        python setup_pyjmi.py install --prefix=$(pyjmi_install_dir); \
216        rm -rf build
217
218install-python-packages: build-python-packages
219        mkdir -p $(DESTDIR)$(prefix)/Python
220        cp $(abs_top_srcdir)/Python/src/startup.py $(DESTDIR)$(prefix)/
221        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/Python/LICENSE $(DESTDIR)$(prefix)/Python
222if WITH_SUNDIALS
223        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
224        if [ -e $(assimulo_install_dir)/$${pkgdir}/site-packages/ ]; \
225        then \
226        cd $(assimulo_install_dir)/$${pkgdir}/site-packages/; \
227        find assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
228        fi; \
229        done
230endif
231        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
232        if [ -e $(pymodelica_install_dir)/$${pkgdir}/site-packages/ ]; \
233        then \
234        cd $(pymodelica_install_dir)/$${pkgdir}/site-packages/; \
235        find pymodelica -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
236        fi; \
237        done
238        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
239        if [ -e $(pyjmi_install_dir)/$${pkgdir}/site-packages/ ]; \
240        then \
241        cd $(pyjmi_install_dir)/$${pkgdir}/site-packages/; \
242        find pyjmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
243        fi; \
244        done
245        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
246        if [ -e $(pyfmi_install_dir)/$${pkgdir}/site-packages/ ]; \
247        then \
248        cd $(pyfmi_install_dir)/$${pkgdir}/site-packages/; \
249        find pyfmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
250        fi; \
251        done
252        cd $(abs_top_srcdir)/Python/src/tests_jmodelica/; \
253        mkdir -p $(DESTDIR)$(prefix)/Python/tests_jmodelica; \
254        find . -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python/tests_jmodelica
255        rm -rf $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/src
256        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/CMakeLists.txt
257        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/Makefile.am
258        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/Makefile.in
259        mkdir -p $(DESTDIR)$(prefix)/bin
260        [ -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
261        [ -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
262        chmod ugo+x $(DESTDIR)$(prefix)/bin/jm_*.sh
263
264# Hooks for extra build or install actions. Must be empty or the path of a shell script to execute.
265# Both scripts will get the source directory as the first argument and the install directory as the second.
266BUILD_EXTRA=
267INSTALL_EXTRA=
268INSTALL_EXTRA_CASADI=
269
270# Paths for Java build
271JAVA_BUILD_DIR=$(abs_builddir)/java
272COMPILER_DIR=$(abs_top_srcdir)/Compiler
273JAVA_MC_ANT_FILE=$(COMPILER_DIR)/ModelicaCompiler/build.xml
274JAVA_OC_ANT_FILE=$(COMPILER_DIR)/OptimicaCompiler/build.xml
275JAVA_CASADI_BASE_DIR=$(COMPILER_DIR)
276JAVA_EXEC_CP=$(JAVA_BUILD_DIR)/bin/ModelicaCompiler.jar:$(JAVA_BUILD_DIR)/bin/util.jar:$(abs_top_srcdir)/ThirdParty/Beaver/beaver-0.9.6.1/lib/beaver-rt.jar
277
278all-local: build-python-packages build-compiler prepare-doc-src
279        $(abs_top_srcdir)/get_version.sh $(abs_top_srcdir) https://svn.jmodelica.org > $(abs_builddir)/version.txt
280        if [ "$(BUILD_EXTRA)" ]; then exec "$(BUILD_EXTRA)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
281
282build-compiler:
283if HAVE_ANT
284        mkdir -p $(JAVA_BUILD_DIR)
285        cd $(JAVA_BUILD_DIR); \
286        $(ANT_OPTS) $(ANT) -f "$(JAVA_MC_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)"
287        cd $(JAVA_BUILD_DIR); \
288        $(ANT_OPTS) $(ANT) -f "$(JAVA_OC_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)"
289        java -cp "$(JAVA_EXEC_CP)" org.jmodelica.modelica.compiler.ModelicaCompiler\$$OptionExporter -x "$(abs_builddir)/DefaultOptions.xml"
290endif
291
292# Paths for doc
293DOC_BUILD_DIR=$(abs_builddir)/docbook/UsersGuide
294DOC_SRC_DIR=$(abs_top_srcdir)/docbook/UsersGuide
295
296prepare-doc-src: build-compiler
297        mkdir -p "$(DOC_BUILD_DIR)"
298        cp -rT "$(DOC_SRC_DIR)" "$(DOC_BUILD_DIR)"
299        rm "$(DOC_BUILD_DIR)/Options.xml" "$(DOC_BUILD_DIR)/JModelicaUsersGuide.pdf"
300        java -cp "$(JAVA_EXEC_CP)" org.jmodelica.modelica.compiler.ModelicaCompiler\$$OptionExporter -t "$(DOC_SRC_DIR)/Options.xml" -d "$(DOC_BUILD_DIR)/Options.xml"
301
302install-exec-local: install-python-packages
303if HAVE_ANT
304        cp $(JAVA_BUILD_DIR)/bin/ModelicaCompiler.jar $(DESTDIR)$(prefix)/lib/
305        cp $(JAVA_BUILD_DIR)/bin/util.jar $(DESTDIR)$(prefix)/lib/
306        cp $(JAVA_BUILD_DIR)/bin/OptimicaCompiler.jar $(DESTDIR)$(prefix)/lib/
307        cp $(JAVA_BUILD_DIR)/bin/separateProcess.jar $(DESTDIR)$(prefix)/lib/
308endif
309        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/LICENSE $(DESTDIR)$(prefix)/
310        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/lib/
311        cp $(abs_top_srcdir)/JMI/LICENSE_CPL $(DESTDIR)$(prefix)/lib/
312        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/include/
313        cp $(abs_top_srcdir)/JMI/LICENSE_CPL $(DESTDIR)$(prefix)/include/
314        mkdir -p $(DESTDIR)$(prefix)/Makefiles
315        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/Makefiles/LICENSE
316        case $(build) in \
317        *-cygwin*) \
318        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.windows $(DESTDIR)$(prefix)/Makefiles/Makefile ;; \
319        *-mingw*) \
320        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.windows $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
321        *-apple*) \
322        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.macosx $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
323        *) \
324        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.linux $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
325        esac
326
327if COPY_PTHREADS_LIB
328        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/pthreads/lib
329        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/pthreads/include
330        cp $(abs_top_srcdir)/ThirdParty/pthreads/lib/win32/libpthreadGC2-2-9-1.a $(DESTDIR)$(prefix)/ThirdParty/pthreads/lib
331        cp $(abs_top_srcdir)/ThirdParty/pthreads/include/*.h $(DESTDIR)$(prefix)/ThirdParty/pthreads/include
332endif
333
334        cp $(abs_builddir)/DefaultOptions.xml $(DESTDIR)$(prefix)/DefaultOptions.xml
335        mkdir -p $(DESTDIR)$(prefix)/ThirdParty
336        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Beaver
337        cp $(abs_top_srcdir)/ThirdParty/Beaver/beaver-0.9.6.1/LICENSE $(DESTDIR)$(prefix)/ThirdParty/Beaver/
338        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Beaver/lib
339        cp $(abs_top_srcdir)/ThirdParty/Beaver/beaver-0.9.6.1/lib/beaver-rt.jar $(DESTDIR)$(prefix)/ThirdParty/Beaver/lib/
340        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Sundials
341        cp -r $(SUNDIALS_HOME)/* $(DESTDIR)$(prefix)/ThirdParty/Sundials
342        cp $(abs_top_srcdir)/ThirdParty/Sundials/sundials-2.5.0/LICENSE $(DESTDIR)$(prefix)/ThirdParty/Sundials
343if JM_WIN64
344        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Sundials/lib64
345        cp -r $(SUNDIALS_HOME)64/lib/* $(DESTDIR)$(prefix)/ThirdParty/Sundials/lib64
346endif
347        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Minpack
348        cp -r $(DESTDIR)$(MINPACK_HOME)/* $(DESTDIR)$(prefix)/ThirdParty/Minpack
349        cp $(abs_top_srcdir)/ThirdParty/Minpack/cminpack-1.3.2/CopyrightMINPACK.txt $(DESTDIR)$(prefix)/ThirdParty/Minpack
350        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD
351        cp $(CPPAD_HOME)/COPYING $(DESTDIR)$(prefix)/ThirdParty/CppAD
352        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad     
353        cp $(CPPAD_HOME)/cppad/*.h $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad
354        cp $(CPPAD_HOME)/cppad/*.hpp $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad
355        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad/local       
356        cp $(CPPAD_HOME)/cppad/local/*.hpp $(DESTDIR)$(prefix)/ThirdParty/CppAD/cppad/local
357        if [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ]; then \
358          echo "Installing in dist directory, don't copy MSL"; \
359        else \
360          mkdir -p "$(DESTDIR)$(prefix)/ThirdParty/MSL/Modelica"; \
361          mkdir -p "$(DESTDIR)$(prefix)/ThirdParty/MSL/ModelicaServices"; \
362          cd "$(DESTDIR)$(prefix)/ThirdParty/MSL"; \
363          find . -depth -print0 | while read -d $$'\0' -r f ; do if [ ! -e "$(abs_top_srcdir)/ThirdParty/MSL/$${f}" ]; then rm -rf "$${f}"; fi; done; \
364          cd "$(abs_top_srcdir)/ThirdParty/MSL/Modelica"; \
365          find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C "$(DESTDIR)$(prefix)/ThirdParty/MSL/Modelica"; \
366          cd "$(abs_top_srcdir)/ThirdParty/MSL/ModelicaServices"; \
367          find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C "$(DESTDIR)$(prefix)/ThirdParty/MSL/ModelicaServices"; \
368          cd "$(abs_top_srcdir)/ThirdParty/MSL"; \
369          $(CP) Complex.mo "$(DESTDIR)$(prefix)/ThirdParty/MSL"; \
370        fi
371        mkdir -p $(DESTDIR)$(prefix)/CodeGenTemplates
372        mkdir -p $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
373        cp $(abs_top_srcdir)/JMI/LICENSE_GPL $(DESTDIR)$(prefix)/CodeGenTemplates/LICENSE
374        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/*.c $(DESTDIR)$(prefix)/CodeGenTemplates
375        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/FMIBase/*.c $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
376        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/FMIBase/*.h $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
377        cp  $(abs_top_srcdir)/Compiler/OptimicaCBackEnd/templates/jmi_optimica_template.c $(DESTDIR)$(prefix)/CodeGenTemplates
378        cp  $(abs_top_srcdir)/Compiler/ModelicaFMUXBackEnd/templates/*.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
379        mkdir -p $(DESTDIR)$(prefix)/XML
380        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML schemas"  || cp  $(abs_top_srcdir)/XML/*.xsd $(DESTDIR)$(prefix)/XML
381        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML LICENSE"  || cp  $(abs_top_srcdir)/XML/LICENSE $(DESTDIR)$(prefix)/XML
382        cp  $(abs_builddir)/version.txt $(DESTDIR)$(prefix)
383        chmod ugo+x jm_tests
384        cp -p jm_tests $(DESTDIR)$(prefix)/jm_tests
385        if [ "$(INSTALL_EXTRA)" ]; then exec "$(INSTALL_EXTRA)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
386
387bindistdir: install
388        rm -rf $(bindistdir)
389        mkdir -p $(bindistdir)
390        cp $(DESTDIR)$(prefix)/LICENSE $(bindistdir)
391        cp $(DESTDIR)$(prefix)/startup.py $(bindistdir)
392        cp $(DESTDIR)$(prefix)/version.txt $(bindistdir)
393        cp $(DESTDIR)$(prefix)/DefaultOptions.xml $(bindistdir)
394        cp -r $(DESTDIR)$(prefix)/CodeGenTemplates $(bindistdir)
395        cp -r $(DESTDIR)$(prefix)/Makefiles $(bindistdir)
396        cp -r $(DESTDIR)$(prefix)/Python $(bindistdir)
397        cp -r $(DESTDIR)$(prefix)/ThirdParty $(bindistdir)
398        cp -r $(DESTDIR)$(prefix)/XML $(bindistdir)
399        cp -r $(DESTDIR)$(prefix)/include $(bindistdir)
400        cp -r $(DESTDIR)$(prefix)/lib $(bindistdir)
401if COMPILE_WITH_IPOPT   
402        mkdir -p $(bindistdir)/ThirdParty/Ipopt
403# Copy files
404        cd $(IPOPT_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
405# Copy symbolic links
406        cd $(IPOPT_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
407endif
408
409if WITH_MINGW   
410        mkdir -p $(bindistdir)/ThirdParty/MinGW
411# Copy files
412        cd $(MINGW_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
413# Copy symbolic links
414        cd $(MINGW_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
415endif
416
417bindist: bindistdir
418        tar -cf $(bindistdir).tar $(bindistdir)
419        gzip -c $(bindistdir).tar > $(bindistdir).tar.gz
420        rm -rf $(bindistdir)
421        rm -rf $(bindistdir).tar
422
423test: install
424        $(prefix)/jm_tests -i
425
426clean-local: clean-frontends clean-python-packages clean-casadi-interface
427
428clean-casadi-interface:
429        rm -rf $(MC_BUILD)
430#       rm -rf $(DESTDIR)$(prefix)/Python/casadi
431#       rm -rf $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
432if HAVE_ANT
433        cd $(JAVA_CASADI_BASE_DIR)/ModelicaCompilerCasADi; \
434        $(ANT_OPTS) $(ANT) clean ; rm -rf $(MC_SRC)/src/cpp-generated $(MC_SRC)/src/java-generated/ifcasadi
435        cd $(JAVA_CASADI_BASE_DIR)/OptimicaCompilerCasADi; \
436        $(ANT_OPTS) $(ANT) clean ; rm -rf $(OC_SRC)/src/cpp-generated $(OC_SRC)/src/java-generated/ifcasadi
437endif
438       
439
440clean-python-packages:
441if WITH_SUNDIALS
442        cd $(abs_top_srcdir)/external/Assimulo; \
443        python setup.py clean --all --sundials-home=$(SUNDIALS_HOME)
444        rm -rf $(assimulo_install_dir) || echo  Could not remove $(assimulo_install_dir)
445endif
446        -cd $(abs_top_srcdir)/Python/src; \
447        python setup_pymodelica.py clean --all
448        -rm -rf $(pymodelica_install_dir) || echo  Could not remove $(pymodelica_install_dir)
449        -cd $(abs_top_srcdir)/external/PyFMI; \
450        python setup.py  clean --all
451        -rm -rf $(pyfmi_install_dir) || echo  Could not remove $(pyfmi_install_dir)
452        -cd $(abs_top_srcdir)/Python/src; \
453        python setup_pyjmi.py clean --all
454        -rm -rf $(pyjmi_install_dir)|| echo  Could not remove $(pyjmi_install_dir)
455
456clean-frontends:
457if HAVE_ANT
458        rm -rf $(JAVA_BUILD_DIR)
459endif
460
461docs:
462        cd $(abs_top_srcdir); doxygen doc/JMI/jmi_doxydoc.conf
463        cd $(abs_top_srcdir); doxygen doc/ModelicaCompiler/modelica_compiler_doxydoc.conf
464        cd $(abs_top_srcdir); doxygen doc/OptimicaCompiler/optimica_compiler_doxydoc.conf
465        make -C $(abs_top_srcdir)/doc/PyJMI html
466
467
468.PHONY: modelicacasadi_wrapper ifcasadi install_modelicacasadi_transfer install_modelicacasadi_wrapper
Note: See TracBrowser for help on using the repository browser.