aboutsummaryrefslogtreecommitdiff
path: root/Documentation/EDID/Makefile
blob: 85a927dfab020af6338259241ca1c27e5f57c299 (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

SOURCES	:= $(wildcard [0-9]*x[0-9]*.S)

BIN	:= $(patsubst %.S, %.bin, $(SOURCES))

IHEX	:= $(patsubst %.S, %.bin.ihex, $(SOURCES))

CODE	:= $(patsubst %.S, %.c, $(SOURCES))

all:	$(BIN) $(IHEX) $(CODE)

clean:
	@rm -f *.o *.bin.ihex *.bin *.c

%.o:	%.S
	@cc -c $^

%.bin.nocrc:	%.o
	@objcopy -Obinary $^ $@

%.crc:	%.bin.nocrc
	@list=$$(for i in `seq 1 127`; do head -c$$i $^ | tail -c1 \
		| hexdump -v -e '/1 "%02X+"'; done); \
		echo "ibase=16;100-($${list%?})%100" | bc >$@

%.p:	%.crc %.S
	@cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S

%.bin:	%.p
	@objcopy -Obinary $^ $@

%.bin.ihex:	%.p
	@objcopy -Oihex $^ $@
	@dos2unix $@ 2>/dev/null

%.c:	%.bin
	@echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@