Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 1 | UEFI_TOP_DIR := . |
| 2 | |
| 3 | ifndef $(BOOTLOADER_OUT) |
| 4 | BOOTLOADER_OUT := . |
| 5 | endif |
| 6 | export $(BOOTLOADER_OUT) |
| 7 | |
| 8 | BUILDDIR=$(shell pwd) |
Prathyush Katukojwala | eec0cc6 | 2017-08-23 12:00:14 -0700 | [diff] [blame] | 9 | export WRAPPER := $(BUILDDIR)/clang-wrapper.py |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 10 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 11 | export CLANG35_BIN := $(CLANG_BIN) |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 12 | export CLANG35_GCC_TOOLCHAIN := $(CLANG35_GCC_TOOLCHAIN) |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 13 | |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 14 | ifeq ($(TARGET_ARCHITECTURE),arm) |
| 15 | export ARCHITECTURE := ARM |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 16 | export CLANG35_ARM_PREFIX := $(CLANG_PREFIX) |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 17 | else |
| 18 | export ARCHITECTURE := AARCH64 |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 19 | export CLANG35_AARCH64_PREFIX := $(CLANG_PREFIX) |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 20 | endif |
| 21 | |
Jeevan Shriram | d29e440 | 2017-11-06 14:04:11 -0800 | [diff] [blame] | 22 | export BUILD_REPORT_DIR := $(BOOTLOADER_OUT)/build_report |
| 23 | ANDROID_PRODUCT_OUT := $(BOOTLOADER_OUT)/Build |
| 24 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 25 | WORKSPACE=$(BUILDDIR) |
| 26 | TARGET_TOOLS := CLANG35 |
| 27 | TARGET := DEBUG |
| 28 | BUILD_ROOT := $(ANDROID_PRODUCT_OUT)/$(TARGET)_$(TARGET_TOOLS) |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 29 | EDK_TOOLS := $(BUILDDIR)/BaseTools |
| 30 | EDK_TOOLS_BIN := $(EDK_TOOLS)/Source/C/bin |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 31 | ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv |
| 32 | ABL_FV_ELF := $(BOOTLOADER_OUT)/../../abl.elf |
lijuang | 4d342f6 | 2016-09-13 15:51:26 +0800 | [diff] [blame] | 33 | SHELL:=/bin/bash |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 34 | |
Trilok Soni | c1a2d14 | 2017-04-26 17:32:05 -0700 | [diff] [blame] | 35 | # UEFI UBSAN Configuration |
| 36 | # ENABLE_UEFI_UBSAN := true |
| 37 | |
| 38 | ifeq "$(ENABLE_UEFI_UBSAN)" "true" |
| 39 | UBSAN_GCC_FLAG_UNDEFINED := -fsanitize=undefined |
| 40 | UBSAN_GCC_FLAG_ALIGNMENT := -fno-sanitize=alignment |
| 41 | else |
| 42 | UBSAN_GCC_FLAG_UNDEFINED := |
| 43 | UBSAN_GCC_FLAG_ALIGNMENT := |
| 44 | endif |
| 45 | |
Jeevan Shriram | 90c404b | 2018-03-29 15:11:44 -0700 | [diff] [blame] | 46 | ifeq ($(TARGET_ARCHITECTURE), arm) |
Jeevan Shriram | 3254117 | 2017-12-02 10:19:23 -0800 | [diff] [blame] | 47 | LOAD_ADDRESS := 0X8FB00000 |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame] | 48 | else |
Jeevan Shriram | 3254117 | 2017-12-02 10:19:23 -0800 | [diff] [blame] | 49 | LOAD_ADDRESS := 0X9FA00000 |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame] | 50 | endif |
| 51 | |
Jeevan Shriram | 90c404b | 2018-03-29 15:11:44 -0700 | [diff] [blame] | 52 | ifeq ($(ENABLE_LE_VARIANT), true) |
| 53 | ENABLE_LE_VARIANT := 1 |
| 54 | else |
| 55 | ENABLE_LE_VARIANT := 0 |
| 56 | endif |
| 57 | |
lijuang | 65c51d5 | 2018-03-28 13:52:57 +0800 | [diff] [blame] | 58 | ifeq "$(ABL_USE_SDLLVM)" "true" |
| 59 | SDLLVM_COMPILE_ANALYZE := --compile-and-analyze |
| 60 | SDLLVM_ANALYZE_REPORT := $(BUILD_REPORT_DIR) |
| 61 | else |
| 62 | SDLLVM_COMPILE_ANALYZE := |
| 63 | SDLLVM_ANALYZE_REPORT := |
| 64 | endif |
| 65 | export SDLLVM_COMPILE_ANALYZE := $(SDLLVM_COMPILE_ANALYZE) |
| 66 | export SDLLVM_ANALYZE_REPORT := $(SDLLVM_ANALYZE_REPORT) |
| 67 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 68 | .PHONY: all cleanall |
| 69 | |
| 70 | all: ABL_FV_ELF |
| 71 | |
| 72 | cleanall: |
| 73 | @. ./edksetup.sh BaseTools && \ |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 74 | build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc -a $(ARCHITECTURE) -t $(TARGET_TOOLS) -b $(TARGET) -j build_modulepkg.log cleanall |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 75 | rm -rf $(WORKSPACE)/QcomModulePkg/Bin64 |
| 76 | |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 77 | EDK_TOOLS_BIN: |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 78 | @. ./edksetup.sh BaseTools && \ |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 79 | $(MAKE) -C $(EDK_TOOLS) -j1 |
| 80 | |
| 81 | ABL_FV_IMG: EDK_TOOLS_BIN |
| 82 | @. ./edksetup.sh BaseTools && \ |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame] | 83 | build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc \ |
| 84 | -a $(ARCHITECTURE) \ |
| 85 | -t $(TARGET_TOOLS) \ |
| 86 | -b $(TARGET) \ |
| 87 | -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) \ |
Mukesh Ojha | 8dc65f5 | 2018-03-27 00:59:30 +0530 | [diff] [blame^] | 88 | -D BUILD_SYSTEM_ROOT_IMAGE=$(BUILD_SYSTEM_ROOT_IMAGE) \ |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame] | 89 | -D VERIFIED_BOOT=$(VERIFIED_BOOT) \ |
| 90 | -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) \ |
Zhen Kong | dd5c5e3 | 2017-07-05 13:44:45 -0700 | [diff] [blame] | 91 | -D VERIFIED_BOOT_LE=$(VERIFIED_BOOT_LE) \ |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame] | 92 | -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \ |
| 93 | -D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \ |
| 94 | -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \ |
| 95 | -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \ |
| 96 | -j build_modulepkg.log $* |
| 97 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 98 | cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG) |
| 99 | |
| 100 | ABL_FV_ELF: ABL_FV_IMG |
Jeevan Shriram | 19a5381 | 2017-06-14 15:39:48 -0700 | [diff] [blame] | 101 | python $(WORKSPACE)/QcomModulePkg/Tools/image_header.py $(ABL_FV_IMG) $(ABL_FV_ELF) $(LOAD_ADDRESS) elf 32 |