[Scons-users] How to turn off source scanner

Jason Kenny dragon512 at live.com
Wed Feb 6 21:31:50 EST 2019


Looking how to turn off a scanner for a build command.

Simple reproducer..

Run:
Git clone https://github.com/libunwind/libunwind.git

In the libunwind folder add a Sconstruct with this content

env = Environment()
env.Command(
    ["Makefile"],
    [
        "include/compiler.h",
        "include/dwarf-eh.h",
        "include/dwarf.h",
        "include/dwarf_i.h",
        "include/libunwind-aarch64.h",
        "include/libunwind-arm.h",
        "include/libunwind-common.h.in",
        "include/libunwind-coredump.h",
        "include/libunwind-dynamic.h",
        "include/libunwind.h.in",
        "include/libunwind-hppa.h",
        "include/libunwind-ia64.h",
        "include/libunwind_i.h",
        "include/libunwind-mips.h",
        "include/libunwind-ppc32.h",
        "include/libunwind-ppc64.h",
        "include/libunwind-ptrace.h",
        "include/libunwind-sh.h",
        "include/libunwind-tilegx.h",
        "include/libunwind-x86_64.h",
        "include/libunwind-x86.h",
        "include/mempool.h",
        "include/remote.h",
        "include/unwind.h",
    ],
    "autoreconf -if && ./configure\
     CC=${CC} CXX=${CXX}\
     "
)

Then run
Scons

Then run
Scons -debug=explain -n

You should see something as:
...
scons: Building targets ...
scons: rebuilding `Makefile' because:
           `include/config.h' is a new dependency
           `include/libunwind.h' is a new dependency
           `include/libunwind-common.h' is a new dependency
           `include/tdep/libunwind_i.h' is a new dependency
autoreconf -if && ./configure CC=gcc CXX=g++
scons: done building targets.

The reason for this is that the Commands source is a list of header files. These header files have a scanner running on them. When the configure logic is finished the config.h and other headers are generated. This cause a false rebuild to happen.

I would like to prevent the false rebuild.
The more complex case based on a function I am trying to define to make it easy to call autoconf project from scons to build a larger mega project. The issue I am having is that in case as this libunwind would be a "leaf component" that is needed by many other components. This rebuild of the Makefile causes a chain of build action that make for annoying and long builds on the second pass that are not needed. Technically the Makefile does not need to be rebuilt because config.h was added. However I have not found a way to get this fixed.

I tired adding

env.Ignore(['Makefile'],
    [
        'include/config.h',
           'include/libunwind.h',
           'include/libunwind-common.h',
           'include/tdep/libunwind_i.h',
    ]
)

But this results in a message of:
scons: rebuilding `Makefile' because the dependency order changed:...

Do you have thoughts on how to fix this? My main thought is to turn off the c\c++ scanner for this builder. However I am unaware of a method to do this.

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190207/4843d40c/attachment-0001.html>


More information about the Scons-users mailing list