19fffb55fSDavid Gibson# scripts/dtc makefile 29fffb55fSDavid Gibson 39fffb55fSDavid Gibsonhostprogs-y := dtc 49fffb55fSDavid Gibsonalways := $(hostprogs-y) 59fffb55fSDavid Gibson 69fffb55fSDavid Gibsondtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ 79fffb55fSDavid Gibson srcpos.o checks.o 89fffb55fSDavid Gibsondtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 99fffb55fSDavid Gibson 109fffb55fSDavid Gibson# Source files need to get at the userspace version of libfdt_env.h to compile 119fffb55fSDavid Gibson 129fffb55fSDavid GibsonHOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt 139fffb55fSDavid Gibson 149fffb55fSDavid GibsonHOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC) 159fffb55fSDavid GibsonHOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC) 169fffb55fSDavid GibsonHOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC) 179fffb55fSDavid GibsonHOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC) 189fffb55fSDavid GibsonHOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC) 199fffb55fSDavid GibsonHOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC) 209fffb55fSDavid GibsonHOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC) 219fffb55fSDavid GibsonHOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC) 229fffb55fSDavid Gibson 239fffb55fSDavid GibsonHOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC) 249fffb55fSDavid GibsonHOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) 259fffb55fSDavid Gibson 269fffb55fSDavid Gibson# dependencies on generated files need to be listed explicitly 279fffb55fSDavid Gibson$(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h 289fffb55fSDavid Gibson$(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h 299fffb55fSDavid Gibson 309fffb55fSDavid Gibsontargets += dtc-parser.tab.c dtc-lexer.lex.c 319fffb55fSDavid Gibson 329fffb55fSDavid Gibsonclean-files += dtc-parser.tab.h 339fffb55fSDavid Gibson 349fffb55fSDavid Gibson# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output 359fffb55fSDavid Gibson 369fffb55fSDavid Gibsonifdef GENERATE_PARSER 379fffb55fSDavid Gibson 389fffb55fSDavid GibsonBISON = bison 399fffb55fSDavid GibsonFLEX = flex 409fffb55fSDavid Gibson 419fffb55fSDavid Gibsonquiet_cmd_bison = BISON $@ 429fffb55fSDavid Gibson cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped 439fffb55fSDavid Gibsonquiet_cmd_flex = FLEX $@ 449fffb55fSDavid Gibson cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped 459fffb55fSDavid Gibson 469fffb55fSDavid Gibson$(obj)/dtc-parser.tab.c: $(src)/dtc-parser.y FORCE 479fffb55fSDavid Gibson $(call if_changed,bison) 489fffb55fSDavid Gibson 499fffb55fSDavid Gibson$(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c 509fffb55fSDavid Gibson 519fffb55fSDavid Gibson$(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE 529fffb55fSDavid Gibson $(call if_changed,flex) 539fffb55fSDavid Gibson 549fffb55fSDavid Gibsonendif 55