blob: 78b77caa2dc281e692a4e2153136aeef2b23c9c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# SPDX-License-Identifier: GPL-2.0-or-later
PRG := smmstoretool
TOP ?= $(abspath ../..)
ROOT := $(TOP)/src
MDE := $(ROOT)/vendorcode/intel/edk2/UDK2017/MdePkg/Include/
CC ?= $(CROSS_COMPILE)gcc
HOSTCC ?= $(CC)
INSTALL ?= /usr/bin/env install
PREFIX ?= /usr/local
HOSTCFLAGS ?= $(CFLAGS)
HOSTCFLAGS += -Wall -Wextra -MMD -MP -O3
HOSTCFLAGS += -I $(ROOT)/commonlib/bsd/include
HOSTCFLAGS += -I $(ROOT)/vendorcode/intel/edk2/
HOSTCFLAGS += -I $(MDE)
HOSTLDFLAGS ?= $(LDFLAGS)
MACHINE := $(shell uname -m)
ifeq ($(MACHINE),x86_64)
HOSTCFLAGS += -I $(MDE)/X64
else ifeq ($(patsubst i%86,Ia32,$(MACHINE)),Ia32)
HOSTCFLAGS += -I $(MDE)/Ia32
else
$(error Unsupported machine: '$(MACHINE)')
endif
SRC := data.c fv.c guids.c main.c storage.c utils.c vs.c
OBJ := $(SRC:.c=.o)
DEP := $(SRC:.c=.o.d)
.PHONY: all debug clean install
all: $(PRG)
debug: HOSTCFLAGS += -O0 -g
debug: HOSTLDFLAGS += -g
debug: all
install: $(PRG)
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin/
$(INSTALL) $^ $(DESTDIR)$(PREFIX)/bin/
clean:
-$(RM) $(PRG) $(OBJ) $(DEP)
$(PRG): $(OBJ)
$(HOSTCC) -o $@ $^ $(HOSTLDFLAGS)
%.o: %.c
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ -MF $@.d $<
-include $(DEP)
|