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

Last change on this file since 13800 was 9061, checked in by Christian Andersson, 3 years ago

Fixed so that the casadi parts are not built in the src folder. Related to ticket:3449

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