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