1 # SPDX-License-Identifier: GPL-2.0-or-later
4 TOP ?
= $(abspath ..
/..
)
6 MDE
:= $(ROOT
)/vendorcode
/intel
/edk2
/UDK2017
/MdePkg
/Include
/
8 CC ?
= $(CROSS_COMPILE
)gcc
10 INSTALL ?
= /usr
/bin
/env
install
13 HOSTCFLAGS ?
= $(CFLAGS
)
14 HOSTCFLAGS
+= -Wall
-Wextra
-MMD
-MP
-O3
15 HOSTCFLAGS
+= -I
$(ROOT
)/commonlib
/bsd
/include
16 HOSTCFLAGS
+= -I
$(ROOT
)/vendorcode
/intel
/edk2
/
17 HOSTCFLAGS
+= -I
$(TOP
)/util
/cbfstool
/flashmap
/
18 HOSTCFLAGS
+= -I
$(MDE
)
20 HOSTLDFLAGS ?
= $(LDFLAGS
)
22 MACHINE
:= $(shell uname
-m
)
23 ifeq ($(MACHINE
),x86_64
)
24 HOSTCFLAGS
+= -I
$(MDE
)/X64
25 else ifeq ($(patsubst i
%86,Ia32
,$(MACHINE
)),Ia32
)
26 HOSTCFLAGS
+= -I
$(MDE
)/Ia32
28 $(error Unsupported machine
: '$(MACHINE)')
31 # there files are in this directory
32 SRC
:= data.c fv.c guids.c main.c storage.c utils.c vs.c
33 # and these are in $(TOP)/util/cbfstool/flashmap/
34 SRC
+= fmap.c kv_pair.c valstr.c
39 .PHONY
: all debug
clean install
43 debug
: HOSTCFLAGS
+= -O0
-g
44 debug
: HOSTLDFLAGS
+= -g
48 $(INSTALL
) -d
$(DESTDIR
)$(PREFIX
)/bin
/
49 $(INSTALL
) $^
$(DESTDIR
)$(PREFIX
)/bin
/
52 -$(RM
) $(PRG
) $(OBJ
) $(DEP
)
55 $(HOSTCC
) -o
$@
$^
$(HOSTLDFLAGS
)
58 $(HOSTCC
) $(HOSTCFLAGS
) -c
-o
$@
-MF
$@.d
$<
60 %.o
: $(TOP
)/util
/cbfstool
/flashmap
/%.c
61 $(HOSTCC
) $(HOSTCFLAGS
) -c
-o
$@
-MF
$@.d
$<