Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # scripts/dtc makefile
  2. hostprogs-y := dtc
  3. always := $(hostprogs-y)
  4. dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
  5. srcpos.o checks.o util.o
  6. dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
  7. # Source files need to get at the userspace version of libfdt_env.h to compile
  8. HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
  9. HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
  10. HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
  11. HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
  12. HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
  13. HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
  14. HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
  15. HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
  16. HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
  17. HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
  18. HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
  19. HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
  20. # dependencies on generated files need to be listed explicitly
  21. $(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
  22. $(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h
  23. targets += dtc-parser.tab.c dtc-lexer.lex.c
  24. clean-files += dtc-parser.tab.h
  25. # GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output
  26. ifdef GENERATE_PARSER
  27. BISON = bison
  28. FLEX = flex
  29. quiet_cmd_bison = BISON $@
  30. cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
  31. quiet_cmd_flex = FLEX $@
  32. cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
  33. $(obj)/dtc-parser.tab.c: $(src)/dtc-parser.y FORCE
  34. $(call if_changed,bison)
  35. $(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c
  36. $(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE
  37. $(call if_changed,flex)
  38. endif