soc/mediatek/mt8196: Add PMIC MT6316 driver
[coreboot2.git] / payloads / external / depthcharge / Makefile
blobaf303da872f06625d1a19380178832bdc05e966b
1 # 2023-05-10
2 STABLE_COMMIT_ID=c48613a71c1ee29295b184c51fe5dadf71b543c4
4 project_name=depthcharge
5 project_dir=$(CURDIR)/depthcharge
6 project_git_repo=$(DEPTHCHARGE_REPO)
7 project_config_file=$(project_dir)/.config
8 output_dir=$(project_dir)/build
9 libpayload_dir=$(abspath $(CURDIR)/../../libpayload)
10 libpayload_install_dir=$(output_dir)/lp_$(BOARD)
11 coreboot_build_dir=$(abspath $(CURDIR)/../../../build)
13 VBOOT_SOURCE ?= $(abspath $(CURDIR)/../../../3rdparty/vboot)
14 EC_HEADERS ?= $(abspath $(CURDIR)/../../../3rdparty/chromeec/include)
16 TAG-$(DEPTHCHARGE_MASTER)=$(DEPTHCHARGE_BRANCH)
17 TAG-$(DEPTHCHARGE_STABLE)=$(STABLE_COMMIT_ID)
18 TAG-$(DEPTHCHARGE_REVISION)=$(DEPTHCHARGE_REVISION_ID)
20 unexport KCONFIG_AUTOHEADER
21 unexport KCONFIG_AUTOCONFIG
22 unexport KCONFIG_DEPENDENCIES
23 unexport KCONFIG_SPLITCONFIG
24 unexport KCONFIG_TRISTATE
25 unexport KCONFIG_NEGATIVES
26 unexport src srck obj objk
28 BOARD:=$(notdir $(CONFIG_MAINBOARD_DIR))
30 ifeq ($(OVERRIDE_DEFCONFIG),y)
31 libpayload_config=$(libpayload_dir)/configs/defconfig
32 DEPTHCHARGE_LIBPAYLOAD_MSG="Depthcharge: Using default defconfig for libpayload"
33 else
34 libpayload_config=$(libpayload_dir)/configs/config.$(BOARD)
35 DEPTHCHARGE_LIBPAYLOAD_MSG="Depthcharge: Using $(libpayload_dir)/configs/config.$(BOARD)"
36 endif
38 all: build
40 $(project_dir):
41 @echo " Cloning $(project_name) from Git"
42 @git clone $(project_git_repo) $(project_name)
44 fetch: $(project_dir)
45 @cd $(project_dir); \
46 git show $(TAG-y) >/dev/null 2>&1; \
47 if [ $$? -ne 0 ] || \
48 [ "$(TAG-y)" = "origin/main" ]; then \
49 echo " Fetching new commits from the $(project_name) git repo"; \
50 git fetch; fi
52 # Check out the requested version of the tree
53 # Don't write a file for main branch so the latest remote version is always used
54 $(project_dir)/.version_$(TAG-y): fetch
55 echo " Checking out $(project_name) revision $(TAG-y)"
56 rm -f $(project_dir)/.version_*
57 cd $(project_dir); \
58 git checkout main; \
59 git branch -D coreboot 2>/dev/null; \
60 git checkout -b coreboot $(TAG-y)
61 ifneq ($(DEPTHCHARGE_MASTER),y)
62 touch $(project_dir)/.version_$(TAG-y)
63 endif
65 $(libpayload_install_dir): $(project_dir)
66 test -f $(libpayload_config) || \
67 (echo "Error: $(libpayload_config) is not present" && \
68 false)
69 echo $(DEPTHCHARGE_LIBPAYLOAD_MSG)
70 cp $(libpayload_config) $(libpayload_dir)/.config
71 (grep -q '^\s*CONFIG_LP_CHROMEOS=' $(libpayload_dir)/.config) || \
72 (echo "CONFIG_LP_CHROMEOS=y" >> $(libpayload_dir)/.config)
73 $(MAKE) -C $(libpayload_dir) olddefconfig
74 $(MAKE) -C $(libpayload_dir)
75 $(MAKE) -C $(libpayload_dir) install DESTDIR=$(libpayload_install_dir)
77 config: $(project_dir)/.version_$(TAG-y) $(libpayload_install_dir)
78 echo " CONFIG project_name $(TAG-y)"
79 export VERSION=$$(cd depthcharge && \
80 git describe --tags --long --dirty 2>/dev/null || \
81 echo "unknown") ; \
82 cd $(project_dir) && \
83 $(MAKE) BOARD=$(BOARD) \
84 LIBPAYLOAD_DIR=$(libpayload_install_dir)/libpayload \
85 VB_SOURCE=$(VBOOT_SOURCE) \
86 EC_HEADERS=$(EC_HEADERS) defconfig
88 build: config
89 echo " MAKE $(project_name) $(TAG-y)"
90 cp $(coreboot_build_dir)/static_fw_config.h depthcharge/src/base/
91 $(MAKE) -C $(project_dir) depthcharge BOARD=$(BOARD) \
92 LIBPAYLOAD_DIR=$(libpayload_install_dir)/libpayload \
93 VB_SOURCE=$(VBOOT_SOURCE) \
94 EC_HEADERS=$(EC_HEADERS) \
95 PATH="$(abspath ../../../build/util/cbfstool):$$PATH"
97 clean:
98 rm -rf $(output_dir)
100 distclean:
101 rm -rf $(project_dir)
103 print-repo-info:
104 echo "$(project_git_repo) $(project_dir)"
106 .PHONY: checkout config build clean distclean clone fetch print-repo-info