treewide: Move device_tree to commonlib
[coreboot2.git] / util / smmstoretool / Makefile
blobd73c25165a12a1cf83406ab99b0d46e3a5b41824
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 PRG := smmstoretool
4 TOP ?= $(abspath ../..)
5 ROOT := $(TOP)/src
6 MDE := $(ROOT)/vendorcode/intel/edk2/UDK2017/MdePkg/Include/
8 CC ?= $(CROSS_COMPILE)gcc
9 HOSTCC ?= $(CC)
10 INSTALL ?= /usr/bin/env install
11 PREFIX ?= /usr/local
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
27 else
28 $(error Unsupported machine: '$(MACHINE)')
29 endif
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
36 OBJ := $(SRC:.c=.o)
37 DEP := $(SRC:.c=.o.d)
39 .PHONY: all debug clean install
41 all: $(PRG)
43 debug: HOSTCFLAGS += -O0 -g
44 debug: HOSTLDFLAGS += -g
45 debug: all
47 install: $(PRG)
48 $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin/
49 $(INSTALL) $^ $(DESTDIR)$(PREFIX)/bin/
51 clean:
52 -$(RM) $(PRG) $(OBJ) $(DEP)
54 $(PRG): $(OBJ)
55 $(HOSTCC) -o $@ $^ $(HOSTLDFLAGS)
57 %.o: %.c
58 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ -MF $@.d $<
60 %.o: $(TOP)/util/cbfstool/flashmap/%.c
61 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ -MF $@.d $<
63 -include $(DEP)