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