summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile74
1 files changed, 43 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 4b7e546..4cdcae6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,21 @@
+VERSION := $(shell if test -f version.txt; then cat version.txt; else git describe; fi)
+host_arch := $(shell uname -m)
+#export CC := $(CC) -static
+
# Just for convenience
keymapdir = resources/utilities/grub-assemble/keymap
-GRUB_MKFONT = src/grub/grub-mkfont
-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
+GRUB_MKFONT = src/$(host_arch)/grub/grub-mkfont
+GRUB_MKLAYOUT = src/$(host_arch)/grub/grub-mklayout
+GRUB_MKIMAGE = src/$(host_arch)/grub/grub-mkimage
+GRUB_MKSTANDALONE = src/$(host_arch)/grub/grub-mkstandalone --grub-mkimage=$(GRUB_MKIMAGE) -d src/$(host_arch)/grub/grub-core/
+CBFSTOOL = src/$(host_arch)/coreboot/util/cbfstool/cbfstool
+arches = i686 x86_64
+archs = $(arches)
boards = x60 t60 x60t macbook21
romtypes = txtmode vesafb
--include $(keymapdir)/list.mk # sets "keymaps=..."
+-include Makefile.d/keymap-list.mk # sets "keymaps=..."
i945boards = x60 x60t t60
@@ -19,46 +25,52 @@ roms = $(foreach board,$(boards),\
$(board)_$(keymap)_$(romtype))))
build: PHONY \
- $(foreach rom,$(roms),bin/$(rom).rom bin/$(rom)_with_seabios.rom) \
- src/flashrom/flashrom_normal \
- src/flashrom/flashrom_lenovobios_macronix \
- src/flashrom/flashrom_lenovobios_sst \
+ $(foreach rom,$(roms),roms/$(rom).rom roms/$(rom)_with_seabios.rom) \
+ src/$(host_arch)/flashrom/flashrom_normal \
+ src/$(host_arch)/flashrom/flashrom_lenovobios_macronix \
+ src/$(host_arch)/flashrom/flashrom_lenovobios_sst \
+ src/$(host_arch)/bucts/bucts
+
+
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
+multiglob = $(if $(strip $2),\
+ $(foreach item,$($(firstword $2)s),\
+ $(subst %($(firstword $2)),$(item),\
+ $(call multiglob,$1,$(wordlist 2,$(words $2),$2)))),\
+ $(_nl)$(value rule_$1)$(_nl))
-$(keymapdir)/list.mk: $(keymapdir)/original/
- echo keymaps = $$(ls $<) > $@
+configure: configure.ac
+ autoconf
+
+Makefile.d/keymap-list.mk: $(keymapdir)/original/ Makefile
+ echo keymaps = $(notdir $(wildcard $</*)) > $@
+Makefile.d/modules-list.mk: Makefile.d/modules/ Makefile
+ echo modules = $(patsubst %.mk,%,$(notdir $(wildcard $</*.mk))) > $@
-resources/grub/font/dejavusansmono.pf2: src/dejavu/ttf/DejaVuSansMono.ttf $(firstword $(GRUB_MKFONT))
+resources/grub/font/dejavusansmono.pf2: src/$(host_arch)/dejavu/ttf/DejaVuSansMono.ttf $(firstword $(GRUB_MKFONT))
$(GRUB_MKFONT) -o $@ $<
# % = $(keymap)
$(keymapdir)/%.gkb: $(keymapdir)/original/% $(firstword $(GRUB_MKLAYOUT))
$(GRUB_MKLAYOUT) -o $@ < $<
-include modules.mk
-include build.mk
-include grub-mkstandalone.mk
-include buildrom-withgrub.mk
-include addseabios.mk
+-include Makefile.d/modules-list.mk # sets "modules=..."
+include $(patsubst %,Makefile.d/modules/%.mk,$(modules))
+include Makefile.d/modules.mk
+include Makefile.d/build.mk
+include Makefile.d/grub-mkstandalone.mk
+include Makefile.d/buildrom-withgrub.mk
+include Makefile.d/addseabios.mk
+
+# It is important that build-release.mk is LAST, as it uses
+# MAKEFILE_LIST to know which files to copy.
+include Makefile.d/build-release.mk