]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/GNUmakefile
0dc748267d9e817dc8c2288d13eda781af1de6ea
[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 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
10 #
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #
14
15 ifndef HOST_ARCH
16 #
17 # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
18 # try to figure out the appropriate HOST_ARCH.
19 #
20 uname_m = $(shell uname -m)
21 $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
22 ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
23 HOST_ARCH=X64
24 endif
25 ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
26 HOST_ARCH=IA32
27 endif
28 ifneq (,$(findstring aarch64,$(uname_m)))
29 HOST_ARCH=AARCH64
30 endif
31 ifneq (,$(findstring arm,$(uname_m)))
32 HOST_ARCH=ARM
33 endif
34 ifndef HOST_ARCH
35 $(info Could not detected HOST_ARCH from uname results)
36 $(error HOST_ARCH is not defined!)
37 endif
38 $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
39 endif
40
41 export HOST_ARCH
42
43 MAKEROOT = .
44
45 include Makefiles/header.makefile
46
47 all: makerootdir subdirs
48 @echo Finished building BaseTools C Tools with HOST_ARCH=$(HOST_ARCH)
49
50 LIBRARIES = Common
51 VFRAUTOGEN = VfrCompile/VfrLexer.h
52 # NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage
53 APPLICATIONS = \
54 BrotliCompress \
55 VfrCompile \
56 GnuGenBootSector \
57 BootSectImage \
58 EfiLdrImage \
59 EfiRom \
60 GenFfs \
61 GenFv \
62 GenFw \
63 GenPage \
64 GenSec \
65 GenCrc32 \
66 GenVtf \
67 LzmaCompress \
68 Split \
69 TianoCompress \
70 VolInfo
71
72 SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
73
74 $(LIBRARIES): $(MAKEROOT)/libs
75 $(APPLICATIONS): $(LIBRARIES) $(MAKEROOT)/bin $(VFRAUTOGEN)
76
77 .PHONY: outputdirs
78 makerootdir:
79 -mkdir -p $(MAKEROOT)
80
81 .PHONY: subdirs $(SUBDIRS)
82 subdirs: $(SUBDIRS)
83 $(SUBDIRS):
84 $(MAKE) -C $@
85
86 .PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
87 $(patsubst %,%-clean,$(sort $(SUBDIRS))):
88 -$(MAKE) -C $(@:-clean=) clean
89
90 $(VFRAUTOGEN): VfrCompile/VfrSyntax.g
91 $(MAKE) -C VfrCompile VfrLexer.h
92
93 clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
94
95 clean: localClean
96
97 localClean:
98 rm -f $(MAKEROOT)/bin/*
99 -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
100
101 include Makefiles/footer.makefile