summaryrefslogtreecommitdiff
path: root/util/bincfg
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2021-02-13 23:24:12 -0700
committerMartin Roth <martinroth@google.com>2021-04-05 17:21:04 +0000
commitfa9eb951d4ed8e357fcf52063ee6005e52a7b1b4 (patch)
tree5e52e7ea04a00f4825f201bd27d8bdfb7ad411b8 /util/bincfg
parent7bbcdc2f207aa2ed42f713aa455ff698f958ab24 (diff)
util/bincfg: Clean up Makefile
- Enable warnings - Enable warnings as errors - Remove debug flag -g - Add targets for all, distclean, and help - Add dependency of the bincfg file for output targets - Add all phony targets to .PHONY BUG=None TEST=Build all targets Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: Ic0302f663cbc931325334d0cce93d3b0bf937cc6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50654 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/bincfg')
-rw-r--r--util/bincfg/Makefile30
1 files changed, 24 insertions, 6 deletions
diff --git a/util/bincfg/Makefile b/util/bincfg/Makefile
index f568e67461..2dc5073f4a 100644
--- a/util/bincfg/Makefile
+++ b/util/bincfg/Makefile
@@ -2,9 +2,15 @@ CC = gcc
YACC = bison
LEX = flex
TARGET=bincfg
+WERROR=-Werror
+CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR}
+CFLAGS+=-Wno-unused-function
+LDFLAGS= -lfl
+
+all: $(TARGET)
$(TARGET): $(TARGET).lex.o $(TARGET).tab.o
- $(CC) $^ -Wall -Wno-unused-function -g -lfl -o $@
+ $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
$(TARGET).lex.c: $(TARGET).l $(TARGET).tab.h
$(LEX) -o $(patsubst $(TARGET).l,$(TARGET).lex.c,$<) $<
@@ -13,24 +19,36 @@ $(TARGET).tab.c $(TARGET).tab.h: $(TARGET).y
$(YACC) -d $<
# Use this target to generate GbE for X200
-gen-gbe-ich9m:
+gen-gbe-ich9m: $(TARGET)
./bincfg gbe-ich9m.spec gbe-ich9m.set gbe1.bin
# duplicate binary as per spec
cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin
rm -f gbe1.bin
# Use this target to generate GbE for X220/x230
-gen-gbe-82579LM:
+gen-gbe-82579LM: $(TARGET)
./bincfg gbe-82579LM.spec gbe-82579LM.set gbe1.bin
# duplicate binary as per spec
cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin
rm -f gbe1.bin
# Use this target to generate IFD for X200
-gen-ifd-x200:
+gen-ifd-x200: $(TARGET)
./bincfg ifd-x200.spec ifd-x200.set flashregion_0_fd.bin
-.PHONY: clean gen-gbe-ich9m gen-ifd-x200
-
clean:
rm -f *.lex.c *.tab.c *.tab.h *.o bincfg flashregion_0_fd.bin flashregion_3_gbe.bin
+
+distclean: clean
+
+help:
+ @echo "${TARGET}: Compiler/Decompiler for data blobs with specs"
+ @echo "Targets: all, clean, distclean, help"
+ @echo " gen-gbe-ich9m - generate GbE for X200"
+ @echo " gen-gbe-82579LM - generate GbE for X220/x230"
+ @echo " gen-ifd-x200 - generate IFD for X200"
+ @echo "To disable warnings as errors, run make as:"
+ @echo " make all WERROR=\"\""
+
+.PHONY: all clean distclean help
+.PHONY: gen-gbe-ich9m gen-ifd-x200 gen-gbe-82579LM