Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / idl / Makefile.am
1 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This Makefile is responsible of generating the client and server
21 # implementation of IDL interfaces for both C++ and python usage.
22 # The building process of the C++ files is in charge of each source
23 # package and then is not manage here.
24 #
25 include $(top_srcdir)/adm_local/unix/make_common_starter.am
26
27 EXTRA_DIST += CMakeLists.txt
28
29 BASEIDL_FILES = MED.idl MED_Gen.idl Compo1Py.idl MEDCouplingCorbaServant.idl MEDCouplingCorbaServantTest.idl ParaMEDCouplingCorbaServant.idl
30
31 MPIIDL_FILES = ParaMEDMEMComponent.idl
32
33 IDL_FILES = $(BASEIDL_FILES)
34 if MPI_IS_OK
35 IDL_FILES += $(MPIIDL_FILES)
36 endif
37
38 IDL_FILES_PY=$(IDL_FILES:%.idl=%_idl.py)
39
40 # This variable defines the files to be installed
41 dist_salomeidl_DATA = $(IDL_FILES)
42
43 # GUI idl common library
44 lib_LTLIBRARIES = libSalomeIDLMED.la libSalomeIDLMEDTests.la
45
46 # Sources built from idl files
47 BASEIDL_SOURCES = MEDSK.cc MED_GenSK.cc MEDCouplingCorbaServantSK.cc Compo1PySK.cc ParaMEDCouplingCorbaServantSK.cc
48
49 MPIIDL_SOURCES = ParaMEDMEMComponentSK.cc
50
51 IDL_SOURCES = $(BASEIDL_SOURCES)
52 if MPI_IS_OK
53   IDL_SOURCES += $(MPIIDL_SOURCES)
54 endif
55
56 nodist_libSalomeIDLMED_la_SOURCES = $(IDL_SOURCES)
57
58 # header files must be exported: other modules have to use this library
59 nodist_salomeinclude_HEADERS = MED.hh MED_Gen.hh MEDCouplingCorbaServant.hh Compo1Py.hh MEDCouplingCorbaServantTest.hh ParaMEDCouplingCorbaServant.hh
60 if MPI_IS_OK
61   nodist_salomeinclude_HEADERS += ParaMEDMEMComponent.hh
62 endif
63
64 libSalomeIDLMED_la_CPPFLAGS =                   \
65         -I$(top_builddir)/idl                   \
66         @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @KERNEL_CXXFLAGS@
67 libSalomeIDLMED_la_LDFLAGS = -no-undefined -version-info=0:0:0
68 libSalomeIDLMED_la_LIBADD  = @CORBA_LIBS@ $(KERNEL_LDFLAGS) -lSalomeIDLKernel
69
70 nodist_libSalomeIDLMEDTests_la_SOURCES = MEDCouplingCorbaServantTestSK.cc
71 libSalomeIDLMEDTests_la_CPPFLAGS = $(libSalomeIDLMED_la_CPPFLAGS)
72 libSalomeIDLMEDTests_la_LIBADD = libSalomeIDLMED.la
73
74 # These variables defines the building process of CORBA files
75 OMNIORB_IDL         = @OMNIORB_IDL@
76 OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
77 OMNIORB_IDLPYFLAGS  = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome 
78 IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/idl/salome -I$(KERNEL_ROOT_DIR)/idl/salome
79 IDLPYFLAGS  = @IDLPYFLAGS@ -I$(KERNEL_ROOT_DIR)/idl/salome
80
81 MEDSK.cc : MED.idl
82         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
83 MED.hh : MEDSK.cc
84
85 MED_GenSK.cc : MED_Gen.idl
86         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
87 MED_Gen.hh : MED_GenSK.cc
88
89 ParaMEDMEMComponentSK.cc : ParaMEDMEMComponent.idl
90         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
91 ParaMEDMEMComponent.hh : ParaMEDMEMComponentSK.cc
92
93 MEDCouplingCorbaServantSK.cc : MEDCouplingCorbaServant.idl
94         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
95 MEDCouplingCorbaServant.hh : MEDCouplingCorbaServantSK.cc
96
97 ParaMEDCouplingCorbaServantSK.cc : ParaMEDCouplingCorbaServant.idl
98         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
99 ParaMEDCouplingCorbaServant.hh : ParaMEDCouplingCorbaServantSK.cc
100
101 Compo1PySK.cc : Compo1Py.idl
102         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
103 Compo1Py.hh : Compo1PySK.cc
104
105 MEDCouplingCorbaServantTestSK.cc : MEDCouplingCorbaServantTest.idl
106         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
107 MEDCouplingCorbaServantTest.hh : MEDCouplingCorbaServantTestSK.cc
108
109 install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%)
110         $(INSTALL) -d  $(DESTDIR)$(salomepythondir)
111         ls $^ | while read file; do \
112           $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
113         done
114
115 # we want to remove only staff generated for IDL files and nothing more
116 uninstall-local:
117         @for modulen in SALOME_MED SALOME_TEST Compo1Py_ORB ; do \
118           test -d $(DESTDIR)$(salomepythondir)/$${modulen} && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen} ; \
119           test -d $(DESTDIR)$(salomepythondir)/$${modulen}__POA && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}__POA" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen}__POA ; \
120         done ; \
121         for filen in $(IDL_FILES_PY) ; do \
122           echo "Removing $(DESTDIR)$(salomepythondir)/$${filen}" && rm -f $(DESTDIR)$(salomepythondir)/$${filen}* ; \
123         done
124
125 mostlyclean-local: clean-idls
126
127 clean-idls:
128         -rm -f *.hh *.cc .depidl
129
130 # we use cpp to generate dependencies between idl files.
131 # option x c tells the preprocessor to consider idl as a c file.
132 # if an idl is modified, all idl dependencies are rebuilt
133
134 .depidl: $(BASEIDL_FILES)
135         @echo "" > $@
136         @for dep in $^ dummy; do \
137           if [ $$dep != "dummy" ]; then \
138             echo Building dependencies for $$dep; \
139             $(CPP) $(C_DEPEND_FLAG) -x c -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \
140             sed 's/\.o/\SK.cc/' >>$@; \
141           fi; \
142         done ;
143
144 -include .depidl