Makefile 1018 B

12345678910111213141516171819202122232425262728293031
  1. # SPDX-License-Identifier: GPL-2.0
  2. # scripts/dtc makefile
  3. hostprogs-$(CONFIG_DTC) := dtc
  4. always := $(hostprogs-y)
  5. dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
  6. srcpos.o checks.o util.o
  7. dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
  8. # Source files need to get at the userspace version of libfdt_env.h to compile
  9. HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
  10. ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
  11. ifneq ($(CHECK_DTBS),)
  12. $(error dtc needs libyaml for DT schema validation support. \
  13. Install the necessary libyaml development package.)
  14. endif
  15. HOST_EXTRACFLAGS += -DNO_YAML
  16. else
  17. dtc-objs += yamltree.o
  18. HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
  19. endif
  20. # Generated files need one more search path to include headers in source tree
  21. HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
  22. HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
  23. # dependencies on generated files need to be listed explicitly
  24. $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h