1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00
bztsrc--bootboot/x86_64-cb/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

2020-09-13 16:53:30 -04:00
TARGET=../dist/bootbootcb.elf
# get build environment
ifndef LIBCONFIG_PATH
LIBCONFIG_PATH := ../../coreboot/payloads/libpayload
ifeq ($(wildcard $(LIBCONFIG_PATH)/*),)
LIBCONFIG_PATH := ../../../../libpayload
endif
endif
LIBPAYLOAD_DIR=$(CURDIR)/libpayload
XCOMPILE=$(LIBPAYLOAD_DIR)/libpayload.xcompile
# build libpayload and put .config file in $(CURDIR) instead of ../libpayload
# to avoid pollute the libpayload source directory and possible conflicts
LPOPTS=obj="$(CURDIR)/build" DESTDIR="$(CURDIR)" DOTCONFIG="$(CURDIR)/.config"
2021-01-28 00:49:25 -05:00
CFLAGS += -Wall -Wextra -Wvla -Werror -Os -ffreestanding -nostdinc -nostdlib
2020-09-13 16:53:30 -04:00
all: $(TARGET)
$(LIBPAYLOAD_DIR):
2020-09-14 16:38:23 -04:00
echo $(LIBCONFIG_PATH)
ls $(LIBCONFIG_PATH)
@cp lib.config $(LIBCONFIG_PATH)/.config
$(MAKE) -C $(LIBCONFIG_PATH) $(LPOPTS) oldconfig
2020-09-13 16:53:30 -04:00
$(MAKE) -C $(LIBCONFIG_PATH) $(LPOPTS)
$(MAKE) -C $(LIBCONFIG_PATH) $(LPOPTS) install
ifneq ($(strip $(wildcard libpayload)),)
include $(XCOMPILE)
LPGCC = CC="$(GCC_CC_x86_32)" "$(LIBPAYLOAD_DIR)/bin/lpgcc"
$(TARGET):
2020-09-16 22:41:14 -04:00
$(LPGCC) $(CFLAGS) -o $(TARGET) bootboot.c tinflate.c smp.S
2020-09-13 16:53:30 -04:00
else
# If libpayload is not found, first build libpayload,
# then do the make, this time it'll find libpayload
# and generate the elf target
$(TARGET): $(LIBPAYLOAD_DIR)
$(MAKE) all
endif
clean:
rm -f $(TARGET)
distclean: clean
rm -rf build libpayload .config .config.old
.PHONY: all clean distclean