summaryrefslogtreecommitdiff
path: root/util/blobtool/Makefile.inc
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2017-04-09 19:05:10 -0600
committerMartin Roth <martinroth@google.com>2017-04-14 17:26:30 +0200
commitcfce7930520610dd91291ce54b3ef62ce7565707 (patch)
treeb059bc74ae1a9f12f7314b8b49ee631ffbb0840a /util/blobtool/Makefile.inc
parentb0161fd2d8679882a50d1f3ce55cdf69278aa32f (diff)
util/blobtool: Hook into coreboot build
Add a Makefile.inc, based on sconfig's, to use the _shipped variants so that the build doesn't have to generate them with flex & bison. The GENPARSER check is inactive, and will be updated in the next commit. Add the c_shipped & h_shipped files for the current .l & .y files. Change-Id: Ia6c68bfb6e0611ceb6bc76cc66e43266bafc98ad Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/19228 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/blobtool/Makefile.inc')
-rw-r--r--util/blobtool/Makefile.inc41
1 files changed, 41 insertions, 0 deletions
diff --git a/util/blobtool/Makefile.inc b/util/blobtool/Makefile.inc
new file mode 100644
index 0000000000..74777a56cd
--- /dev/null
+++ b/util/blobtool/Makefile.inc
@@ -0,0 +1,41 @@
+blobtool_obj := blobtool.lex.o blobtool.tab.o
+
+BLOBTOOL_FLAGS += -I$(top)/util/blobtool -I$(objutil)/blobtool
+
+$(objutil)/blobtool:
+ mkdir -p $@
+
+$(objutil)/blobtool/.generated: $(objutil)/blobtool
+ touch $@
+
+$(objutil)/blobtool/%.o: util/blobtool/%.c | $(objutil)/blobtool/.generated
+ printf " HOSTCC $(subst $(obj)/,,$(@))\n"
+ $(HOSTCC) $(BLOBTOOL_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+$(objutil)/blobtool/%.o: $(objutil)/blobtool/%.c
+ printf " HOSTCC $(subst $(obj)/,,$(@))\n"
+ $(HOSTCC) $(BLOBTOOL_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+ifeq (0,1)
+$(top)/util/blobtool/blobtool.lex.c_shipped: $(top)/util/blobtool/blobtool.l
+ printf " FLEX $(subst $(top)/,,$(@))\n"
+ flex -L -o $@ $<
+
+# the .c rule also creates .h
+$(top)/util/blobtool/blobtool.tab.h_shipped: $(top)/util/blobtool/blobtool.tab.c_shipped
+$(top)/util/blobtool/blobtool.tab.c_shipped: $(top)/util/blobtool/blobtool.y
+ printf " BISON $(subst $(top)/,,$(@))\n"
+ bison -l --defines=$(top)/util/blobtool/blobtool.tab.h_shipped -o $@ $<
+endif
+
+$(objutil)/blobtool/blobtool.lex.o: $(objutil)/blobtool/blobtool.tab.h
+
+$(objutil)/blobtool/%: $(top)/util/blobtool/%_shipped
+ mkdir -p $(dir $@)
+ cp $< $@
+
+$(objutil)/blobtool/blobtool: $(addprefix $(objutil)/blobtool/,$(blobtool_obj))
+ printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
+ $(HOSTCC) $(BLOBTOOL_FLAGS) -o $@ $(addprefix $(objutil)/blobtool/,$(blobtool_obj))
+
+$(addprefix $(objutil)/blobtool/,$(blobtool_obj)) : $(objutil)/blobtool/blobtool.tab.h $(objutil)/blobtool/blobtool.tab.c $(objutil)/blobtool/blobtool.lex.c