summaryrefslogtreecommitdiff
path: root/util/bincfg/Makefile
blob: 2dc5073f4a792700e4cc375a2244438523d9f366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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) $^ $(CFLAGS) $(LDFLAGS) -o $@

$(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
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: $(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: $(TARGET)
	./bincfg ifd-x200.spec ifd-x200.set flashregion_0_fd.bin

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