]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/GNUmakefile
BaseTools: Add LoongArch64 binding.
[mirror_edk2.git] / BaseTools / Source / C / GNUmakefile
1 ## @file
2 # GNU/Linux makefile for C tools build.
3 #
4 # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
5 #
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #
8
9 ifndef HOST_ARCH
10 #
11 # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
12 # try to figure out the appropriate HOST_ARCH.
13 #
14 uname_m = $(shell uname -m)
15 $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
16 ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
17 HOST_ARCH=X64
18 endif
19 ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
20 HOST_ARCH=IA32
21 endif
22 ifneq (,$(findstring aarch64,$(uname_m)))
23 HOST_ARCH=AARCH64
24 else ifneq (,$(findstring arm64,$(uname_m)))
25 HOST_ARCH=AARCH64
26 else ifneq (,$(findstring arm,$(uname_m)))
27 HOST_ARCH=ARM
28 endif
29 ifneq (,$(findstring riscv64,$(uname_m)))
30 HOST_ARCH=RISCV64
31 endif
32 ifneq (,$(findstring loongarch64,$(uname_m)))
33 HOST_ARCH=LOONGARCH64
34 endif
35 ifndef HOST_ARCH
36 $(info Could not detected HOST_ARCH from uname results)
37 $(error HOST_ARCH is not defined!)
38 endif
39 $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
40 endif
41
42 export HOST_ARCH
43
44 MAKEROOT = .
45
46 include Makefiles/header.makefile
47
48 all: makerootdir subdirs
49 @echo Finished building BaseTools C Tools with HOST_ARCH=$(HOST_ARCH)
50
51 LIBRARIES = Common
52 VFRAUTOGEN = VfrCompile/VfrLexer.h
53 APPLICATIONS = \
54 BrotliCompress \
55 VfrCompile \
56 EfiRom \
57 GenFfs \
58 GenFv \
59 GenFw \
60 GenSec \
61 GenCrc32 \
62 LzmaCompress \
63 TianoCompress \
64 VolInfo \
65 DevicePath
66
67 SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
68
69 $(LIBRARIES): $(MAKEROOT)/libs
70 $(APPLICATIONS): $(LIBRARIES) $(MAKEROOT)/bin $(VFRAUTOGEN)
71
72 .PHONY: outputdirs
73 makerootdir:
74 -mkdir -p $(MAKEROOT)
75
76 .PHONY: subdirs $(SUBDIRS)
77 subdirs: $(SUBDIRS)
78 $(SUBDIRS):
79 $(MAKE) -C $@
80
81 .PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
82 $(patsubst %,%-clean,$(sort $(SUBDIRS))):
83 -$(MAKE) -C $(@:-clean=) clean
84
85 $(VFRAUTOGEN): VfrCompile/VfrSyntax.g
86 $(MAKE) -C VfrCompile VfrLexer.h
87
88 clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
89
90 clean: localClean
91
92 localClean:
93 rm -f $(MAKEROOT)/bin/*
94 -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
95
96 include Makefiles/footer.makefile