# directories DESTDIR ?= prefix ?= /usr/local datadir := $(DESTDIR)$(prefix)/share/qemu-firmware ############################################################################# # cross compiler auto detection path := $(subst :, ,$(PATH)) system := $(shell uname -s | tr "A-Z" "a-z") # first find cross binutils in path find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path)))) # then check we have cross gcc too find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1))))) # finally strip off path + toolname so we get the prefix find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) powerpc_cross_prefix := $(call find-cross-prefix,powerpc) x86_64_cross_prefix := $(call find-cross-prefix,x86_64) arm_cross_prefix := $(call find-cross-prefix,arm) aarch64_cross_prefix := $(call find-cross-prefix,aarch64) ############################################################################# # help text, common rules and targets default help: @echo @echo "nothing is done by default" @echo @echo "build targets:" @echo " edk2 -- build UEFI firmware" @echo @echo "other targets:" @echo " clean -- cleanup" @echo " install -- install blobs to $(datadir)" @echo @echo "You can set DESTDIR and prefix on the command line to" @echo "to change the install target directory, for example:" @echo "$ make prefix=/usr install" @echo install: mkdir -p $(datadir) cp -avr blobs/edk2-* $(datadir) clean: edk2-clean submodule-%: git submodule update --init repos/$* ############################################################################# # edk2 build rules edk2 uefi: edk2-i386 edk2-x86_64 edk2-arm edk2-aarch64 edk2-i386: submodule-edk2 sh scripts/compile-edk2.sh i386 $(x86_64_cross_prefix) edk2-x86_64: submodule-edk2 sh scripts/compile-edk2.sh x86_64 $(x86_64_cross_prefix) edk2-arm: submodule-edk2 sh scripts/compile-edk2.sh arm $(arm_cross_prefix) edk2-aarch64: submodule-edk2 sh scripts/compile-edk2.sh aarch64 $(aarch64_cross_prefix) edk2-tools: submodule-edk2 make -C repos/edk2/BaseTools edk2-clean: make -C repos/edk2/BaseTools clean rm -rf repos/edk2/Build rm -rf repos/edk2/Conf/BuildEnv.sh rm -rf repos/edk2/Conf/build_rule.txt rm -rf repos/edk2/Conf/target.txt rm -rf repos/edk2/Conf/tools_def.txt