Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 1 | CC = gcc |
| 2 | YACC = bison |
| 3 | LEX = flex |
Denis 'GNUtoo' Carikli | 780e931 | 2018-01-10 14:35:55 +0100 | [diff] [blame] | 4 | TARGET=bincfg |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 5 | WERROR=-Werror |
| 6 | CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR} |
| 7 | CFLAGS+=-Wno-unused-function |
| 8 | LDFLAGS= -lfl |
| 9 | |
| 10 | all: $(TARGET) |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 11 | |
| 12 | $(TARGET): $(TARGET).lex.o $(TARGET).tab.o |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 13 | $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@ |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 14 | |
| 15 | $(TARGET).lex.c: $(TARGET).l $(TARGET).tab.h |
| 16 | $(LEX) -o $(patsubst $(TARGET).l,$(TARGET).lex.c,$<) $< |
| 17 | |
| 18 | $(TARGET).tab.c $(TARGET).tab.h: $(TARGET).y |
| 19 | $(YACC) -d $< |
| 20 | |
| 21 | # Use this target to generate GbE for X200 |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 22 | gen-gbe-ich9m: $(TARGET) |
Martin Roth | a789607 | 2021-04-05 11:26:07 -0600 | [diff] [blame] | 23 | $(abspath $(TARGET)) gbe-ich9m.spec gbe-ich9m.set gbe1.bin |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 24 | # duplicate binary as per spec |
| 25 | cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin |
| 26 | rm -f gbe1.bin |
| 27 | |
Tom Hiller | 9e7c99d | 2020-08-13 22:31:42 -0400 | [diff] [blame] | 28 | # Use this target to generate GbE for X220/x230 |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 29 | gen-gbe-82579LM: $(TARGET) |
Martin Roth | a789607 | 2021-04-05 11:26:07 -0600 | [diff] [blame] | 30 | $(abspath $(TARGET)) gbe-82579LM.spec gbe-82579LM.set gbe1.bin |
Tom Hiller | 9e7c99d | 2020-08-13 22:31:42 -0400 | [diff] [blame] | 31 | # duplicate binary as per spec |
| 32 | cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin |
| 33 | rm -f gbe1.bin |
| 34 | |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 35 | # Use this target to generate IFD for X200 |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 36 | gen-ifd-x200: $(TARGET) |
Martin Roth | a789607 | 2021-04-05 11:26:07 -0600 | [diff] [blame] | 37 | $(abspath $(TARGET)) ifd-x200.spec ifd-x200.set flashregion_0_fd.bin |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 38 | |
Damien Zammit | 0685322 | 2016-11-16 21:06:54 +1100 | [diff] [blame] | 39 | clean: |
Denis 'GNUtoo' Carikli | 780e931 | 2018-01-10 14:35:55 +0100 | [diff] [blame] | 40 | rm -f *.lex.c *.tab.c *.tab.h *.o bincfg flashregion_0_fd.bin flashregion_3_gbe.bin |
Martin Roth | fa9eb95 | 2021-02-13 23:24:12 -0700 | [diff] [blame] | 41 | |
| 42 | distclean: clean |
| 43 | |
| 44 | help: |
| 45 | @echo "${TARGET}: Compiler/Decompiler for data blobs with specs" |
| 46 | @echo "Targets: all, clean, distclean, help" |
| 47 | @echo " gen-gbe-ich9m - generate GbE for X200" |
| 48 | @echo " gen-gbe-82579LM - generate GbE for X220/x230" |
| 49 | @echo " gen-ifd-x200 - generate IFD for X200" |
| 50 | @echo "To disable warnings as errors, run make as:" |
| 51 | @echo " make all WERROR=\"\"" |
| 52 | |
| 53 | .PHONY: all clean distclean help |
| 54 | .PHONY: gen-gbe-ich9m gen-ifd-x200 gen-gbe-82579LM |