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