automake
[Top][All Lists]
Advanced

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

Re: Question marks in Makefile.in


From: Akim Demaille
Subject: Re: Question marks in Makefile.in
Date: 26 Feb 2001 17:20:37 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley)

Pavel Roskin <address@hidden> writes:

> > Nonetheless, given that we can never be sure to what extend the test
> > suite exercise Automake, I would include it anyway: better have
> > automake dying than make.  Just imagine
> >
> > ?SOME-CONDITION-RARELY-TRUE?  %SOME-PARAM-WE-FORGOT%.
> 
> Ok

Ideally we should be able to make this check statically, but we can't
yet: there are &ransform calls in if's.

This is an example of what I don't want to keep in automake:

    # If we have SUBDIRS, create all dist subdirectories and do
    # recursive build.
    if (&variable_defined ('SUBDIRS'))
    {
        # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
        # to all possible directories, and use it.  If DIST_SUBDIRS is
        # defined, just use it.
        my $dist_subdir_name;
        if (&variable_conditions ('SUBDIRS')
            || &variable_defined ('DIST_SUBDIRS'))
        {
            $dist_subdir_name = 'DIST_SUBDIRS';
            if (! &variable_defined ('DIST_SUBDIRS'))
            {
                &define_pretty_variable
                  ('DIST_SUBDIRS', '',
                   uniq (&variable_value_as_list ('SUBDIRS', 'all')));
            }
        }
        else
        {
            $dist_subdir_name = 'SUBDIRS';
            # We always define this because that is what `distclean'
            # wants.
            &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)');
        }

        $xform .= &transform ('DIST_SUBDIR_NAME' => $dist_subdir_name);
    }

    ...

    $output_rules .=
      &file_contents ('distdir',
                      $xform
                      . &transform ('DISTDIR' => !&variable_defined('distdir'),
                                    'DIST-TARGETS' => join(' ', @dist_targets),
                                    'TOP_DISTDIR'  => $top_distdir));

See? $xform is defined to do or *not* to do anything wrt
'DIST_SUBDIR_NAMÉ.  The code above should read

!   my $dist_subdir_name;
    # If we have SUBDIRS, create all dist subdirectories and do
    # recursive build.
    if (&variable_defined ('SUBDIRS'))
    {
        # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
        # to all possible directories, and use it.  If DIST_SUBDIRS is
        # defined, just use it.
        if (&variable_conditions ('SUBDIRS')
            || &variable_defined ('DIST_SUBDIRS'))
        {
            $dist_subdir_name = 'DIST_SUBDIRS';
            if (! &variable_defined ('DIST_SUBDIRS'))
            {
                &define_pretty_variable
                  ('DIST_SUBDIRS', '',
                   uniq (&variable_value_as_list ('SUBDIRS', 'all')));
            }
        }
        else
        {
            $dist_subdir_name = 'SUBDIRS';
            # We always define this because that is what `distclean'
            # wants.
            &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)');
!       }
    }

    ...

    $output_rules .=
      &file_contents ('distdir',
                       &transform ('DISTDIR' => !&variable_defined('distdir'),
                                    'DIST-TARGETS' => join(' ', @dist_targets),
                                    'TOP_DISTDIR'  => $top_distdir,
!                                   'DIST_SUBDIR_NAME' => $dist_subdir_name));


i.e., one by one, we get rid of everything that can mask
automake-substitution.

My ultimate goal is also to get rid of transform: it should be part of
file_contents itself (well, private).  This way we are *sure* there is
no dynamic constructs that can leave a case where something is passed
or not.

    $output_rules .=
      &file_contents ('distdir',
                       ('DISTDIR' => !&variable_defined('distdir'),
                        'DIST-TARGETS' => join(' ', @dist_targets),
                        'TOP_DISTDIR'  => $top_distdir,
                        'DIST_SUBDIR_NAME' => $dist_subdir_name));



Once we have this (which means continuing the uniformization of the
various substitutions performed at automake-time, but we are on good
tracks), then statically it will be easy to match a file_contents call
against the set of automake keys in the corresponding file.am.

Well, almost.  Some magic might be needed for the places where
file_contents is given the file name as argument (most typically
languages support).

Hm, statically is not enough.  

Still, this is my plan: pass the hash to file_contents, and no longer
some hand written $xform.  Then file_contents will be able to check
the completeness of the hash *before* the substitution, which makes it
possible to catch the thingy above (plus I find this much more
pleasant to read!).  Then we can disable this check out of the
Automake test suite.  Provided we are sure all the file.ams are
exercised by the test suite, which shouldn't be too hard, and
definitely a must.



reply via email to

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