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

Last change on this file since 13754 was 13754, checked in by randersson, 8 weeks ago

#5819 Updated paths for previous generation of JM to be correct. Note these are not used when build with python 3 anyway.

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