• Bug#872381: dpkg-dev: optimize Makefile snippets for debian/rules (3/5)

    From Nicolas Boulenguez@1:229/2 to All on Wed Jan 10 22:10:01 2024
    [continued from previous message]

    - test "$(CXXFLAGS)" = "$(TEST_CXXFLAGS)"
    - test "$(CXXFLAGS_FOR_BUILD)" = "$(TEST_CXXFLAGS_FOR_BUILD)"
    - test "$(DFLAGS)" = "$(TEST_DFLAGS)"
    - test "$(DFLAGS_FOR_BUILD)" = "$(TEST_DFLAGS_FOR_BUILD)"
    - test "$(FCFLAGS)" = "$(TEST_FCFLAGS)"
    - test "$(FCFLAGS_FOR_BUILD)" = "$(TEST_FCFLAGS_FOR_BUILD)"
    - test "$(FFLAGS)" = "$(TEST_FFLAGS)"
    - test "$(FFLAGS_FOR_BUILD)" = "$(TEST_FFLAGS_FOR_BUILD)"
    - test "$(LDFLAGS)" = "$(TEST_LDFLAGS)"
    - test "$(LDFLAGS_FOR_BUILD)" = "$(TEST_LDFLAGS_FOR_BUILD)"
    - test "$(OBJCFLAGS)" = "$(TEST_OBJCFLAGS)"
    - test "$(OBJCFLAGS_FOR_BUILD)" = "$(TEST_OBJCFLAGS_FOR_BUILD)"
    - test "$(OBJCXXFLAGS)" = "$(TEST_OBJCXXFLAGS)"
    - test "$(OBJCXXFLAGS_FOR_BUILD)" = "$(TEST_OBJCXXFLAGS_FOR_BUILD)"
    +vars := \
    + ASFLAGS \
    + CFLAGS \
    + DFLAGS \
    + FCFLAGS \
    + FFLAGS \
    + GCJFLAGS \
    + LDFLAGS \
    + OBJCFLAGS \
    + OBJCXXFLAGS \
    + # EOL
    +loop_targets := $(vars) $(vars:=_FOR_BUILD)
    +
    +test: $(loop_targets)
    + test '$(CXXFLAGS)' = 'set'
    + test "$${CXXFLAGS}" = 'set'
    + test '$(CXXFLAGS_FOR_BUILD)' = 'set'
    + test "$${CXXFLAGS_FOR_BUILD}" = 'set'
    +
    + test '$(CPPFLAGS)' = '$(TEST_CPPFLAGS) -DTEST_MK=test-host'
    + test "$${CPPFLAGS}" = '$(TEST_CPPFLAGS) -DTEST_MK=test-host'
    + test '$(CPPFLAGS_FOR_BUILD)' = '$(TEST_CPPFLAGS_FOR_BUILD) -DTEST_MK=test-build'
    + test "$${CPPFLAGS_FOR_BUILD}" = '$(TEST_CPPFLAGS_FOR_BUILD) -DTEST_MK=test-build'
    +
    +$(loop_targets):
    + # Test the Make variable.
    + test '$($@)' = '$(TEST_$@)'
    + # Test the exported shell variable.
    + test "$${$@}" = '$(TEST_$@)'
    diff --git a/scripts/t/mk/buildtools.mk b/scripts/t/mk/buildtools.mk
    index 6c27c5cf2..1df8f8b61 100644
    --- a/scripts/t/mk/buildtools.mk
    +++ b/scripts/t/mk/buildtools.mk
    @@ -1,33 +1,36 @@
    +AR := overridden
    +DPKG_EXPORT_BUILDTOOLS := 1
    +
    include $(srcdir)/mk/buildtools.mk

    -test:
    - test "$(AS)" = "$(TEST_AS)"
    - test "$(AS_FOR_BUILD)" = "$(TEST_AS_FOR_BUILD)"
    - test "$(CC)" = "$(TEST_CC)"
    - test "$(CC_FOR_BUILD)" = "$(TEST_CC_FOR_BUILD)"
    - test "$(CXX)" = "$(TEST_CXX)"
    - test "$(CXX_FOR_BUILD)" = "$(TEST_CXX_FOR_BUILD)"
    - test "$(OBJC)" = "$(TEST_OBJC)"
    - test "$(OBJC_FOR_BUILD)" = "$(TEST_OBJC_FOR_BUILD)"
    - test "$(OBJCXX)" = "$(TEST_OBJCXX)"
    - test "$(OBJCXX_FOR_BUILD)" = "$(TEST_OBJCXX_FOR_BUILD)"
    - test "$(F77)" = "$(TEST_F77)"
    - test "$(F77_FOR_BUILD)" = "$(TEST_F77_FOR_BUILD)"
    - test "$(FC)" = "$(TEST_FC)"
    - test "$(FC_FOR_BUILD)" = "$(TEST_FC_FOR_BUILD)"
    - test "$(LD)" = "$(TEST_LD)"
    - test "$(LD_FOR_BUILD)" = "$(TEST_LD_FOR_BUILD)"
    - test "$(STRIP)" = "$(TEST_STRIP)"
    - test "$(STRIP_FOR_BUILD)" = "$(TEST_STRIP_FOR_BUILD)"
    - test "$(OBJCOPY)" = "$(TEST_OBJCOPY)"
    - test "$(OBJCO