summaryrefslogtreecommitdiffstats
path: root/oncology/dpfhack_display/reverse/Makefile
blob: d0a28b68a2113fa9b9983c7ce6bf47b578cf07b2 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Makefile for DPF firmware analysis


CFLAGS = -g

ASFLAGS = -plosgff

ifndef DUMP
	DUMP = -d
endif

VERSION = 0.01develop

AS = asx8051

INFILES = $(wildcard code*.in) $(wildcard dump*.in) $(wildcard data*.in)

ASMFILES = $(INFILES:%.in=%.asm)
BINFILES = $(INFILES:%.in=%.bin)

all: $(ASMFILES)

show:
	echo $(ASMFILES)

all.asm: $(ASMFILES)
	@echo concatenating all ASM files into $@
	@cat $(ASMFILES) > $@

%.rel : %.asm
	$(AS) $(ASFLAGS) $<

# Fixup format:
%.asm: %.d52
	@echo Generating $@
	@sed 's/\.equ/=/g;s/^\s*end/; END/g' $< > $@

test: main.o
	$(CC) -o $@ $<

clean: cleanimages
	rm -f test *.ctl *.asm dump*.bin code*.bin *.d52 *.lst *.rel *.sym

common.in:
	ln -s ../common.in .

dump%.ctl: dump%.in common.in
	@cat $< common.in >$@

code_%.ctl: code_%.in common.in
	@cat $< common.in >$@

data_%.ctl: data_%.in
	@cp $< $@

%.d52: %.bin %.ctl
	@d52 -p -b $(DUMP) -n $< # >/dev/null

cleanimages:
	rm -fr images/*

RAWFILES = $(wildcard *.raw)

IMAGES = $(RAWFILES:%.raw=images/%.png)

images/%.png: %.raw
	convert -size 128x128 -depth 1 gray:$< $@

images: $(IMAGES)

dump:
	PWD=`pwd`; BASE=`basename $$PWD`; \
	echo $$BASE; \
	python ../dump.py $$BASE full_image.bin

.PHONY: dump