Hi Simon, On Tue, 8 Oct 2024 at 18:57, Simon Glass <sjg@xxxxxxxxxxxx> wrote: > > > diff --git a/Makefile b/Makefile > > index f1f0ab368cd3..febdca5742c5 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -3,6 +3,26 @@ > > # Device Tree Compiler > > # > > > > +# try-run and cc-option were stolen from the Linux kernel > > +TMPOUT = .tmp_$$$$ > > +# try-run > > +# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) > > +# Exit code chooses option. "$$TMP" serves as a temporary file and is > > +# automatically cleaned up. > > +try-run = $(shell set -e; \ > > + TMP=$(TMPOUT)/tmp; \ > > + mkdir -p $(TMPOUT); \ > > + trap "rm -rf $(TMPOUT)" EXIT; \ > > + if ($(1)) >/dev/null 2>&1; \ > > + then echo "$(2)"; \ > > + else echo "$(3)"; \ > > + fi) > > + > > +# cc-option > > +# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) > > +cc-option = $(call try-run, \ > > + $(CC) -Werror $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) > > + > > # > > # Version information will be constructed in this order: > > # DTC_VERSION release version as MAJOR.MINOR.PATCH > > @@ -18,9 +38,12 @@ CONFIG_LOCALVERSION = > > ASSUME_MASK ?= 0 > > > > CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK) > > +# Warnings where we need to check they are supported > > +OPT_WARNINGS = $(call cc-option,-Wsuggest-attribute=format) > > This is fine, but you should be able to use the existing cc-option in U-Boot I seem to be missing something... how does U-Boot factor in here? My use case is to build a standalone version of dtc with clang for x86. This dtc is meant to run on the build host. U-Boot sources are not involved. Thanks, -Markus