1 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 ## We keep a list of dependencies in `.depend' for each of the source
25 ## files on which it depends. When one of the source files is modified
26 ## we remove its record from .depend and regenerate its dependencies,
27 ## tacking them onto the end of .depend. By including the .depend file
28 ## into the makefile, we're telling make that the makefile depends on
29 ## the dependency list in the .depend file.
30 ## This is as fast as the `.d' method described in the GNU make manual
31 ## for automatic dependencies, but has the added advantage that all
32 ## dependencies are stored in one place. The advantage over the
33 ## `makedepend' program is that only those files that are out of date
34 ## have dependency information rebuilt, and the Makefile is not
36 ## This is also where tracing information is updated. The $(TRACE)
37 ## program is run on each source file to make sure that the H5TRACE()
38 ## macros are up to date. If they are then the file is not modified,
39 ## otherwise the file is changed and a backup is saved by appending a
40 ## tilde to the file name.
42 $(srcdir)/Dependencies: .depend
43 @if test "$(srcdir)" != "."; then \
44 echo '## This file is machine generated on GNU systems.' >$@; \
45 echo '## Only temporary changes may be made here.' >>$@; \
47 perl -p $(top_srcdir)/bin/distdep .depend >>$@; \
49 echo 'Dependencies cannot be built when $$srcdir == $$builddir'; \
54 # when use the path as regexp, prevent taking "." for "any symbol"
55 srcdir_re = $(subst .,[.],$(srcdir))
56 top_srcdir_re = $(subst .,[.],$(top_srcdir))
57 top_builddir_re = $(subst .,[.],$(top_builddir))
59 # we had Makefile target, because we want Makefile rebuild before include .depend
60 .depend: $(LIB_DEP) $(TEST_SRC) $(BIN_DEP)
62 @for dep in X $? ; do \
63 if [ $$dep != "X" ]; then \
64 if [ $$dep != "Makefile" ]; then \
67 echo Building dependencies for $$dep; \
68 obj=`basename $$dep .c`.lo; \
69 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
70 $(CC) $(C_DEPEND_FLAG) $(CPPFLAGS) $$dep 2>/dev/null | \
71 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
72 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
73 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
74 sed 's/\.o/.lo/' >>$@; \
77 echo Building dependencies for $$dep; \
78 obj=`basename $$dep .cc`.lo; \
79 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
80 $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
81 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
82 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
83 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
84 sed 's/\.o/.lo/' >>$@; \
87 echo Building dependencies for $$dep; \
88 obj=`basename $$dep .cxx`.lo; \
89 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
90 $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
91 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
92 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
93 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
94 sed 's/\.o/.lo/' >>$@; \
105 -include $(top_builddir)/idl/.depidl