• Masahiro Yamada's avatar
    kbuild: fix if_change and friends to consider argument order · 9c8fa9bc
    Masahiro Yamada authored
    Currently, arg-check is implemented as follows:
    
      arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
                          $(filter-out $(cmd_$@),   $(cmd_$(1))) )
    
    This does not care about the order of arguments that appear in
    $(cmd_$(1)) and $(cmd_$@).  So, if_changed and friends never rebuild
    the target if only the argument order is changed.  This is a problem
    when the link order is changed.
    
    Apparently,
    
      obj-y += foo.o
      obj-y += bar.o
    
    and
    
      obj-y += bar.o
      obj-y += foo.o
    
    should be distinguished because the link order determines the probe
    order of drivers.  So, built-in.o should be rebuilt when the order
    of objects is changed.
    
    This commit fixes arg-check to compare the old/current commands
    including the argument order.
    
    Of course, this change has a side effect; Kbuild will react to the
    change of compile option order.  For example, "-DFOO -DBAR" and
    "-DBAR -DFOO" should give no difference to the build result, but
    false positiv...
    9c8fa9bc
Kbuild.include 14.6 KB