-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfont-cc.mk
executable file
·75 lines (62 loc) · 1.59 KB
/
font-cc.mk
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
B:=$(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
ifndef GIMP
GIMP:=gimp
endif
MK_FONT_TINY= \
echo "(define (convert-xcf-to-header filename outfile) \
(let* ( \
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) \
(drawable (car (gimp-image-flatten image))) \
) \
(gimp-image-convert-rgb image) \
(file-header-save RUN-NONINTERACTIVE image drawable outfile outfile) \
(gimp-image-delete image) \
) \
) \
(gimp-message-set-handler 1) \
(convert-xcf-to-header \"$<\" \"$@\") \
(gimp-quit 0)" | gimp -i -b - &> $O/gimp-log && true # gimp is whiny, so give it a log file
%/scripts/font-tiny.h: $B/font-tiny.xcf
@mkdir -p $(@D)
ifeq ($(PRINT_PRETTY),1)
@printf " GIMP\t$@\n"
@$(MK_FONT_TINY)
else
$(MK_FONT_TINY)
endif
%/scripts/font-conv: $B/scripts/font-conv.c %/scripts/font-tiny.h
@mkdir -p $(@D)
ifeq ($(PRINT_PRETTY),1)
@printf " HOSTC\t$@\n"
@$(HOSTCC) -I "$(@D)" $< -o $@
else
$(HOSTCC) -I "$(@D)" $< -o $@
endif
%/font-tiny.bin: %/scripts/font-conv
ifeq ($(PRINT_PRETTY),1)
@printf " PIPE\t$@\n"
@$< > $@
else
$< > $@
endif
ASGEN= \
echo '?\
.global font_bin ?\
.section .rodata ?\
.type font_bin, %object ?\
font_bin: ?\
.incbin "$<" ?\
.align 4 ?\
.size font_bin, .-font_bin' | tr '?' '\n' > $@
%/font-tiny.S: %/font-tiny.bin
ifeq ($(PRINT_PRETTY),1)
@printf " ASGEN\t$@\n"
@$(ASGEN)
else
$(ASGEN)
endif
$O/../font-tiny-%.o: $O/../font-tiny.S
clean::
rm -rf $O/font-tiny.bin $O/scripts/font-conv $O/font-tiny.o \
$O/scripts/font-tiny.h $O/gimp-log
.PRECIOUS: %/font-tiny.S %/font-tiny.bin %/scripts/font-tiny.h %/scripts/font-conv