1## SPDX-License-Identifier: GPL-2.0-only 2CC = gcc 3YACC = bison 4LEX = flex 5TARGET=bincfg 6WERROR=-Werror 7CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR} 8CFLAGS+=-Wno-unused-function 9LDFLAGS= -lfl 10 11all: $(TARGET) 12 13$(TARGET): $(TARGET).lex.o $(TARGET).tab.o 14 $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@ 15 16$(TARGET).lex.c: $(TARGET).l $(TARGET).tab.h 17 $(LEX) -o $(patsubst $(TARGET).l,$(TARGET).lex.c,$<) $< 18 19$(TARGET).tab.c $(TARGET).tab.h: $(TARGET).y 20 $(YACC) -d $< 21 22# Use this target to generate GbE for X200 23gen-gbe-ich9m: $(TARGET) 24 $(abspath $(TARGET)) gbe-ich9m.spec gbe-ich9m.set gbe1.bin 25 # duplicate binary as per spec 26 cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin 27 rm -f gbe1.bin 28 29# Use this target to generate GbE for X220/x230 30gen-gbe-82579LM: $(TARGET) 31 $(abspath $(TARGET)) gbe-82579LM.spec gbe-82579LM.set gbe1.bin 32 # duplicate binary as per spec 33 cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin 34 rm -f gbe1.bin 35 36# Use this target to generate IFD for X200 37gen-ifd-x200: $(TARGET) 38 $(abspath $(TARGET)) ifd-x200.spec ifd-x200.set flashregion_0_fd.bin 39 40clean: 41 rm -f *.lex.c *.tab.c *.tab.h *.o bincfg flashregion_0_fd.bin flashregion_3_gbe.bin 42 43distclean: clean 44 45help: 46 @echo "${TARGET}: Compiler/Decompiler for data blobs with specs" 47 @echo "Targets: all, clean, distclean, help" 48 @echo " gen-gbe-ich9m - generate GbE for X200" 49 @echo " gen-gbe-82579LM - generate GbE for X220/x230" 50 @echo " gen-ifd-x200 - generate IFD for X200" 51 @echo "To disable warnings as errors, run make as:" 52 @echo " make all WERROR=\"\"" 53 54.PHONY: all clean distclean help 55.PHONY: gen-gbe-ich9m gen-ifd-x200 gen-gbe-82579LM 56