mb/google/brya/var/omnigul: Modify NVMe and UFS Storage support
[coreboot.git] / payloads / libpayload / sample / arch_mock / Makefile
bloba1e748111e1bab6bde3da15d6bb82005367bbfdd
1 # SPDX-License-Identifier: GPL-2.0-only
3 # Sample libpayload Makefile for ARCH_MOCK
4 # ARCH_MOCK is not intended to be used with xcompile
5 include ../../.config
7 ifneq ($(CONFIG_LP_ARCH_MOCK),y)
8 $(error This example supports ARCH_MOCK only.)
9 endif
11 CC := gcc
12 AS := as
13 OBJCOPY := objcopy
14 LIBPAYLOAD_DIR := ../../install/libpayload
15 CFLAGS := -fno-builtin -Wall -Werror -Os \
16 -include $(LIBPAYLOAD_DIR)/include/kconfig.h \
17 -include $(LIBPAYLOAD_DIR)/include/compiler.h \
18 -I $(LIBPAYLOAD_DIR)/include \
19 -I $(LIBPAYLOAD_DIR)/include/mock \
20 -ffunction-sections \
21 -fdata-sections -g3
22 LDFLAGS := -Wl,--gc-sections
23 TARGET := hello
24 OBJS := $(TARGET).o
25 OBJS-mock := $(TARGET)_mocks.o
26 LIBPAYLOAD-local := libpayload.a
27 mocks := console_write
29 all: $(TARGET).elf
31 $(TARGET).elf: $(OBJS) $(OBJS-mock) $(LIBPAYLOAD-local)
32 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBPAYLOAD-local) \
33 -Wl,--exclude-libs,ALL -lc $(OBJS-mock)
35 %.o: %.c
36 $(CC) $(CFLAGS) -c -o $@ $<
38 %.S.o: %.S
39 $(AS) --32 -o $@ $<
41 # Copy libpayload and weaken all mocked symbols
42 $(LIBPAYLOAD-local): $(LIBPAYLOAD_DIR)/lib/libpayload.a
43 $(OBJCOPY) $(foreach mock,$(mocks),--weaken-symbol=$(mock)) $< $@
45 clean:
46 rm -f $(TARGET).elf *.o $(LIBPAYLOAD-local)
48 distclean: clean