Denis 'GNUtoo' Carikli | 780e931 | 2018-01-10 14:35:55 +0100 | [diff] [blame] | 1 | bincfg_obj := bincfg.lex.o bincfg.tab.o |
| 2 | |
| 3 | BINCFG_FLAGS += -I$(top)/util/bincfg -I$(objutil)/bincfg |
| 4 | |
| 5 | $(objutil)/bincfg: |
| 6 | mkdir -p $@ |
| 7 | |
| 8 | $(objutil)/bincfg/.generated: $(objutil)/bincfg |
| 9 | touch $@ |
| 10 | |
| 11 | $(objutil)/bincfg/%.o: util/bincfg/%.c | $(objutil)/bincfg/.generated |
| 12 | printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 13 | $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 14 | |
| 15 | $(objutil)/bincfg/%.o: $(objutil)/bincfg/%.c |
| 16 | printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 17 | $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 18 | |
| 19 | ifeq ($(CONFIG_UTIL_GENPARSER),y) |
| 20 | $(top)/util/bincfg/bincfg.lex.c_shipped: $(top)/util/bincfg/bincfg.l |
| 21 | printf " FLEX $(subst $(top)/,,$(@))\n" |
| 22 | flex -L -o $@ $< |
| 23 | |
| 24 | # the .c rule also creates .h |
| 25 | $(top)/util/bincfg/bincfg.tab.h_shipped: $(top)/util/bincfg/bincfg.tab.c_shipped |
| 26 | $(top)/util/bincfg/bincfg.tab.c_shipped: $(top)/util/bincfg/bincfg.y |
| 27 | printf " BISON $(subst $(top)/,,$(@))\n" |
| 28 | bison -l --defines=$(top)/util/bincfg/bincfg.tab.h_shipped -o $@ $< |
| 29 | endif |
| 30 | |
| 31 | $(objutil)/bincfg/bincfg.lex.o: $(objutil)/bincfg/bincfg.tab.h |
| 32 | |
| 33 | $(objutil)/bincfg/%: $(top)/util/bincfg/%_shipped |
| 34 | mkdir -p $(dir $@) |
| 35 | cp $< $@ |
| 36 | |
| 37 | $(objutil)/bincfg/bincfg: $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) |
| 38 | printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" |
| 39 | $(HOSTCC) $(BINCFG_FLAGS) -o $@ $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) |
| 40 | |
| 41 | $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) : $(objutil)/bincfg/bincfg.tab.h $(objutil)/bincfg/bincfg.tab.c $(objutil)/bincfg/bincfg.lex.c |