diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2017-09-01 15:48:52 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-11-14 16:03:18 +0100 |
commit | 1761de60f0468d93a0f218f021e6e0e309ba0007 (patch) | |
tree | ce806373ed9ecc739e0f497d95edcd734caefa39 /Makefile | |
parent | d80f44e011942eff4c97e98ace8e4219ef96a5ce (diff) | |
download | qemu-firmware-1761de60f0468d93a0f218f021e6e0e309ba0007.tar.gz |
Add Makefile, add build rules for edk2
Based on roms/Makefile in qemu repo.
Paths have been adapted to qemu-firmware repo layout.
"make install" target has been added.
"make help" text is more verbose.
edk2 build rules and helper script added.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a6a4e1a --- /dev/null +++ b/Makefile @@ -0,0 +1,82 @@ +# 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 |