source: branches/dev-jk-2263/Makefile.am @ 13800

Last change on this file since 13800 was 13255, checked in by Jonathan Kämpe, 5 months ago

#5813 Added assimulo src directory variable to be able to provide an external one since it does not succeed to checkout as an svn external for newer svn version.

File size: 34.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
19SUBDIRS = ThirdParty/winpthreads ThirdParty/SuperLU ThirdParty/Sundials ThirdParty/Minpack ThirdParty/Blas ThirdParty/Lapack ThirdParty/MSL external/FMILibrary RuntimeLibrary
20
21if PYTHON_ENABLED
22SUBDIRS += Python
23endif
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
29assimulo_install_dir64=$(abs_builddir)/Assimulo_install64
30pymodelica_install_dir64=$(abs_builddir)/pymodelica_install64
31pyfmi_install_dir64=$(abs_builddir)/PyFMI_install64
32pyjmi_install_dir64=$(abs_builddir)/PyJMI_install64
33
34assimulo_build_dir=$(abs_builddir)/Assimulo_build
35pymodelica_build_dir=$(abs_builddir)/pymodelica_build
36pyfmi_build_dir=$(abs_builddir)/PyFMI_build
37pyjmi_build_dir=$(abs_builddir)/PyJMI_build
38assimulo_build_dir64=$(abs_builddir)/Assimulo_build64
39pymodelica_build_dir64=$(abs_builddir)/pymodelica_build64
40pyfmi_build_dir64=$(abs_builddir)/PyFMI_build64
41pyjmi_build_dir64=$(abs_builddir)/PyJMI_build64
42
43assimulo_src_dir=$(abs_top_srcdir)/external/Assimulo
44
45bindistdir=JModelica.org-$(VERSION)-bin
46
47casadi:
48if COMPILE_WITH_IPOPT
49        cd $(abs_builddir)/ThirdParty/CasADi; \
50        make -f Makefile  "SWIGCHECK_BUILD_DIR=$(SWIGCHECK_BUILD_DIR)" "CASADI_BUILD_DIR=$(CASADI_BUILD_DIR)" "IPOPT_HOME=$(IPOPT_HOME)" "CASADI_PYTHON_INST_DIR=${CASADI_PYTHON_INST_DIR}" "CASADI_INST_DIR=${CASADI_INST_DIR}" "CASADI_PLUGIN_INST_DIR=${CASADI_PLUGIN_INST_DIR}" "CMAKE_CASADI_ARGS=${CMAKE_CASADI_ARGS}" "CMAKE_CASADI_COMPILER_ARGS=${CMAKE_CASADI_COMPILER_ARGS}" "CMAKE_CASADI_CXX_FLAG=${CMAKE_CASADI_CXX_FLAG}" "CMAKE_PYTHON_LIB=${CMAKE_PYTHON_LIB}"
51endif
52if COMPILE_WITH_IPOPT64
53        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
54        export PYTHONHOME=$(PYTHON64_HOME); \
55        cd $(abs_builddir)/ThirdParty/CasADi; \
56        make -f Makefile  "SWIGCHECK_BUILD_DIR=$(SWIGCHECK_BUILD_DIR64)" "CASADI_BUILD_DIR=$(CASADI_BUILD_DIR64)" "IPOPT_HOME=$(IPOPT64_HOME)" "CASADI_PYTHON_INST_DIR=${CASADI_PYTHON_INST_DIR64}" "CASADI_INST_DIR=${CASADI_INST_DIR64}" "CASADI_PLUGIN_INST_DIR=${CASADI_PLUGIN_INST_DIR64}" "CMAKE_CASADI_ARGS=${CMAKE_CASADI_ARGS64}" "CMAKE_CASADI_COMPILER_ARGS=${CMAKE_CASADI_COMPILER_ARGS64}" "CMAKE_CASADI_CXX_FLAG=${CMAKE_CASADI_CXX_FLAG64}" "CMAKE_PYTHON_LIB=${CMAKE_PYTHON64_LIB}" "CMAKE_PYTHON_INCLUDE=${CMAKE_PYTHON64_INCLUDE}"
57        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
58        export PATH="$(ORIG_PATH)";
59endif
60
61install_casadi: casadi
62if COMPILE_WITH_IPOPT
63        cd $(abs_builddir)/ThirdParty/CasADi; \
64        make -f Makefile install "SWIGCHECK_BUILD_DIR=$(SWIGCHECK_BUILD_DIR)" "CASADI_BUILD_DIR=$(CASADI_BUILD_DIR)" "IPOPT_HOME=$(IPOPT_HOME)"
65        mkdir -p $(DESTDIR)$(prefix)/Python/
66        cp -r $(abs_builddir)/casadi_install/casadi $(DESTDIR)$(prefix)/Python/
67        ## temp fix
68        cp $(abs_builddir)/casadi_build/swig/casadi_core.py $(DESTDIR)$(prefix)/Python/casadi
69endif
70if COMPILE_WITH_IPOPT64 
71        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
72        export PYTHONHOME=$(PYTHON64_HOME); 
73        cd $(abs_builddir)/ThirdParty/CasADi; \
74        make -f Makefile install "SWIGCHECK_BUILD_DIR=$(SWIGCHECK_BUILD_DIR)" "CASADI_BUILD_DIR=$(CASADI_BUILD_DIR64)" "IPOPT_HOME=$(IPOPT64_HOME)"
75        mkdir -p $(DESTDIR)$(prefix)/Python/
76        cp -r $(abs_builddir)/casadi_install64/casadi $(DESTDIR)$(prefix)/Python_64/
77        ## temp fix
78        cp $(abs_builddir)/casadi_build64/swig/casadi_core.py $(DESTDIR)$(prefix)/Python_64/casadi
79        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
80        export PATH="$(ORIG_PATH)";
81endif
82## Install for CasADiInterface, Variables and targets.
83## MC_interface installs the system with Python.
84## If C++ compilation/tests are wanted there is the target MC_interface_cplusplus
85
86MC_INTERFACE=$(abs_top_srcdir)/ModelicaCasADiInterface
87
88CASADI_HOME=$(abs_top_srcdir)/ThirdParty/CasADi/CasADi
89MC_SRC=$(JAVA_CASADI_BASE_DIR)/ModelicaCompilerCasADi
90OC_SRC=$(JAVA_CASADI_BASE_DIR)/OptimicaCompilerCasADi
91MC_SRC_SWIG=$(abs_top_srcdir)/Compiler/ModelicaCompilerCasADi/src/swig
92
93MC_CASADI_BUILD=$(abs_builddir)/ModelicaCompilerCasADi
94OC_CASADI_BUILD=$(abs_builddir)/OptimicaCompilerCasADi
95
96# The modelica casadi interface is built into a build folder
97MC_BUILD=$(abs_builddir)/ModelicaCasADiInterfaceBuild
98MC_BUILD64=$(abs_builddir)/ModelicaCasADiInterfaceBuild64
99# Jars from the modified modelica and optimica compilers are put into the JModelica folder
100MC_COMPILERS_DIR=$(MC_BUILD)/JModelica.org
101MC_LIB=$(DESTDIR)$(prefix)/lib/casadi_interface
102MC_LIB64=$(DESTDIR)$(prefix)/lib/casadi_interface64
103
104CASADI_BUILD_DIR=$(abs_builddir)/casadi_build
105CASADI_BUILD_DIR64=$(abs_builddir)/casadi_build64
106SWIGCHECK_BUILD_DIR=$(abs_builddir)/swig_check
107SWIGCHECK_BUILD_DIR64=$(abs_builddir)/swig_check64
108CASADI_PYTHON_INST_DIR=$(abs_builddir)/casadi_install
109CASADI_INST_DIR=$(prefix)/ThirdParty/CasADi
110CASADI_PLUGIN_INST_DIR=$(CASADI_INST_DIR)/lib
111CASADI_PYTHON_INST_DIR64=$(abs_builddir)/casadi_install64
112CASADI_INST_DIR64=$(prefix)/ThirdParty/CasADi64
113CASADI_PLUGIN_INST_DIR64=$(CASADI_INST_DIR64)/lib
114CMAKE_CASADI_CXX_FLAG=-m32
115CMAKE_CASADI_COMPILER_ARGS=-m32 -mincoming-stack-boundary=2
116CMAKE_CASADI_CXX_FLAG64=-m64
117CMAKE_CASADI_COMPILER_ARGS64=-m64 -fpermissive
118
119casadi_interface: install_casadi_interface
120build_casadi_interface: casadi modelicacasadi_wrapper
121install_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
122        if [ "$(INSTALL_EXTRA_CASADI)" ]; then exec "$(INSTALL_EXTRA_CASADI)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
123
124ifcasadi: casadi
125if COMPILE_WITH_IPOPT
126        mkdir -p $(MC_BUILD)/ifcasadi; \
127        cd $(MC_BUILD)/ifcasadi; \
128        case $(build) in \
129        *-cygwin*|*-mingw*) \
130        cmake $(MC_SRC_SWIG) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" \
131            -DIFCASADI_OUTDIR="$(MC_CASADI_BUILD)" -DCASADI_HOME="$(CASADI_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR)";; \
132        *) \
133        cmake $(MC_SRC_SWIG) \
134            -DIFCASADI_OUTDIR="$(MC_CASADI_BUILD)" -DCASADI_HOME="$(CASADI_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR)";; \
135        esac
136        cd $(MC_BUILD)/ifcasadi;  make
137endif
138if COMPILE_WITH_IPOPT64
139        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}";
140        export PYTHONHOME=$(PYTHON64_HOME);
141        mkdir -p $(MC_BUILD64)/ifcasadi; \
142        cd $(MC_BUILD64)/ifcasadi; \
143        cmake $(MC_SRC_SWIG) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m64" -DCMAKE_CXX_FLAGS="-m64" \
144            -DIFCASADI_OUTDIR="$(MC_CASADI_BUILD)" -DCASADI_HOME="$(CASADI_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR64)"; \
145        cd $(MC_BUILD64)/ifcasadi;  make
146        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
147        export PATH="$(ORIG_PATH)";
148endif
149
150$(MC_LIB): $(MC_CASADI_BUILD)/bin/ModelicaCompiler.jar $(OC_CASADI_BUILD)/bin/OptimicaCompiler.jar $(MC_CASADI_BUILD)/bin/util.jar ifcasadi
151if COMPILE_WITH_IPOPT
152        rm -rf $(MC_LIB)
153        mkdir -p $(MC_LIB)
154        cp $(MC_CASADI_BUILD)/bin/ModelicaCompiler.jar $(MC_LIB)
155        cp $(OC_CASADI_BUILD)/bin/OptimicaCompiler.jar $(MC_LIB)
156        cp $(MC_CASADI_BUILD)/bin/util.jar $(MC_LIB)
157        case $(build) in \
158        *-cygwin*) \
159        cp $(MC_BUILD)/ifcasadi/ifcasadi.dll $(MC_LIB) ;; \
160        *-mingw*) \
161        cp $(MC_BUILD)/ifcasadi/ifcasadi.dll $(MC_LIB) ;; \
162        *) \
163        cp $(MC_BUILD)/ifcasadi/libifcasadi.so $(MC_LIB) ;; \
164        esac
165endif
166if COMPILE_WITH_IPOPT64
167        rm -rf $(MC_LIB64)
168        mkdir -p $(MC_LIB64)
169        cp $(MC_CASADI_BUILD)/bin/ModelicaCompiler.jar $(MC_LIB64)
170        cp $(OC_CASADI_BUILD)/bin/OptimicaCompiler.jar $(MC_LIB64)
171        cp $(MC_CASADI_BUILD)/bin/util.jar $(MC_LIB64)
172        cp $(MC_BUILD64)/ifcasadi/ifcasadi.dll $(MC_LIB64)
173endif
174
175mc_modelica: ifcasadi
176        cd $(MC_CASADI_BUILD); $(ANT_OPTS) $(ANT) -f "$(JAVA_MC_CASADI_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)" "-Dtarget=$(MC_CASADI_BUILD)"
177
178mc_optimica: ifcasadi
179        mkdir -p $(OC_CASADI_BUILD)/src/generated/optimica/java
180        cp -pr $(MC_CASADI_BUILD)/src/generated/modelica/java/ifcasadi $(OC_CASADI_BUILD)/src/generated/optimica/java
181        cd $(OC_CASADI_BUILD); $(ANT_OPTS) $(ANT) -f "$(JAVA_OC_CASADI_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)" "-Dtarget=$(OC_CASADI_BUILD)"
182
183$(MC_CASADI_BUILD)/bin/ModelicaCompiler.jar: mc_modelica
184$(MC_CASADI_BUILD)/bin/util.jar:             mc_modelica
185$(MC_CASADI_BUILD)/bin/separateProcess.jar:  mc_modelica
186
187$(OC_CASADI_BUILD)/bin/OptimicaCompiler.jar: mc_optimica
188$(OC_CASADI_BUILD)/bin/util.jar:             mc_optimica
189$(OC_CASADI_BUILD)/bin/separateProcess.jar:  mc_optimica
190
191$(MC_BUILD)/modelicacasadi_wrapper/swig/modelicacasadi_wrapper.py: modelicacasadi_wrapper
192
193
194modelicacasadi_wrapper: $(MC_CASADI_BUILD)/bin/ModelicaCompiler.jar $(OC_CASADI_BUILD)/bin/OptimicaCompiler.jar $(MC_CASADI_BUILD)/bin/util.jar ifcasadi # $(MC_LIB)
195if COMPILE_WITH_IPOPT
196        mkdir -p $(MC_BUILD)/modelicacasadi_wrapper; \
197        cd $(MC_BUILD)/modelicacasadi_wrapper; \
198        case $(build) in \
199        *-cygwin*|*-mingw*) \
200        cmake $(MC_INTERFACE) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m32" -DCMAKE_CXX_FLAGS="-m32" \
201            -DMC_BUILD="$(MC_BUILD)" -DIPOPT_HOME="$(IPOPT_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR)" \
202            -DIFCASADI_JAR_BASE="$(JAVA_CASADI_BUILD_DIR)" -DCASADI_HOME="$(CASADI_HOME)" \
203            "$(CMAKE_PYTHON_LIB)" "$(CMAKE_PYTHON_INCLUDE)" ;; \
204        *) \
205        cmake $(MC_INTERFACE) \
206            -DMC_BUILD="$(MC_BUILD)" -DIPOPT_HOME="$(IPOPT_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR)" \
207            -DIFCASADI_JAR_BASE="$(JAVA_CASADI_BUILD_DIR)" -DCASADI_HOME="$(CASADI_HOME)" \
208            "$(CMAKE_PYTHON_LIB)" "$(CMAKE_PYTHON_INCLUDE)" ;; \
209        esac
210        cd $(MC_BUILD)/modelicacasadi_wrapper;  make modelicacasadi_wrapper
211endif
212if COMPILE_WITH_IPOPT64
213        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
214        export PYTHONHOME=$(PYTHON64_HOME); \
215        mkdir -p $(MC_BUILD64)/modelicacasadi_wrapper; \
216        cd $(MC_BUILD64)/modelicacasadi_wrapper; \
217        cmake $(MC_INTERFACE) -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER_ARG1="-m64" -DCMAKE_CXX_FLAGS="-m64" \
218            -DMC_BUILD="$(MC_BUILD64)" -DIPOPT_HOME="$(IPOPT64_HOME)" -DCASADI_BUILD_DIR="$(CASADI_BUILD_DIR64)" \
219            -DIFCASADI_JAR_BASE="$(JAVA_CASADI_BUILD_DIR)" -DCASADI_HOME="$(CASADI_HOME)" \
220            "$(CMAKE_PYTHON64_LIB)" "$(CMAKE_PYTHON64_INCLUDE)"; \
221        cd $(MC_BUILD64)/modelicacasadi_wrapper;  make modelicacasadi_wrapper
222        export PYTHONHOME=$(ORIG_PYTHON_HOME);
223        export PATH="$(ORIG_PATH)";
224endif
225
226 $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py: install_modelicacasadi_transfer
227 $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/modelica_casadi_transfer_wrapper.py: install_modelicacasadi_transfer
228 
229 $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py: install_modelicacasadi_wrapper
230 
231 install_modelicacasadi_wrapper: $(MC_BUILD)/modelicacasadi_wrapper/swig/modelicacasadi_wrapper.py
232if COMPILE_WITH_IPOPT
233        mkdir -p $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper
234        cp $(MC_BUILD)/modelicacasadi_wrapper/swig/*modelicacasadi_wrapper* $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper
235        rm -f $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
236        touch $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
237        echo "from modelicacasadi_wrapper import *" >> $(DESTDIR)$(prefix)/Python/modelicacasadi_wrapper/__init__.py
238endif
239if COMPILE_WITH_IPOPT64
240        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
241        export PYTHONHOME=$(PYTHON64_HOME);
242        mkdir -p $(DESTDIR)$(prefix)/Python_64/modelicacasadi_wrapper
243        cp $(MC_BUILD64)/modelicacasadi_wrapper/swig/*modelicacasadi_wrapper* $(DESTDIR)$(prefix)/Python_64/modelicacasadi_wrapper
244        rm -f $(DESTDIR)$(prefix)/Python_64/modelicacasadi_wrapper/__init__.py
245        touch $(DESTDIR)$(prefix)/Python_64/modelicacasadi_wrapper/__init__.py
246        echo "from modelicacasadi_wrapper import *" >> $(DESTDIR)$(prefix)/Python_64/modelicacasadi_wrapper/__init__.py
247        export PYTHONHOME=$(ORIG_PYTHON_HOME)
248        export PATH="$(ORIG_PATH)"
249endif
250
251 install_modelicacasadi_transfer: $(MC_INTERFACE)/python/modelica_casadi_transfer_wrapper.py
252if COMPILE_WITH_IPOPT
253        mkdir -p $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
254        rm -f $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
255        touch $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
256        echo "from modelica_casadi_transfer_wrapper import *" >> $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer/__init__.py
257        cp $(MC_INTERFACE)/python/modelica_casadi_transfer_wrapper.py $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
258endif
259if COMPILE_WITH_IPOPT64   
260        mkdir -p $(DESTDIR)$(prefix)/Python_64/modelicacasadi_transfer
261        rm -f $(DESTDIR)$(prefix)/Python_64/modelicacasadi_transfer/__init__.py
262        touch $(DESTDIR)$(prefix)/Python_64/modelicacasadi_transfer/__init__.py
263        echo "from modelica_casadi_transfer_wrapper import *" >> $(DESTDIR)$(prefix)/Python_64/modelicacasadi_transfer/__init__.py
264        cp $(MC_INTERFACE)/python/modelica_casadi_transfer_wrapper.py $(DESTDIR)$(prefix)/Python_64/modelicacasadi_transfer
265endif
266       
267if NUMPY_NO_MSVCR
268NUMPY_NO_MSVCR_ARG=--no-msvcr="true"
269else
270NUMPY_NO_MSVCR_ARG=
271endif
272
273
274build-python-packages:
275if PYTHON_ENABLED
276if WITH_OPENMP
277        mkdir -p $(assimulo_build_dir); \
278        cd $(assimulo_src_dir)/..; \
279        find Assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(assimulo_build_dir); \
280        cd $(assimulo_build_dir)/Assimulo; \
281        case $(build) in \
282        *-cygwin*) \
283        python setup.py install --with_openmp=True --superlu-home=$(abs_builddir)/superlu_build/ --sundials-home=$(SUNDIALS_HOME) --sundials-with-superlu=True --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) ;; \
284        *-mingw*) \
285        python setup.py install --with_openmp=True --superlu-home=$(abs_builddir)/superlu_build/ --sundials-home=$(SUNDIALS_HOME) --sundials-with-superlu=True --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) ;; \
286        *) \
287        python setup.py install --with_openmp=True --superlu-home=$(abs_builddir)/superlu_build/ --sundials-home=$(SUNDIALS_HOME) --sundials-with-superlu=True --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --prefix=$(assimulo_install_dir) ;; \
288        esac
289if JM_WIN64
290if WITH_PYTHON64
291        mkdir -p $(assimulo_build_dir64); \
292        cd $(assimulo_src_dir)/..; \
293        find Assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(assimulo_build_dir64); \
294        cd $(assimulo_build_dir)/Assimulo; \
295        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
296        export PYTHONHOME=$(PYTHON64_HOME); \
297        python setup.py install --with_openmp=True --superlu-home=$(abs_builddir)/superlu_build64/ --sundials-home=$(SUNDIALS_HOME)64 --sundials-with-superlu=True --blas-home=$(abs_builddir)/blas_install64/ --lapack-home=$(abs_builddir)/lapack_install64/ --force-32bit="false" $(NUMPY_NO_MSVCR_ARG) --prefix=$(assimulo_install_dir64); \
298        export PATH="$(ORIG_PATH)"; \
299        export PYTHONHOME=$(ORIG_PYTHON_HOME)
300endif
301endif
302endif
303if !WITH_OPENMP
304        mkdir -p $(assimulo_build_dir); \
305        cd $(assimulo_src_dir)/..; \
306        find Assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(assimulo_build_dir); \
307        cd $(assimulo_build_dir)/Assimulo; \
308        case $(build) in \
309        *-cygwin*) \
310        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) ;; \
311        *-mingw*) \
312        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) ;; \
313        *) \
314        python setup.py install --sundials-home=$(SUNDIALS_HOME) --blas-home=$(abs_builddir)/blas_install/ --lapack-home=$(abs_builddir)/lapack_install/ --prefix=$(assimulo_install_dir) ;; \
315        esac
316if JM_WIN64
317if WITH_PYTHON64
318        mkdir -p $(assimulo_build_dir64); \
319        cd $(assimulo_src_dir)/..; \
320        find Assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(assimulo_build_dir64); \
321        cd $(assimulo_build_dir64)/Assimulo; \
322        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
323        export PYTHONHOME=$(PYTHON64_HOME); \
324        python setup.py install --sundials-home=$(SUNDIALS_HOME)64 --blas-home=$(abs_builddir)/blas_install64/ --lapack-home=$(abs_builddir)/lapack_install64/ --force-32bit="false" $(NUMPY_NO_MSVCR_ARG) --prefix=$(assimulo_install_dir64) ; \
325        export PATH="$(ORIG_PATH)"; \
326        export PYTHONHOME=$(ORIG_PYTHON_HOME)
327endif
328endif
329endif
330        cd $(abs_top_srcdir)/Python/src; \
331        python setup_pymodelica.py install --prefix=$(pymodelica_install_dir); \
332        rm -rf build
333if JM_WIN64
334if WITH_PYTHON64
335        cd $(abs_top_srcdir)/Python/src; \
336        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
337        export PYTHONHOME=$(PYTHON64_HOME); \
338        python setup_pymodelica.py install --prefix=$(pymodelica_install_dir64); \
339        export PATH="$(ORIG_PATH)"; \
340        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
341        rm -rf build
342endif
343endif
344        mkdir -p $(pyfmi_build_dir); \
345        cd $(abs_top_srcdir)/external; \
346        find PyFMI -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(pyfmi_build_dir); \
347        cd $(pyfmi_build_dir)/PyFMI; \
348        case $(build) in \
349        *-cygwin*) \
350        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install/ --force-32bit="true" --extra-c-flags="-mincoming-stack-boundary=2" --prefix=$(pyfmi_install_dir) ;; \
351        *-mingw*) \
352        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) ;; \
353        *) \
354        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install/ --prefix=$(pyfmi_install_dir) ;; \
355        esac
356        rm -rf build
357if JM_WIN64
358if WITH_PYTHON64
359        mkdir -p $(pyfmi_build_dir64); \
360        cd $(abs_top_srcdir)/external; \
361        find PyFMI -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(pyfmi_build_dir64); \
362        cd $(pyfmi_build_dir64)/PyFMI; \
363        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
364        export PYTHONHOME=$(PYTHON64_HOME); \
365        python setup.py install --fmil-home=$(abs_builddir)/FMIL_install64/ $(NUMPY_NO_MSVCR_ARG) --prefix=$(pyfmi_install_dir64); \
366        export PATH="$(ORIG_PATH)"; \
367        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
368        rm -rf build
369endif
370endif
371        cd $(abs_top_srcdir)/Python/src; \
372        python setup_pyjmi.py install --prefix=$(pyjmi_install_dir); \
373        rm -rf build
374if JM_WIN64
375if WITH_PYTHON64
376        cd $(abs_top_srcdir)/Python/src; \
377        export PATH=$(PYTHON64_HOME):$(PYTHON64_HOME)/Scripts:$(PYTHON64_HOME)/Lib:"${PATH}"; \
378        export PYTHONHOME=$(PYTHON64_HOME); \
379        python setup_pyjmi.py install --prefix=$(pyjmi_install_dir64); \
380        export PATH="$(ORIG_PATH)"; \
381        export PYTHONHOME=$(ORIG_PYTHON_HOME); \
382        rm -rf build
383endif
384endif
385endif
386
387install-python-tests:
388if PYTHON_ENABLED
389        chmod ugo+x jm_tests
390        cp -p jm_tests $(DESTDIR)$(prefix)/jm_tests
391       
392        cd $(abs_top_srcdir)/Python/src/tests_jmodelica/; \
393        mkdir -p $(DESTDIR)$(prefix)/Python/tests_jmodelica; \
394        find . -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python/tests_jmodelica
395        rm -rf $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/src
396        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/CMakeLists.txt
397        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/Makefile.am
398        rm -f $(DESTDIR)$(prefix)/Python/tests_jmodelica/files/Modelica/Resources/Makefile.in
399if JM_WIN64
400if WITH_PYTHON64
401        cd $(abs_top_srcdir)/Python/src/tests_jmodelica/; \
402        mkdir -p $(DESTDIR)$(prefix)/Python_64/tests_jmodelica; \
403        find . -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python_64/tests_jmodelica
404        rm -rf $(DESTDIR)$(prefix)/Python_64/tests_jmodelica/files/Modelica/Resources/src
405        rm -f $(DESTDIR)$(prefix)/Python_64/tests_jmodelica/files/Modelica/Resources/CMakeLists.txt
406        rm -f $(DESTDIR)$(prefix)/Python_64/tests_jmodelica/files/Modelica/Resources/Makefile.am
407        rm -f $(DESTDIR)$(prefix)/Python_64/tests_jmodelica/files/Modelica/Resources/Makefile.in
408endif
409endif
410endif
411
412install-python-packages: build-python-packages install-python-tests
413if PYTHON_ENABLED
414        mkdir -p $(DESTDIR)$(prefix)/Python
415        cp $(abs_top_srcdir)/Python/src/startup.py $(DESTDIR)$(prefix)/
416        cp Python/src/required_defaults.py $(DESTDIR)$(prefix)/Python/
417        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/Python/LICENSE $(DESTDIR)$(prefix)/Python
418if JM_WIN64
419if WITH_PYTHON64
420        mkdir -p $(DESTDIR)$(prefix)/Python_64
421        cp Python/src/required_defaults.py $(DESTDIR)$(prefix)/Python_64/
422        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/Python/LICENSE $(DESTDIR)$(prefix)/Python_64
423endif
424endif
425        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
426        if [ -e $(assimulo_install_dir)/$${pkgdir}/site-packages/ ]; \
427        then \
428        cd $(assimulo_install_dir)/$${pkgdir}/site-packages/; \
429        find assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
430        fi; \
431        done
432        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
433        if [ -e $(pymodelica_install_dir)/$${pkgdir}/site-packages/ ]; \
434        then \
435        cd $(pymodelica_install_dir)/$${pkgdir}/site-packages/; \
436        find pymodelica -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
437        fi; \
438        done
439        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
440        if [ -e $(pyjmi_install_dir)/$${pkgdir}/site-packages/ ]; \
441        then \
442        cd $(pyjmi_install_dir)/$${pkgdir}/site-packages/; \
443        find pyjmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
444        fi; \
445        done
446        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
447        if [ -e $(pyfmi_install_dir)/$${pkgdir}/site-packages/ ]; \
448        then \
449        cd $(pyfmi_install_dir)/$${pkgdir}/site-packages/; \
450        find pyfmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python; \
451        fi; \
452        done
453if JM_WIN64
454        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
455        if [ -e $(assimulo_install_dir64)/$${pkgdir}/site-packages/ ]; \
456        then \
457        cd $(assimulo_install_dir64)/$${pkgdir}/site-packages/; \
458        find assimulo -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python_64; \
459        fi; \
460        done
461        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
462        if [ -e $(pymodelica_install_dir64)/$${pkgdir}/site-packages/ ]; \
463        then \
464        cd $(pymodelica_install_dir64)/$${pkgdir}/site-packages/; \
465        find pymodelica -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python_64; \
466        fi; \
467        done
468        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
469        if [ -e $(pyjmi_install_dir64)/$${pkgdir}/site-packages/ ]; \
470        then \
471        cd $(pyjmi_install_dir64)/$${pkgdir}/site-packages/; \
472        find pyjmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python_64; \
473        fi; \
474        done
475        for pkgdir in lib/python2.5 lib/python2.6 lib/python2.7 lib64/python2.5 lib64/python2.6 lib64/python2.7 Lib; do \
476        if [ -e $(pyfmi_install_dir64)/$${pkgdir}/site-packages/ ]; \
477        then \
478        cd $(pyfmi_install_dir64)/$${pkgdir}/site-packages/; \
479        find pyfmi -type f |grep -v /.svn | grep -v .pyc | grep -v ~ |tar c -T - -f - | tar x -C $(DESTDIR)$(prefix)/Python_64; \
480        fi; \
481        done
482endif
483        mkdir -p $(DESTDIR)$(prefix)/bin
484        [ -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
485        [ -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
486        chmod ugo+x $(DESTDIR)$(prefix)/bin/jm_*.sh
487endif
488       
489       
490# Hooks for extra build or install actions. Must be empty or the path of a shell script to execute.
491# Both scripts will get the source directory as the first argument and the install directory as the second.
492BUILD_EXTRA=
493INSTALL_EXTRA=
494INSTALL_EXTRA_CASADI=
495
496# Paths for Java build
497JAVA_BUILD_DIR=$(abs_builddir)/java
498COMPILER_DIR=$(abs_top_srcdir)/Compiler
499JAVA_MC_ANT_FILE=$(COMPILER_DIR)/ModelicaCompiler/build.xml
500JAVA_OC_ANT_FILE=$(COMPILER_DIR)/OptimicaCompiler/build.xml
501JAVA_CASADI_BASE_DIR=$(COMPILER_DIR)
502JAVA_CASADI_BUILD_DIR=$(abs_builddir)
503JAVA_MC_CASADI_ANT_FILE=$(COMPILER_DIR)/ModelicaCompilerCasADi/build.xml
504JAVA_OC_CASADI_ANT_FILE=$(COMPILER_DIR)/OptimicaCompilerCasADi/build.xml
505
506all-local: build-python-packages build-compiler
507        $(abs_top_srcdir)/get_version.sh $(abs_top_srcdir) https://svn.jmodelica.org > $(abs_builddir)/version.txt
508        if [ "$(BUILD_EXTRA)" ]; then exec "$(BUILD_EXTRA)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
509
510install-exec-local: install-python-packages install-compiler install-modules
511        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy LICENSE file" || cp $(abs_top_srcdir)/LICENSE $(DESTDIR)$(prefix)/
512        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_GPL $(DESTDIR)$(prefix)/lib/
513        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_CPL $(DESTDIR)$(prefix)/lib/
514        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_GPL $(DESTDIR)$(prefix)/include/
515        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_CPL $(DESTDIR)$(prefix)/include/
516        mkdir -p $(DESTDIR)$(prefix)/Makefiles
517        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_GPL $(DESTDIR)$(prefix)/Makefiles/LICENSE
518        case $(build) in \
519        *-cygwin*|*-mingw*) \
520        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.windows $(DESTDIR)$(prefix)/Makefiles/MakeFile && \
521        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/winpthreads/lib/winpthreads && \
522        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/winpthreads/include && \
523        cp $(abs_builddir)/winpthreads_build/COPYING $(DESTDIR)$(prefix)/ThirdParty/winpthreads && \
524        cp $(abs_builddir)/winpthreads_build/.libs/libwinpthread.a $(DESTDIR)$(prefix)/ThirdParty/winpthreads/lib/winpthreads && \
525        cp $(abs_builddir)/winpthreads_build/include/*.h $(DESTDIR)$(prefix)/ThirdParty/winpthreads/include ;; \
526        *-apple*) \
527        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.macosx $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
528        *) \
529        cp $(abs_top_srcdir)/RuntimeLibrary/Makefiles/Makefile.linux $(DESTDIR)$(prefix)/Makefiles/MakeFile ;; \
530        esac
531
532        mkdir -p $(DESTDIR)$(prefix)/ThirdParty
533        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Sundials
534        cp -r $(SUNDIALS_HOME)/* $(DESTDIR)$(prefix)/ThirdParty/Sundials
535        cp $(abs_top_srcdir)/ThirdParty/Sundials/sundials-2.7.0/LICENSE $(DESTDIR)$(prefix)/ThirdParty/Sundials
536if JM_WIN64
537        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Sundials/lib64
538        cp -r $(SUNDIALS_HOME)64/lib/* $(DESTDIR)$(prefix)/ThirdParty/Sundials/lib64
539        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/winpthreads/lib/winpthreads64
540        cp $(abs_builddir)/winpthreads_build64/.libs/libwinpthread.a $(DESTDIR)$(prefix)/ThirdParty/winpthreads/lib/winpthreads64
541endif
542        mkdir -p $(DESTDIR)$(prefix)/ThirdParty/Minpack
543        cp -r $(MINPACK_HOME)/* $(DESTDIR)$(prefix)/ThirdParty/Minpack
544        cp $(abs_top_srcdir)/ThirdParty/Minpack/cminpack-1.3.2/CopyrightMINPACK.txt $(DESTDIR)$(prefix)/ThirdParty/Minpack
545        if [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ]; then \
546          echo "Installing in dist directory, don't copy MSL"; \
547        else \
548          mkdir -p "$(DESTDIR)$(prefix)/ThirdParty/MSL/Modelica"; \
549          mkdir -p "$(DESTDIR)$(prefix)/ThirdParty/MSL/ModelicaServices"; \
550          cd "$(DESTDIR)$(prefix)/ThirdParty/MSL"; \
551          find . -depth -print0 | while read -d $$'\0' -r f ; do if [ ! -e "$(abs_top_srcdir)/ThirdParty/MSL/$${f}" ]; then rm -rf "$${f}"; fi; done; \
552          cd "$(abs_top_srcdir)/ThirdParty/MSL/Modelica"; \
553          find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C "$(DESTDIR)$(prefix)/ThirdParty/MSL/Modelica"; \
554          cd "$(abs_top_srcdir)/ThirdParty/MSL/ModelicaServices"; \
555          find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C "$(DESTDIR)$(prefix)/ThirdParty/MSL/ModelicaServices"; \
556          cd "$(abs_top_srcdir)/ThirdParty/MSL"; \
557          $(CP) Complex.mo "$(DESTDIR)$(prefix)/ThirdParty/MSL"; \
558        fi
559        mkdir -p $(DESTDIR)$(prefix)/CodeGenTemplates
560        mkdir -p $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
561        cp $(abs_top_srcdir)/RuntimeLibrary/LICENSE_GPL $(DESTDIR)$(prefix)/CodeGenTemplates/LICENSE
562        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/*.c $(DESTDIR)$(prefix)/CodeGenTemplates
563        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/FMIBase/*.c $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
564        cp -r $(abs_top_srcdir)/Compiler/ModelicaCBackEnd/templates/FMIBase/*.h $(DESTDIR)$(prefix)/CodeGenTemplates/FMIBase
565        cp  $(abs_top_srcdir)/Compiler/ModelicaFMUXBackEnd/templates/*.tpl $(DESTDIR)$(prefix)/CodeGenTemplates
566        mkdir -p $(DESTDIR)$(prefix)/XML
567        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML schemas"  || cp  $(abs_top_srcdir)/XML/*.xsd $(DESTDIR)$(prefix)/XML
568        [ $(abs_top_srcdir) == $(DESTDIR)$(prefix) ] && echo "Installing in dist directory, don't copy XML LICENSE"  || cp  $(abs_top_srcdir)/XML/LICENSE $(DESTDIR)$(prefix)/XML
569        cp  $(abs_builddir)/version.txt $(DESTDIR)$(prefix)
570        if [ "$(INSTALL_EXTRA)" ]; then exec "$(INSTALL_EXTRA)" "$(abs_top_srcdir)" "$(DESTDIR)$(prefix)"; fi
571
572ant_output_jars= \
573        $(JAVA_BUILD_DIR)/bin/ModelicaCompiler.jar \
574        $(JAVA_BUILD_DIR)/bin/util.jar \
575        $(JAVA_BUILD_DIR)/bin/OptimicaCompiler.jar \
576        $(JAVA_BUILD_DIR)/bin/separateProcess.jar
577
578ant_output_options=$(JAVA_BUILD_DIR)/src/build/DefaultOptions.xml
579
580install-compiler: $(ant_output_jars) $(ant_output_options) TODO-always-trigger
581if HAVE_ANT
582        mkdir -p $(DESTDIR)$(prefix)/lib/
583        install -t $(DESTDIR)$(prefix)/lib/ $(ant_output_jars)
584        install -t $(DESTDIR)$(prefix)/ $(ant_output_options)
585endif
586
587# Dummy target used to always trigger rebuilds. Used to enable references to
588# outputs from phony targets as real targets. For example ant output.
589TODO-always-trigger: ;
590
591$(ant_output_jars) $(ant_output_options): build-compiler
592
593build-compiler:
594if HAVE_ANT
595        mkdir -p $(JAVA_BUILD_DIR)
596        cd $(JAVA_BUILD_DIR); \
597        $(ANT_OPTS) $(ANT) -f "$(JAVA_MC_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)" "-Dtarget=$(JAVA_BUILD_DIR)"
598        cd $(JAVA_BUILD_DIR); \
599        $(ANT_OPTS) $(ANT) -f "$(JAVA_OC_ANT_FILE)" "-Dcompiler=$(COMPILER_DIR)" "-Dtarget=$(JAVA_BUILD_DIR)"
600endif
601
602install-modules: install-modules-ModelicaFrontEnd
603
604BEAVER_INSTALL_DIR = $(DESTDIR)$(prefix)/ThirdParty/Beaver
605BEAVER_SOURCE = $(abs_top_srcdir)/Compiler/ModelicaFrontEnd/ThirdParty/Beaver
606
607install-modules-ModelicaFrontEnd: $(BEAVER_INSTALL_DIR)/LICENSE $(BEAVER_INSTALL_DIR)/lib/beaver-rt.jar
608
609$(BEAVER_INSTALL_DIR)/%: $(BEAVER_SOURCE)/%
610        install -D $(<) $(@)
611
612bindistdir: install
613        rm -rf $(bindistdir)
614        mkdir -p $(bindistdir)
615        cp $(DESTDIR)$(prefix)/LICENSE $(bindistdir)
616        cp $(DESTDIR)$(prefix)/startup.py $(bindistdir)
617        cp $(DESTDIR)$(prefix)/version.txt $(bindistdir)
618        cp $(DESTDIR)$(prefix)/DefaultOptions.xml $(bindistdir)
619        cp -r $(DESTDIR)$(prefix)/CodeGenTemplates $(bindistdir)
620        cp -r $(DESTDIR)$(prefix)/Makefiles $(bindistdir)
621        cp -r $(DESTDIR)$(prefix)/Python $(bindistdir)
622        cp -r $(DESTDIR)$(prefix)/ThirdParty $(bindistdir)
623        cp -r $(DESTDIR)$(prefix)/XML $(bindistdir)
624        cp -r $(DESTDIR)$(prefix)/include $(bindistdir)
625        cp -r $(DESTDIR)$(prefix)/lib $(bindistdir)
626if COMPILE_WITH_IPOPT   
627        mkdir -p $(bindistdir)/ThirdParty/Ipopt
628# Copy files
629        cd $(IPOPT_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
630# Copy symbolic links
631        cd $(IPOPT_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/Ipopt
632endif
633
634if WITH_MINGW   
635        mkdir -p $(bindistdir)/ThirdParty/MinGW
636# Copy files
637        cd $(MINGW_HOME); find * -type f |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
638# Copy symbolic links
639        cd $(MINGW_HOME); find * -type l |grep -v /.svn | grep -v ~ |tar c -T - -f - | tar x -C $(abs_builddir)/$(bindistdir)/ThirdParty/MinGW
640endif
641
642bindist: bindistdir
643        tar -cf $(bindistdir).tar $(bindistdir)
644        gzip -c $(bindistdir).tar > $(bindistdir).tar.gz
645        rm -rf $(bindistdir)
646        rm -rf $(bindistdir).tar
647
648test: install
649        $(prefix)/jm_tests -i
650
651clean-local: clean-frontends clean-python-packages clean-casadi-interface
652
653clean-casadi-interface:
654        rm -rf $(MC_BUILD)
655        rm -rf $(MC_BUILD64)
656#       rm -rf $(DESTDIR)$(prefix)/Python/casadi
657#       rm -rf $(DESTDIR)$(prefix)/Python/modelicacasadi_transfer
658if HAVE_ANT
659        cd $(JAVA_CASADI_BUILD_DIR)/ModelicaCompilerCasADi; \
660        $(ANT_OPTS) $(ANT) clean ; rm -rf $(MC_CASADI_BUILD)/src/cpp-generated $(MC_CASADI_BUILD)/src/generated/modelica/java/ifcasadi
661        cd $(JAVA_CASADI_BUILD_DIR)/OptimicaCompilerCasADi; \
662        $(ANT_OPTS) $(ANT) clean ; rm -rf $(OC_CASADI_BUILD)/src/cpp-generated $(OC_CASADI_BUILD)/src/generated/optimica/java/ifcasadi
663endif
664       
665clean-python-packages:
666if PYTHON_ENABLED
667        if [ -d $(assimulo_build_dir)/Assimulo ]; then \
668                cd $(assimulo_build_dir)/Assimulo; \
669                python setup.py clean --all --sundials-home=$(SUNDIALS_HOME); \
670                cd $(abs_builddir); \
671        fi;
672        rm -rf $(assimulo_build_dir) || echo  Could not remove $(assimulo_build_dir)
673        rm -rf $(assimulo_install_dir) || echo  Could not remove $(assimulo_install_dir)
674        -cd $(abs_top_srcdir)/Python/src; \
675        python setup_pymodelica.py clean --all
676        -rm -rf $(pymodelica_install_dir) || echo  Could not remove $(pymodelica_install_dir)
677        if [ -d $(pyfmi_build_dir)/PyFMI ]; then \
678                -cd $(pyfmi_build_dir)/PyFMI; \
679                python setup.py  clean --all; \
680                cd $(abs_builddir); \
681        fi;
682        -rm -rf $(pyfmi_build_dir) || echo  Could not remove $(pyfmi_build_dir)
683        -rm -rf $(pyfmi_install_dir) || echo  Could not remove $(pyfmi_install_dir)
684        -cd $(abs_top_srcdir)/Python/src; \
685        python setup_pyjmi.py clean --all
686        -rm -rf $(pyjmi_install_dir)|| echo  Could not remove $(pyjmi_install_dir)
687endif
688
689clean-frontends:
690if HAVE_ANT
691        rm -rf $(JAVA_BUILD_DIR)
692endif
693
694docs:
695        cd $(abs_top_srcdir); doxygen doc/ModelicaCompiler/modelica_compiler_doxydoc.conf
696        cd $(abs_top_srcdir); doxygen doc/OptimicaCompiler/optimica_compiler_doxydoc.conf
697        make -C $(abs_top_srcdir)/doc/PyJMI html
698
699
700.PHONY: modelicacasadi_wrapper ifcasadi install_modelicacasadi_transfer install_modelicacasadi_wrapper
Note: See TracBrowser for help on using the repository browser.