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 | |
| 11 | ifeq ($(ANDROID_BUILD_TOP),) |
| 12 | export CLANG35_AARCH64_PREFIX := $(CLANG_PREFIX) |
| 13 | else |
padarshr | 8518103 | 2016-07-09 02:32:43 +0530 | [diff] [blame] | 14 | export CLANG35_AARCH64_PREFIX := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)/bin/aarch64-linux-android- |
Maria Yu | 34a4793 | 2017-06-23 17:18:58 +0800 | [diff] [blame] | 15 | export CLANG35_AARCH64_GCC_TOOLCHAIN := $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION) |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 16 | endif |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 17 | export CLANG35_BIN := $(CLANG_BIN) |
Jeevan Shriram | c8ee40b | 2017-09-05 05:17:41 -0700 | [diff] [blame] | 18 | export CLANG35_ARM_PREFIX := $(CLANG_BIN)../tools/bin/arm- |
| 19 | export CLANG35_ARM_LINK_PREFIX := $(CLANG_LINK_PATH)/arm-linux-gnueabihf- |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 20 | |
lijuang | 35adede | 2017-07-27 20:52:45 +0800 | [diff] [blame] | 21 | export BUILD_REPORT_DIR := $(BOOTLOADER_OUT)/build_report |
Channagoud Kadabi | 53362e0 | 2016-06-29 18:34:12 -0700 | [diff] [blame] | 22 | ANDROID_PRODUCT_OUT := $(BOOTLOADER_OUT)/Build |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 23 | |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 24 | ifeq ($(TARGET_ARCHITECTURE),arm) |
| 25 | export ARCHITECTURE := ARM |
| 26 | else |
| 27 | export ARCHITECTURE := AARCH64 |
Maria Yu | 34a4793 | 2017-06-23 17:18:58 +0800 | [diff] [blame] | 28 | export CLANG35_GCC_TOOLCHAIN := $(CLANG35_AARCH64_GCC_TOOLCHAIN) |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 29 | endif |
| 30 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 31 | WORKSPACE=$(BUILDDIR) |
| 32 | TARGET_TOOLS := CLANG35 |
| 33 | TARGET := DEBUG |
| 34 | BUILD_ROOT := $(ANDROID_PRODUCT_OUT)/$(TARGET)_$(TARGET_TOOLS) |
Channagoud Kadabi | 6769899 | 2016-03-02 13:04:47 -0800 | [diff] [blame] | 35 | LOAD_ADDRESS := 0X9FA00000 |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 36 | EDK_TOOLS := $(BUILDDIR)/BaseTools |
| 37 | EDK_TOOLS_BIN := $(EDK_TOOLS)/Source/C/bin |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 38 | ABL_FV_IMG := $(BUILD_ROOT)/FV/abl.fv |
| 39 | ABL_FV_ELF := $(BOOTLOADER_OUT)/../../abl.elf |
lijuang | 4d342f6 | 2016-09-13 15:51:26 +0800 | [diff] [blame] | 40 | SHELL:=/bin/bash |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 41 | |
Trilok Soni | c1a2d14 | 2017-04-26 17:32:05 -0700 | [diff] [blame] | 42 | # UEFI UBSAN Configuration |
| 43 | # ENABLE_UEFI_UBSAN := true |
| 44 | |
| 45 | ifeq "$(ENABLE_UEFI_UBSAN)" "true" |
| 46 | UBSAN_GCC_FLAG_UNDEFINED := -fsanitize=undefined |
| 47 | UBSAN_GCC_FLAG_ALIGNMENT := -fno-sanitize=alignment |
| 48 | else |
| 49 | UBSAN_GCC_FLAG_UNDEFINED := |
| 50 | UBSAN_GCC_FLAG_ALIGNMENT := |
| 51 | endif |
| 52 | |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame^] | 53 | ifeq ($(ENABLE_LE_VARIANT), true) |
| 54 | ENABLE_LE_VARIANT := 1 |
| 55 | else |
| 56 | ENABLE_LE_VARIANT := 0 |
| 57 | endif |
| 58 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 59 | .PHONY: all cleanall |
| 60 | |
| 61 | all: ABL_FV_ELF |
| 62 | |
| 63 | cleanall: |
| 64 | @. ./edksetup.sh BaseTools && \ |
Jeevan Shriram | 4d4d5e6 | 2017-06-08 16:43:07 -0700 | [diff] [blame] | 65 | 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] | 66 | rm -rf $(WORKSPACE)/QcomModulePkg/Bin64 |
| 67 | |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 68 | EDK_TOOLS_BIN: |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 69 | @. ./edksetup.sh BaseTools && \ |
Channagoud Kadabi | 1ed4a15 | 2016-02-05 15:15:41 -0800 | [diff] [blame] | 70 | $(MAKE) -C $(EDK_TOOLS) -j1 |
| 71 | |
| 72 | ABL_FV_IMG: EDK_TOOLS_BIN |
| 73 | @. ./edksetup.sh BaseTools && \ |
Jeevan Shriram | 995c231 | 2017-10-10 14:25:00 -0700 | [diff] [blame^] | 74 | build -p $(WORKSPACE)/QcomModulePkg/QcomModulePkg.dsc \ |
| 75 | -a $(ARCHITECTURE) \ |
| 76 | -t $(TARGET_TOOLS) \ |
| 77 | -b $(TARGET) \ |
| 78 | -D ABL_OUT_DIR=$(ANDROID_PRODUCT_OUT) \ |
| 79 | -D VERIFIED_BOOT=$(VERIFIED_BOOT) \ |
| 80 | -D VERIFIED_BOOT_2=$(VERIFIED_BOOT_2) \ |
| 81 | -D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \ |
| 82 | -D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \ |
| 83 | -D UBSAN_UEFI_GCC_FLAG_UNDEFINED=$(UBSAN_GCC_FLAG_UNDEFINED) \ |
| 84 | -D UBSAN_UEFI_GCC_FLAG_ALIGNMENT=$(UBSAN_GCC_FLAG_ALIGNMENT) \ |
| 85 | -j build_modulepkg.log $* |
| 86 | |
Sridhar Parasuram | fedf9ac | 2015-11-03 16:20:50 -0800 | [diff] [blame] | 87 | cp $(BUILD_ROOT)/FV/FVMAIN_COMPACT.Fv $(ABL_FV_IMG) |
| 88 | |
| 89 | ABL_FV_ELF: ABL_FV_IMG |
Jeevan Shriram | 19a5381 | 2017-06-14 15:39:48 -0700 | [diff] [blame] | 90 | python $(WORKSPACE)/QcomModulePkg/Tools/image_header.py $(ABL_FV_IMG) $(ABL_FV_ELF) $(LOAD_ADDRESS) elf 32 |