coreinfo: Build libpayload from coreinfo makefile

Build libpayload and install it in the coreinfo directory.
Allows coreinfo to be built with a single make command.

Change-Id: I56982265555aae16e482b0a0040989c1f5317423
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Reviewed-on: http://review.coreboot.org/1995
Tested-by: build bot (Jenkins)
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
Marc Jones 2012-11-30 17:15:36 -07:00 committed by Anton Kochkov
parent 0b97f2978f
commit 9915b37f10
1 changed files with 19 additions and 6 deletions

View File

@ -45,9 +45,12 @@ HOSTCXX ?= g++
HOSTCFLAGS := -I$(srck) -I$(objk)
HOSTCXXFLAGS := -I$(srck) -I$(objk)
LIBPAYLOAD_DIR := ../libpayload/install/libpayload
LPCC := $(LIBPAYLOAD_DIR)/bin/lpgcc
LPAS := $(LIBPAYLOAD_DIR)/bin/lpas
LIBCONFIG_PATH := ../libpayload
LIBPAYLOAD_DIR := ./libpayloadbin
LPCC := $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc
LPAS := $(LIBPAYLOAD_DIR)/libpayload/bin/lpas
HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a)
LIB_CONFIG ?= defconfig
OBJCOPY ?= objcopy
INCLUDES = -I$(obj)
@ -62,18 +65,18 @@ ifneq ($(strip $(HAVE_DOTCONFIG)),)
include $(src)/.config
all: $(TARGET)
$(TARGET): $(src)/.config $(OBJS) prepare
$(TARGET): $(src)/.config $(OBJS) prepare libpayload
$(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LPCC) -o $@ $(OBJS)
$(Q)$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
$(Q)$(OBJCOPY) --strip-debug $@
$(Q)$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
$(obj)/%.S.o: $(src)/%.S
$(obj)/%.S.o: $(src)/%.S libpayload
$(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LPAS) -o $@ $<
$(obj)/%.o: $(src)/%.c
$(obj)/%.o: $(src)/%.c libpayload
$(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LPCC) $(CFLAGS) -c -o $@ $<
@ -81,6 +84,16 @@ else
all: config
endif
ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
libpayload:
$(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
else
libpayload:
$(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
$(Q)make -C $(LIBCONFIG_PATH) distclean
$(Q)make -C $(LIBCONFIG_PATH) $(LIB_CONFIG)
$(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install
endif
prepare:
$(Q)mkdir -p $(obj)/util/kconfig/lxdialog