gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] noinst_${perhapsLT}LIBRARIES += $libname.$libext


From: Bruno Haible
Subject: Re: [gnulib-tool-py] noinst_${perhapsLT}LIBRARIES += $libname.$libext
Date: Mon, 13 Aug 2012 13:16:47 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

> I've finished long and difficult function func_emit_lib_Makefile_am.

Excellent!!

> The only part I need to do is to understand what does a long regex
> at lines 3416-3420 (where we decide if we shall emit
> "noinst_${perhapsLT}LIBRARIES += $libname.$libext"). Could you explain
> me what these lines do, please? I understand everything except "grep" part.

  if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= 
*$libname\\.$libext\$" "$tmp"/allsnippets > /dev/null \
     || { test -n "$makefile_name" \
          && test -f "$sourcebase/Makefile.am" \
          && LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= 
*$libname\\.$libext\$" "$sourcebase/Makefile.am" > /dev/null; \
        }; then
    # One of the snippets or the user's Makefile.am already specifies an
    # installation location for the library.

At this point, perhapsLT, libname, libext are known variables, e.g.
  perhapsLT = LT
  libname = libfoo
  libext = la
for a shared library, or
  perhapsLT =
  libname = libfoo
  libext = a
for a static library. What the first grep does, it to look in the
'allsnippets' part (which constitutes the main part of the generated
Makefile.am) whether it contains a declaration such as

  bin_LTLIBRARIES = libfoo.la
or
  pkglib_LTLIBRARIES += libfoo.la

So, it searches for a line that consists of
  - a prefix that is entirely built of alphanumeric characters or underscore,
  - the fixed string '_LTLIBRARIES',
  - optionally some spaces,
  - a '+=' or '=' operator,
  - optionally some spaces,
  - libfoo.la

What the second condition does:
  - it tests whether the --makefile-name option was passed or inferred
    from gnulib-cache.m4,
  - if so, it tests whether the Makefile.am file (which in this case is
    provided by the user, not generated by gnulib-tool) contains a line
    of the same kind.

In either case, Automake has been told that libfoo.la should be installed
in some place (bindir or pkglibdir, in the two examples above), and would
be confused if we well Automake that the library should not be installed.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]