2016-06-03 00:42:29 +02:00
|
|
|
##
|
|
|
|
## This file is part of the coreboot project.
|
|
|
|
##
|
|
|
|
## Copyright (C) 2017 Google Inc.
|
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; version 2 of the License.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
|
|
|
|
# force the shell to bash - the edksetup.sh script doesn't work with dash
|
|
|
|
export SHELL := env bash
|
|
|
|
|
|
|
|
project_name=Tianocore
|
|
|
|
project_dir=$(CURDIR)/tianocore
|
2019-02-21 06:46:15 +01:00
|
|
|
project_git_repo=https://github.com/mrchromebox/edk2
|
|
|
|
project_git_branch=coreboot_fb
|
|
|
|
upstream_git_repo=https://github.com/tianocore/edk2
|
|
|
|
|
|
|
|
# STABLE revision is MrChromebox's coreboot framebuffer (coreboot_fb) branch
|
|
|
|
TAG-$(CONFIG_TIANOCORE_STABLE)=origin/$(project_git_branch)
|
|
|
|
TAG-$(CONFIG_TIANOCORE_REVISION)=$(CONFIG_TIANOCORE_REVISION_ID)
|
2016-06-03 00:42:29 +02:00
|
|
|
|
|
|
|
export EDK_TOOLS_PATH=$(project_dir)/BaseTools
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_TIANOCORE_DEBUG),y)
|
|
|
|
BUILD_TYPE=DEBUG
|
|
|
|
else
|
|
|
|
BUILD_TYPE=RELEASE
|
|
|
|
endif
|
|
|
|
|
2018-09-08 02:58:08 +02:00
|
|
|
ifneq ($(CONFIG_TIANOCORE_USE_8254_TIMER), y)
|
|
|
|
TIMER=-DUSE_HPET_TIMER
|
|
|
|
endif
|
|
|
|
|
2016-06-03 00:42:29 +02:00
|
|
|
ifeq ($(CONFIG_TIANOCORE_TARGET_IA32), y)
|
2018-09-08 02:58:08 +02:00
|
|
|
BUILD_STR=-a IA32 -t COREBOOT -p CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc -b $(BUILD_TYPE) $(TIMER)
|
2016-06-03 00:42:29 +02:00
|
|
|
else
|
2018-09-08 02:58:08 +02:00
|
|
|
BUILD_STR=-a IA32 -a X64 -t COREBOOT -p CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc -b $(BUILD_TYPE) $(TIMER)
|
2016-06-03 00:42:29 +02:00
|
|
|
endif
|
|
|
|
|
2019-02-21 06:46:15 +01:00
|
|
|
all: clean build
|
2016-06-03 00:42:29 +02:00
|
|
|
|
|
|
|
$(project_dir):
|
|
|
|
echo " Cloning $(project_name) from Git"
|
2019-03-01 20:10:26 +01:00
|
|
|
git clone --branch $(project_git_branch) $(project_git_repo) $(project_dir); \
|
2019-02-21 06:46:15 +01:00
|
|
|
cd $(project_dir); \
|
|
|
|
git remote add upstream $(upstream_git_repo)
|
|
|
|
|
|
|
|
update: $(project_dir)
|
|
|
|
cd $(project_dir); \
|
|
|
|
echo " Fetching new commits from the $(project_name) repo"; \
|
|
|
|
git fetch --multiple origin upstream 2>/dev/null; \
|
|
|
|
if ! git rev-parse --verify -q $(TAG-y) >/dev/null; then \
|
|
|
|
echo " $(TAG-y) is not a valid git reference"; \
|
|
|
|
exit 1; \
|
2016-06-03 00:42:29 +02:00
|
|
|
fi; \
|
2019-02-21 06:46:15 +01:00
|
|
|
if git describe --all --dirty | grep -qv dirty; then \
|
|
|
|
echo " Checking out $(project_name) revision $(TAG-y)"; \
|
|
|
|
git checkout --detach $(TAG-y); \
|
|
|
|
else \
|
|
|
|
echo " Working directory not clean; will not overwrite"; \
|
|
|
|
fi
|
2016-06-03 00:42:29 +02:00
|
|
|
|
|
|
|
checktools:
|
|
|
|
echo "Checking uuid-dev..."
|
|
|
|
echo "#include <uuid/uuid.h>" > libtest.c
|
|
|
|
echo "int main(int argc, char **argv) { (void) argc; (void) argv; return 0; }" >> libtest.c
|
|
|
|
$(HOSTCC) $(HOSTCCFLAGS) libtest.c -o libtest >/dev/null 2>&1 && echo " found uuid-dev." || \
|
2018-06-16 11:14:16 +02:00
|
|
|
( echo " Not found."; echo "ERROR: please_install uuid-dev (libuuid-devel)"; exit 1 )
|
2016-06-03 00:42:29 +02:00
|
|
|
rm -rf libtest.c libtest
|
|
|
|
echo "Checking nasm..."
|
|
|
|
type nasm > /dev/null 2>&1 && echo " found nasm." || \
|
|
|
|
( echo " Not found."; echo "Error: Please install nasm."; exit 1 )
|
|
|
|
|
2019-02-21 06:46:15 +01:00
|
|
|
build: update checktools
|
2016-06-03 00:42:29 +02:00
|
|
|
unset CC; $(MAKE) -C $(project_dir)/BaseTools
|
|
|
|
echo " build $(project_name) $(TAG-y)"
|
2019-02-22 05:41:59 +01:00
|
|
|
if [ -n $(CONFIG_TIANOCORE_BOOTSPLASH_FILE) ]; then \
|
|
|
|
echo " Copying custom bootsplash image"; \
|
|
|
|
case "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" in \
|
|
|
|
/*) cp $(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
|
|
|
|
$(project_dir)/CorebootPayloadPkg/Logo/Logo.bmp;; \
|
|
|
|
*) cp $(top)/$(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
|
|
|
|
$(project_dir)/CorebootPayloadPkg/Logo/Logo.bmp;; \
|
|
|
|
esac \
|
|
|
|
fi; \
|
2016-06-03 00:42:29 +02:00
|
|
|
cd $(project_dir); \
|
|
|
|
export EDK_TOOLS_PATH=$(project_dir)/BaseTools; \
|
|
|
|
export WORKSPACE=$(project_dir); \
|
|
|
|
. ./edksetup.sh BaseTools; \
|
|
|
|
grep -q "COREBOOT" $(project_dir)/Conf/tools_def.txt; \
|
|
|
|
if [ $$? -ne 0 ]; then \
|
|
|
|
cat ../tools_def.txt >> $(project_dir)/Conf/tools_def.txt; \
|
|
|
|
fi; \
|
|
|
|
build $(BUILD_STR); \
|
2019-02-22 05:41:59 +01:00
|
|
|
mv $(project_dir)/Build/CorebootPayloadPkg*/*/FV/UEFIPAYLOAD.fd $(project_dir)/Build/UEFIPAYLOAD.fd; \
|
2019-03-15 20:18:09 +01:00
|
|
|
git checkout CorebootPayloadPkg/Logo/Logo.bmp > /dev/null 2>&1 || true
|
2016-06-03 00:42:29 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
test -d $(project_dir) && (cd $(project_dir); rm -rf Build; rm -f Conf/tools_def.txt) || exit 0
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
rm -rf $(project_dir)
|
|
|
|
|
2019-02-21 06:46:15 +01:00
|
|
|
.PHONY: all update checktools config build clean distclean
|