2016-11-16 11:06:54 +01:00
|
|
|
CC = gcc
|
|
|
|
YACC = bison
|
|
|
|
LEX = flex
|
2018-01-10 14:35:55 +01:00
|
|
|
TARGET=bincfg
|
2021-02-14 07:24:12 +01:00
|
|
|
WERROR=-Werror
|
|
|
|
CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR}
|
|
|
|
CFLAGS+=-Wno-unused-function
|
|
|
|
LDFLAGS= -lfl
|
|
|
|
|
|
|
|
all: $(TARGET)
|
2016-11-16 11:06:54 +01:00
|
|
|
|
|
|
|
$(TARGET): $(TARGET).lex.o $(TARGET).tab.o
|
2021-02-14 07:24:12 +01:00
|
|
|
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
|
2016-11-16 11:06:54 +01:00
|
|
|
|
|
|
|
$(TARGET).lex.c: $(TARGET).l $(TARGET).tab.h
|
|
|
|
$(LEX) -o $(patsubst $(TARGET).l,$(TARGET).lex.c,$<) $<
|
|
|
|
|
|
|
|
$(TARGET).tab.c $(TARGET).tab.h: $(TARGET).y
|
|
|
|
$(YACC) -d $<
|
|
|
|
|
|
|
|
# Use this target to generate GbE for X200
|
2021-02-14 07:24:12 +01:00
|
|
|
gen-gbe-ich9m: $(TARGET)
|
2021-04-05 19:26:07 +02:00
|
|
|
$(abspath $(TARGET)) gbe-ich9m.spec gbe-ich9m.set gbe1.bin
|
2016-11-16 11:06:54 +01:00
|
|
|
# duplicate binary as per spec
|
|
|
|
cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin
|
|
|
|
rm -f gbe1.bin
|
|
|
|
|
2020-08-14 04:31:42 +02:00
|
|
|
# Use this target to generate GbE for X220/x230
|
2021-02-14 07:24:12 +01:00
|
|
|
gen-gbe-82579LM: $(TARGET)
|
2021-04-05 19:26:07 +02:00
|
|
|
$(abspath $(TARGET)) gbe-82579LM.spec gbe-82579LM.set gbe1.bin
|
2020-08-14 04:31:42 +02:00
|
|
|
# duplicate binary as per spec
|
|
|
|
cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin
|
|
|
|
rm -f gbe1.bin
|
|
|
|
|
2016-11-16 11:06:54 +01:00
|
|
|
# Use this target to generate IFD for X200
|
2021-02-14 07:24:12 +01:00
|
|
|
gen-ifd-x200: $(TARGET)
|
2021-04-05 19:26:07 +02:00
|
|
|
$(abspath $(TARGET)) ifd-x200.spec ifd-x200.set flashregion_0_fd.bin
|
2016-11-16 11:06:54 +01:00
|
|
|
|
|
|
|
clean:
|
2018-01-10 14:35:55 +01:00
|
|
|
rm -f *.lex.c *.tab.c *.tab.h *.o bincfg flashregion_0_fd.bin flashregion_3_gbe.bin
|
2021-02-14 07:24:12 +01:00
|
|
|
|
|
|
|
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
|