Annotation of tme/modules, revision 1.1.1.2

1.1.1.2 ! root        1: # $Id$
1.1       root        2: 
                      3: ## This is an automake include file.
                      4: 
                      5: # Copyright (c) 2003 Matt Fredette
                      6: # All rights reserved.
                      7: #
                      8: # Redistribution and use in source and binary forms, with or without
                      9: # modification, are permitted provided that the following conditions
                     10: # are met:
                     11: # 1. Redistributions of source code must retain the above copyright
                     12: #    notice, this list of conditions and the following disclaimer.
                     13: # 2. Redistributions in binary form must reproduce the above copyright
                     14: #    notice, this list of conditions and the following disclaimer in the
                     15: #    documentation and/or other materials provided with the distribution.
                     16: # 3. All advertising materials mentioning features or use of this software
                     17: #    must display the following acknowledgement:
                     18: #      This product includes software developed by Matt Fredette.
                     19: # 4. The name of the author may not be used to endorse or promote products
                     20: #    derived from this software without specific prior written permission.
                     21: #
                     22: # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23: # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
                     24: # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
                     25: # DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
                     26: # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     27: # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     28: # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     29: # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
                     30: # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
                     31: # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     32: # POSSIBILITY OF SUCH DAMAGE.
                     33: 
                     34: # this automake include file must be included in all directories that
                     35: # build modules.  it updates the modules index that will be installed
                     36: # along with all of the modules, and also handles some static building
                     37: # details.  this is done with an all-local target:
                     38: all-local:
                     39: #
                     40: # first, all source files in the current directory are searched for
                     41: # element "new" function declarations.  these declarations provide
                     42: # enough information to determine the published module name, the
                     43: # libtool module name, and "submodule" name.  this information is
                     44: # appended to a tme-plugins.txt file, which will be installed in
                     45: # $(pkglibdir).
                     46: #
                     47: # the choice of $(top_builddir)/tme/tme-plugins.txt is important.
                     48: # when debugging, the person doing the debugging is expected to have
                     49: # the good sense to set LTDL_LIBRARY_PATH to $(top_builddir), so
                     50: # module.c will correctly use the uninstalled plugins list for all
                     51: # "tme/" modules.
                     52: #
                     53: # this is abuse of the $(top_builddir)/tme directory, yes, since
                     54: # this directory was originally just for include files and to make
                     55: # #include <tme/FOO.h> work right when building:
                     56:        @echo updating tme modules list..
1.1.1.2 ! root       57:        @( grep TME_ELEMENT_NEW_DECL $(srcdir)/*.c ;            \
        !            58:          grep TME_ELEMENT_SUB_NEW_DECL $(srcdir)/*.c ;         \
        !            59:          grep TME_ELEMENT_X_NEW_DECL $(srcdir)/*.c ) |         \
1.1       root       60:        sed -e 's%.*TME_ELEMENT_NEW_DECL(\(.*\)).*%\1%'         \
1.1.1.2 ! root       61:            -e 's%.*TME_ELEMENT_SUB_NEW_DECL(\(.*\),\(.*\)).*%\1_\2 \1 \2%' \
        !            62:            -e 's%.*TME_ELEMENT_X_NEW_DECL(\(.*\),\(.*\),\(.*\)).*%\1\3 \1\2 \3%' \
1.1       root       63:        >> $(top_builddir)/tme/tme-plugins.txt
                     64: #
                     65: # next, when building statically, either for debugging purposes or
                     66: # because we're on a weak platform, we have to use libtool's "preopen"
                     67: # mechanism.
                     68: #
                     69: # this means at least specifying all of the modules that could
                     70: # potentially be lt_dlopen'ed on any main program's link command line,
                     71: # using libtool's -dlpreopen option.
                     72: #
                     73: # so we append suitable -dlpreopen options for all modules built in
                     74: # this directory to a file, in this case
                     75: # $(top_builddir)/tme-preopen.txt.  when building statically,
                     76: # configure.in will then substitute @TME_PREOPEN@ with: 
                     77: #
                     78: #  `cat $(top_builddir)/tme-preopen.txt`
                     79: #
                     80: # else it will substitute the empty string.  when linking programs,
                     81: # @TME_PREOPEN@ is then used on the program's link command line.
                     82: # 
                     83: # additionally, libtool, at least through version 1.5, has a
                     84: # limitation in that the pseudo-library (the .la file) must be present
                     85: # even for a preloaded module.  if we aren't debugging, everything is
                     86: # installed, so this is not a problem.
                     87: #
                     88: # however, if we are debugging, nothing is installed, so we have to do
                     89: # something to make sure that the .la files can be found.
                     90: #
                     91: # the person doing the debugging is already expected to set
                     92: # LTDL_LIBRARY_PATH to the top of the build directory, so that
                     93: # module.c can find the uninstalled tme-plugins.txt file, and libtool
                     94: # will want to look in this directory for .la files, so we simply copy
                     95: # all of the .la files into that same directory:
                     96:        @if test "x$(pkglib_LTLIBRARIES)" != x; then            \
                     97:            for module in $(pkglib_LTLIBRARIES); do             \
                     98:                echo $$module ;                                 \
                     99:                echo -dlpreopen ../$(subdir)/$$module >> $(top_builddir)/tme-preopen.txt ; \
                    100:                cp $$module $(top_builddir)/tme ;               \
                    101:            done ;                                              \
                    102:        fi

unix.superglobalmegacorp.com