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
|
# Just for convenience
keymapdir = resources/utilities/grub-assemble/keymap
GRUB_MKLAYOUT = src/grub/grub-mklayout
GRUB_MKIMAGE = src/grub/grub-mkimage
GRUB_MKSTANDALONE = src/grub/grub-mkstandalone --grub-mkimage=$(GRUB_MKIMAGE) -d src/grub/grub-core/
CBFSTOOL = src/coreboot/util/cbfstool/cbfstool
boards = x60 t60 x60t macbook21
romtypes = txtmode vesafb
-include $(keymapdir)/list.mk # sets "keymaps=..."
i945boards = x60 x60t t60
build: \
$(foreach board,$(boards),\
$(foreach keymap,$(keymaps),\
$(foreach romtype,$(romtypes),\
bin/$(board)_$(keymap)_$(romtype).rom)))
define _nl
endef
# I wrote this between 3AM and 5AM. I have lost my sanity.
define _loop_rule
_loop_str := $$$$(_nl)$$$$(rule_$1)$$$$(_nl)
_loop_str := $$$$(foreach @,$$$$$$$$@,$$(_loop_str))
_loop_str := $$$$(foreach <,$$$$$$$$<,$$(_loop_str))
$(foreach var,$2,_loop_str := $$$$(foreach $(var),$$$$($(var)s),$$(_loop_str))$(_nl))
endef
define loop_rule
$(eval $(call _loop_rule,$1,$2))
$(eval _loop = $(_loop_str))
$(_loop)
endef
include modules.mk
include build.mk
include grub-mkstandalone.mk
include buildrom-withgrub.mk
$(keymapdir)/list.mk: $(keymapdir)/original/
echo keymaps = $$(ls $<) > $@
resources/grub/font/dejavusansmono.pf2: src/dejavu/ttv/DejaVuSansMono.ttf $(GRUB_MKFONT)
$(GRUB_MKFONT) -o $@ $<
# % = $(keymap)
$(keymapdir)/keymap/%.gkb: $(keymapdir)/orignal/% builddeps-grub
$(GRUB_MKLAYOUT) -o $@ < $<
|