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

Last change on this file since 13800 was 9854, checked in by Zimon Kuhs, 3 years ago

Merged r9838, r9843, r9847, r9850 and r9852 to 2.0.x release branch. Ticket #5350 and #5353

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