]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/GNUmakefile
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / GNUmakefile
CommitLineData
f51461c8
LG
1## @file\r
2# GNU/Linux makefile for C tools build.\r
3#\r
9e1131b7 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
ad2a2e56
AB
24 endif\r
25 ifneq (,$(findstring arm,$(uname_m)))\r
a9f6e0a4 26 HOST_ARCH=ARM\r
ad2a2e56 27 endif\r
a9f6e0a4
LG
28 ifndef HOST_ARCH\r
29 $(info Could not detected HOST_ARCH from uname results)\r
30 $(error HOST_ARCH is not defined!)\r
f51461c8 31 endif\r
a9f6e0a4 32 $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)\r
f51461c8
LG
33endif\r
34\r
a9f6e0a4 35export HOST_ARCH\r
f51461c8
LG
36\r
37MAKEROOT = .\r
38\r
39include Makefiles/header.makefile\r
40\r
9e1131b7 41all: makerootdir subdirs\r
a9f6e0a4 42 @echo Finished building BaseTools C Tools with HOST_ARCH=$(HOST_ARCH)\r
f51461c8
LG
43\r
44LIBRARIES = Common\r
9e1131b7 45VFRAUTOGEN = VfrCompile/VfrLexer.h\r
f51461c8 46APPLICATIONS = \\r
81fa5ad0
LG
47 BrotliCompress \\r
48 VfrCompile \\r
f51461c8
LG
49 EfiRom \\r
50 GenFfs \\r
51 GenFv \\r
52 GenFw \\r
f51461c8
LG
53 GenSec \\r
54 GenCrc32 \\r
f51461c8
LG
55 LzmaCompress \\r
56 Split \\r
57 TianoCompress \\r
7dbc50bd
YZ
58 VolInfo \\r
59 DevicePath\r
f51461c8
LG
60\r
61SUBDIRS := $(LIBRARIES) $(APPLICATIONS)\r
62\r
9e1131b7
LG
63$(LIBRARIES): $(MAKEROOT)/libs\r
64$(APPLICATIONS): $(LIBRARIES) $(MAKEROOT)/bin $(VFRAUTOGEN)\r
65\r
f51461c8
LG
66.PHONY: outputdirs\r
67makerootdir:\r
68 -mkdir -p $(MAKEROOT)\r
69\r
70.PHONY: subdirs $(SUBDIRS)\r
71subdirs: $(SUBDIRS)\r
72$(SUBDIRS):\r
73 $(MAKE) -C $@\r
74\r
75.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))\r
76$(patsubst %,%-clean,$(sort $(SUBDIRS))):\r
77 -$(MAKE) -C $(@:-clean=) clean\r
78\r
9e1131b7
LG
79$(VFRAUTOGEN): VfrCompile/VfrSyntax.g \r
80 $(MAKE) -C VfrCompile VfrLexer.h\r
81\r
f51461c8
LG
82clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))\r
83\r
84clean: localClean\r
85\r
86localClean:\r
87 rm -f $(MAKEROOT)/bin/*\r
88 -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin\r
89\r
90include Makefiles/footer.makefile\r