Salome HOME
Merge from V6_main 01/04/2013
[samples/pycalculator.git] / idl / Makefile.am
1 # Copyright (C) 2007-2013  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 BASEIDL_FILES = PYCALCULATOR_Gen.idl
28
29 BASEIDL_FILES_PY=$(BASEIDL_FILES:%.idl=%_idl.py)
30
31 # This variable defines the files to be installed
32 dist_salomeidl_DATA = $(BASEIDL_FILES)
33
34 # GUI idl common library
35 lib_LTLIBRARIES = libSalomeIDLPYCALCULATOR.la
36
37 # Sources built from idl files
38 nodist_libSalomeIDLPYCALCULATOR_la_SOURCES = \
39         PYCALCULATOR_GenSK.cc \
40         PYCALCULATOR_GenDynSK.cc
41 PYCALCULATOR_GenDynSK.cc: PYCALCULATOR_GenSK.cc
42
43 # header files must be exported: other modules have to use this library
44 nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh)
45
46 libSalomeIDLPYCALCULATOR_la_CPPFLAGS = \
47         $(KERNEL_CXXFLAGS) \
48         $(MED_CXXFLAGS) \
49         -I$(top_builddir)/idl \
50         @CORBA_CXXFLAGS@ \
51         @CORBA_INCLUDES@
52
53 libSalomeIDLPYCALCULATOR_la_LDFLAGS = -no-undefined -version-info=0:0:0
54 libSalomeIDLPYCALCULATOR_la_LIBADD  = \
55         $(KERNEL_LDFLAGS) -lSalomeIDLKernel \
56         $(MED_LDFLAGS) -lSalomeIDLMED \
57         @CORBA_LIBS@
58
59 # These variables defines the building process of CORBA files
60 OMNIORB_IDL         = @OMNIORB_IDL@
61 OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
62 OMNIORB_IDLPYFLAGS  = \
63         @OMNIORB_IDLPYFLAGS@ \
64         -I$(top_builddir)/idl/salome \
65         -I$(KERNEL_ROOT_DIR)/idl/salome \
66         -I$(MED_ROOT_DIR)/idl/salome
67
68 IDLCXXFLAGS = \
69         -bcxx \
70         @IDLCXXFLAGS@ \
71         -I$(top_builddir)/idl/salome \
72         -I$(KERNEL_ROOT_DIR)/idl/salome \
73         -I$(MED_ROOT_DIR)/idl/salome
74 IDLPYFLAGS  = \
75         @IDLPYFLAGS@ \
76         -I$(KERNEL_ROOT_DIR)/idl/salome \
77         -I$(MED_ROOT_DIR)/idl/salome
78
79 # potential problem on parallel make on the following - multiple outputs
80 SUFFIXES = .idl .hh SK.cc
81 .idlSK.cc:
82         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
83 .idl.hh:
84         $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
85
86 install-exec-local: $(BASEIDL_FILES:%=$(top_srcdir)/idl/%)
87         $(INSTALL) -d  $(DESTDIR)$(salomepythondir)
88         ls $^ | while read file; do \
89           $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
90         done
91
92 # we want to remove only staff generated for IDL files and nothing more
93 uninstall-local:
94         @for modulen in PYCALCULATOR_ORB ; do \
95           test -d $(DESTDIR)$(salomepythondir)/$${modulen} && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen} ; \
96           test -d $(DESTDIR)$(salomepythondir)/$${modulen}__POA && echo "Removing $(DESTDIR)$(salomepythondir)/$${modulen}__POA" && rm -rf $(DESTDIR)$(salomepythondir)/$${modulen}__POA ; \
97         done ; \
98         for filen in $(BASEIDL_FILES_PY) ; do \
99           echo "Removing $(DESTDIR)$(salomepythondir)/$${filen}" && rm -f $(DESTDIR)$(salomepythondir)/$${filen}* ; \
100         done
101
102 mostlyclean-local:
103         -rm -f *.hh *.cc .depidl
104
105 # we use cpp to generate dependencies between idl files.
106 # option x c tells the preprocessor to consider idl as a c file.
107 # if an idl is modified, all idl dependencies are rebuilt
108
109 .depidl: $(BASEIDL_FILES)
110         @echo "" > $@
111         @for dep in $^ dummy; do \
112           if [ $$dep != "dummy" ]; then \
113             echo Building dependencies for $$dep; \
114             $(CPP) $(C_DEPEND_FLAG) -x c -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome $$dep 2>/dev/null | \
115             sed 's/\.o/\SK.cc/' >>$@; \
116           fi; \
117         done ;
118
119 -include .depidl