source: branches/dev-5819/Makefile.am @ 13799

Last change on this file since 13799 was 13799, checked in by randersson, 7 weeks ago

#5819 Removed old echo "..."

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