Michael has already replaced CFLAGS+=foo with DEB_CFLAGS_MAINT_APPEND:=foo https://salsa.debian.org/samba-team/samba/-/commit/505e4ff2084280b09eb1ecea277de056ff62684a
Ironically, the debian/rules for samba contains the exact same optimization we are talking about: # Fast version of dpkg/architecture.mk defining all vars in one go ifeq (${DEB_HOST_MULTIARCH},) $(foreach d, $(shell dpkg-architecture | sed 's/=/?=/'), $(eval export $d)) endif