blob: 31b0f53b1870254251710beb4f5445467bd71d70 [file] [log] [blame]
Michael Niewöhnere9794422019-10-26 00:06:42 +02001TAG-$(CONFIG_GRUB2_MASTER)=origin/HEAD
Denis 'GNUtoo' Carikli08cf1952016-09-14 14:41:36 +02002TAG-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
Paul Menzel35553892019-07-06 09:53:01 +02003TAG-$(CONFIG_GRUB2_STABLE)=grub-2.04
Vladimir Serbinenko113a3662013-11-14 12:10:08 +01004NAME-$(CONFIG_GRUB2_MASTER)=HEAD
Denis 'GNUtoo' Carikli08cf1952016-09-14 14:41:36 +02005NAME-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID)
Paul Menzel35553892019-07-06 09:53:01 +02006NAME-$(CONFIG_GRUB2_STABLE)=2.04
Vladimir Serbinenko113a3662013-11-14 12:10:08 +01007
Jonathan Neuschäfera1c42cc2017-09-02 20:34:53 +02008project_git_repo=https://git.savannah.gnu.org/git/grub.git/
Martin Rothae269c02016-03-16 12:42:05 -06009project_dir=grub2
10
Nico Hubera2ab1fd2017-08-14 01:38:24 +020011unexport HOSTCC CC LD OBJCOPY STRIP
12MAKEOVERRIDES :=
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010013
14all: grub2
15
16checkout:
17 echo " GIT GRUB2 $(NAME-y)"
Michael Niewöhnere9794422019-10-26 00:06:42 +020018 test -d $(project_dir) || git clone $(project_git_repo) $(project_dir)
19 git -C $(project_dir) fetch
Michael Niewöhner7ba4ada2020-05-01 22:55:44 +020020ifeq ($(shell test -d $(project_dir) && \
Michael Niewöhnerfcd9f362020-05-04 20:14:37 +020021 (git -C $(project_dir) status --ignored=no --untracked-files=no --porcelain)),)
Michael Niewöhnere9794422019-10-26 00:06:42 +020022 git -C $(project_dir) checkout -f $(TAG-y)
23else
24 echo "WARNING: index/tree not clean, skipping update / force checkout."
Michael Niewöhner7f9c0642020-05-01 23:01:28 +020025 echo " Checkout manually with "\
26 "\`git -C payloads/external/GRUB2/$(project_dir) checkout -f\`."
Michael Niewöhnere9794422019-10-26 00:06:42 +020027endif
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010028
Nico Huber4ff44922017-08-14 01:58:28 +020029grub2/build/config.h: $(CONFIG_DEP) | checkout
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010030 echo " CONFIG GRUB2 $(NAME-y)"
31 rm -rf grub2/build
32 mkdir grub2/build
Gompa73c405a2019-07-16 13:44:48 +020033 cd grub2 && ./bootstrap ; ./autogen.sh
Nico Hubera2ab1fd2017-08-14 01:38:24 +020034 cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
Nico Huberbb10ec32018-06-04 11:42:39 +020035 FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \
Nico Hubera2ab1fd2017-08-14 01:38:24 +020036 TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
37 CFLAGS=-O2 TARGET_CFLAGS=-Os \
38 --with-platform=coreboot --enable-boot-time --disable-werror
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010039
Nico Huber4ff44922017-08-14 01:58:28 +020040config: grub2/build/config.h checkout
41
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010042grub2: config
43 echo " MAKE GRUB2 $(NAME-y)"
Nico Hubera2ab1fd2017-08-14 01:38:24 +020044 $(MAKE) -C grub2/build
Benjamin Barenblat99932862016-06-15 12:08:06 -070045 $(MAKE) -C grub2/build default_payload.elf \
46 EXTRA_PAYLOAD_MODULES="$(CONFIG_GRUB2_EXTRA_MODULES)"
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010047
48clean:
Nico Hubera2ab1fd2017-08-14 01:38:24 +020049 test -f grub2/build/Makefile && $(MAKE) -C grub2/build clean || exit 0
Vladimir Serbinenko113a3662013-11-14 12:10:08 +010050
51distclean:
52 rm -rf grub2
53
Martin Rothae269c02016-03-16 12:42:05 -060054print-repo-info:
55 echo "$(project_git_repo) $(project_dir)"
56
57.PHONY: checkout config grub2 clean distclean print-repo-info