summaryrefslogtreecommitdiff
path: root/util/bincfg/Makefile.mk
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-01-18 18:46:58 -0700
committerFelix Singer <service+coreboot-gerrit@felixsinger.de>2024-01-26 12:43:18 +0000
commit1f30b244b296a131f4eaf95962bab048f8b3d481 (patch)
tree390c0dd1e31cd11ce4f2b664445f445d1f1f8996 /util/bincfg/Makefile.mk
parentba3a71966876aad1c720d7c385dd4058f844f5e8 (diff)
util: Rename Makefiles from .inc to .mk
The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I434940ebb46853980596f7ad55d27a62c90280fa Reviewed-on: https://review.coreboot.org/c/coreboot/+/80123 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util/bincfg/Makefile.mk')
-rw-r--r--util/bincfg/Makefile.mk42
1 files changed, 42 insertions, 0 deletions
diff --git a/util/bincfg/Makefile.mk b/util/bincfg/Makefile.mk
new file mode 100644
index 0000000000..0f5f442fd1
--- /dev/null
+++ b/util/bincfg/Makefile.mk
@@ -0,0 +1,42 @@
+## SPDX-License-Identifier: GPL-2.0-only
+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