[coreboot-gerrit] Patch set updated for coreboot: coreinfo: Update Makefile to build from coreboot

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Tue Mar 8 13:55:00 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13938

-gerrit

commit 385ab19bf3836fd490ec24de5a7c5c1f576a1eef
Author: Martin Roth <martinroth at google.com>
Date:   Mon Mar 7 16:26:51 2016 -0700

    coreinfo: Update Makefile to build from coreboot
    
    - Rename obj to coreinfo_obj so it doesn't conflict with the obj
    variable in libpayload.
    - Change $(shell pwd) to $(CURDIR) to find the directory without going
    to the shell
    - Fix libpayloaddir so it doesn't get installed to libpayload/libpayload
    - Make all relative paths absolute by prepending $(src)
    - Remove .xcompile when doing a clean
    
    Change-Id: I2ffb06a87e30a5eeff5b0dfc0ba62b5e9ab46e26
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 payloads/coreinfo/Makefile | 50 +++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile
index c9f5c10..750402b 100644
--- a/payloads/coreinfo/Makefile
+++ b/payloads/coreinfo/Makefile
@@ -14,18 +14,18 @@
 ## GNU General Public License for more details.
 ##
 
-src := $(shell pwd)
+src := $(CURDIR)
 srctree := $(src)
 srck := $(src)/../../util/kconfig
-obj := $(src)/build
+coreinfo_obj := $(src)/build
 objk := $(src)/build/util/kconfig
 
 export KERNELVERSION      := 0.1.0
-export KCONFIG_AUTOHEADER := $(obj)/config.h
-export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
-export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
-export KCONFIG_SPLITCONFIG := $(obj)/config
-export KCONFIG_TRISTATE := $(obj)/tristate.conf
+export KCONFIG_AUTOHEADER := $(coreinfo_obj)/config.h
+export KCONFIG_AUTOCONFIG := $(coreinfo_obj)/auto.conf
+export KCONFIG_DEPENDENCIES := $(coreinfo_obj)/auto.conf.cmd
+export KCONFIG_SPLITCONFIG := $(coreinfo_obj)/config
+export KCONFIG_TRISTATE := $(coreinfo_obj)/tristate.conf
 export KCONFIG_NEGATIVES := 1
 export Kconfig := Kconfig
 
@@ -47,25 +47,25 @@ HOSTCXX ?= g++
 HOSTCFLAGS := -I$(srck) -I$(objk)
 HOSTCXXFLAGS := -I$(srck) -I$(objk)
 
-LIBCONFIG_PATH := ../libpayload
-LIBPAYLOAD_DIR := build/libpayload
-HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a)
+LIBCONFIG_PATH := $(src)/../libpayload
+LIBPAYLOAD_DIR := $(coreinfo_obj)/libpayload
+HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/lib/libpayload.a)
 LIB_CONFIG ?= defconfig
 OBJCOPY ?= objcopy
 
-INCLUDES = -I$(obj) -include $(LIBPAYLOAD_DIR)/libpayload/include/kconfig.h
+INCLUDES = -I$(coreinfo_obj) -include $(LIBPAYLOAD_DIR)/include/kconfig.h
 OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
 	  nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \
 	  multiboot_module.o cbfs_module.o coreinfo.o
-OBJS    = $(patsubst %,$(obj)/%,$(OBJECTS))
-TARGET  = $(obj)/coreinfo.elf
+OBJS    = $(patsubst %,$(coreinfo_obj)/%,$(OBJECTS))
+TARGET  = $(coreinfo_obj)/coreinfo.elf
 
 all: real-all
 
 # in addition to the dependency below, create the file if it doesn't exist
 # to silence warnings about a file that would be generated anyway.
-$(if $(wildcard .xcompile),,$(eval $(shell ../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
-.xcompile: ../../util/xcompile/xcompile
+$(if $(wildcard .xcompile),,$(eval $(shell $(src)/../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
+.xcompile: $(src)/../../util/xcompile/xcompile
 	$< $(XGCCPATH) > $@.tmp
 	\mv -f $@.tmp $@ 2> /dev/null || rm -f $@.tmp $@
 
@@ -78,8 +78,8 @@ CC := $(CC_$(ARCH-y))
 AS := $(AS_$(ARCH-y))
 OBJCOPY := $(OBJCOPY_$(ARCH-y))
 
-LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc
-LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/libpayload/bin/lpas
+LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/bin/lpgcc
+LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/bin/lpas
 
 CFLAGS += -Wall -Werror -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
 
@@ -87,18 +87,18 @@ ifneq ($(strip $(HAVE_DOTCONFIG)),)
 include $(src)/.config
 real-all: $(TARGET)
 
-$(TARGET): $(src)/.config $(obj)/config.h $(OBJS) libpayload
+$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
 	printf "    LPCC       $(subst $(shell pwd)/,,$(@)) (LINK)\n"
 	$(LPCC) -o $@ $(OBJS)
 	$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
 	$(OBJCOPY) --strip-debug $@
 	$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
 
-$(obj)/%.S.o: $(src)/%.S libpayload
+$(coreinfo_obj)/%.S.o: $(src)/%.S libpayload
 	printf "    LPAS       $(subst $(shell pwd)/,,$(@))\n"
 	$(LPAS) -o $@ $<
 
-$(obj)/%.o: $(src)/%.c libpayload
+$(coreinfo_obj)/%.o: $(src)/%.c libpayload
 	printf "    LPCC       $(subst $(shell pwd)/,,$(@))\n"
 	$(LPCC) $(CFLAGS) -c -o $@ $<
 
@@ -116,18 +116,18 @@ libpayload:
 else
 libpayload:
 	printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
-	$(MAKE) -C $(LIBCONFIG_PATH) distclean
+	$(MAKE) -C $(LIBCONFIG_PATH) distclean coreinfo_obj=$(coreinfo_obj)/libptmp
 	$(MAKE) -C $(LIBCONFIG_PATH) $(LIB_CONFIG)
-	$(MAKE) -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install
+	$(MAKE) -C $(LIBCONFIG_PATH) install DESTDIR=$(coreinfo_obj)
 endif
 
-$(obj)/config.h:
+$(coreinfo_obj)/config.h:
 	$(MAKE) oldconfig
 
-$(shell mkdir -p $(obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
+$(shell mkdir -p $(coreinfo_obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
 
 clean:
-	rm -rf build/*.elf build/*.o
+	rm -rf build/*.elf build/*.o .xcompile
 
 distclean: clean
 	rm -rf build



More information about the coreboot-gerrit mailing list