aboutsummaryrefslogtreecommitdiff
path: root/util/bincfg/Makefile.inc
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2018-01-10 14:35:55 +0100
committerNico Huber <nico.h@gmx.de>2018-01-18 13:47:20 +0000
commit780e931eed8937bd8e304449913f487fa1d056c5 (patch)
tree24446641394bdabfee26130913eed808fe658ffa /util/bincfg/Makefile.inc
parent86391f16054ff1aa8af75b552204d24f3c00d50e (diff)
util/blobtool: rename to bincfg
The name blobtool is confusing as 'blob' is also used to describe nonfree software in binary form. Since this utility deals with binary configurations it makes more sense to call it bincfg. Change-Id: I3339274f1c42df4bb4a6b30b9538d91c3c03d7d0 Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> Reviewed-on: https://review.coreboot.org/23239 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/bincfg/Makefile.inc')
-rw-r--r--util/bincfg/Makefile.inc41
1 files changed, 41 insertions, 0 deletions
diff --git a/util/bincfg/Makefile.inc b/util/bincfg/Makefile.inc
new file mode 100644
index 0000000000..81c6af63b2
--- /dev/null
+++ b/util/bincfg/Makefile.inc
@@ -0,0 +1,41 @@
+bincfg_obj := bincfg.lex.o bincfg.tab.o
+
+BINCFG_FLAGS += -I$(top)/util/bincfg -I$(objutil)/bincfg
+
+$(objutil)/bincfg:
+ mkdir -p $@
+
+$(objutil)/bincfg/.generated: $(objutil)/bincfg
+ touch $@
+
+$(objutil)/bincfg/%.o: util/bincfg/%.c | $(objutil)/bincfg/.generated
+ printf " HOSTCC $(subst $(obj)/,,$(@))\n"
+ $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+$(objutil)/bincfg/%.o: $(objutil)/bincfg/%.c
+ printf " HOSTCC $(subst $(obj)/,,$(@))\n"
+ $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+ifeq ($(CONFIG_UTIL_GENPARSER),y)
+$(top)/util/bincfg/bincfg.lex.c_shipped: $(top)/util/bincfg/bincfg.l
+ printf " FLEX $(subst $(top)/,,$(@))\n"
+ flex -L -o $@ $<
+
+# the .c rule also creates .h
+$(top)/util/bincfg/bincfg.tab.h_shipped: $(top)/util/bincfg/bincfg.tab.c_shipped
+$(top)/util/bincfg/bincfg.tab.c_shipped: $(top)/util/bincfg/bincfg.y
+ printf " BISON $(subst $(top)/,,$(@))\n"
+ bison -l --defines=$(top)/util/bincfg/bincfg.tab.h_shipped -o $@ $<
+endif
+
+$(objutil)/bincfg/bincfg.lex.o: $(objutil)/bincfg/bincfg.tab.h
+
+$(objutil)/bincfg/%: $(top)/util/bincfg/%_shipped
+ mkdir -p $(dir $@)
+ cp $< $@
+
+$(objutil)/bincfg/bincfg: $(addprefix $(objutil)/bincfg/,$(bincfg_obj))
+ printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
+ $(HOSTCC) $(BINCFG_FLAGS) -o $@ $(addprefix $(objutil)/bincfg/,$(bincfg_obj))
+
+$(addprefix $(objutil)/bincfg/,$(bincfg_obj)) : $(objutil)/bincfg/bincfg.tab.h $(objutil)/bincfg/bincfg.tab.c $(objutil)/bincfg/bincfg.lex.c