Commit 9e414032 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Tom Rini

kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
  $(obj)u-boot.bin:  $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.
Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: default avatarGerhard Sittig <gsi@denx.de>
parent d9580025
......@@ -674,8 +674,6 @@ build_target() {
output_dir="${OUTPUT_PREFIX}"
fi
export BUILD_DIR="${output_dir}"
target_arch=$(get_target_arch ${target})
eval cross_toolchain=\$CROSS_COMPILE_`echo $target_arch | tr '[:lower:]' '[:upper:]'`
if [ "${cross_toolchain}" ] ; then
......@@ -686,6 +684,10 @@ build_target() {
MAKE=make
fi
if [ "${output_dir}" != "." ] ; then
MAKE="${MAKE} O=${output_dir}"
fi
${MAKE} distclean >/dev/null
${MAKE} -s ${target}_config
......
This diff is collapsed.
......@@ -14,6 +14,6 @@ ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/SPL
endif
else
ALL-y += $(obj)u-boot.imx
ALL-y += u-boot.imx
endif
endif
......@@ -13,6 +13,6 @@ ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/SPL
endif
else
ALL-y += $(obj)u-boot.imx
ALL-y += u-boot.imx
endif
endif
......@@ -4,5 +4,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
ifndef CONFIG_SPL_BUILD
ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.ais
ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.ais
endif
......@@ -7,5 +7,5 @@ ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/MLO
ALL-$(CONFIG_SPL_SPI_SUPPORT) += $(OBJTREE)/MLO.byteswap
else
ALL-y += $(obj)u-boot.img
ALL-y += u-boot.img
endif
......@@ -20,6 +20,6 @@ ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/SPL
endif
else
ALL-y += $(obj)u-boot.imx
ALL-y += u-boot.imx
endif
endif
......@@ -11,5 +11,5 @@
ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/MLO
else
ALL-y += $(obj)u-boot.img
ALL-y += u-boot.img
endif
......@@ -11,5 +11,5 @@
ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/MLO
else
ALL-y += $(obj)u-boot.img
ALL-y += u-boot.img
endif
......@@ -9,5 +9,5 @@
ifdef CONFIG_SPL_BUILD
ALL-y += $(OBJTREE)/MLO
else
ALL-y += $(obj)u-boot.img
ALL-y += u-boot.img
endif
......@@ -4,5 +4,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
ifndef CONFIG_SPL_BUILD
ALL-y += $(obj)u-boot.img
ALL-y += u-boot.img
endif
......@@ -12,7 +12,7 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x1000 -m elf32bfin
ifeq ($(CONFIG_BFIN_CPU),)
CONFIG_BFIN_CPU := \
$(shell awk '$$2 == "CONFIG_BFIN_CPU" { print $$3 }' \
$(src)include/configs/$(BOARD).h)
$(srctree)/include/configs/$(BOARD).h)
else
CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%))
endif
......@@ -28,10 +28,10 @@ PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU)
ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
ALL-y += $(obj)u-boot.ldr
ALL-y += u-boot.ldr
endif
ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y)
CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
CREATE_LDR_ENV = tools/envcrc --binary > env-ldr.o
HOSTCFLAGS_NOPED_ADSP := \
$(shell $(CPP) -dD - -mcpu=$(CONFIG_BFIN_CPU) </dev/null \
| awk '$$2 ~ /ADSP/ { print "-D" $$2 }')
......@@ -47,10 +47,10 @@ LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J
LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE))
LDR_FLAGS += --use-vmas
LDR_FLAGS += --initcode $(obj)$(CPUDIR)/initcode.o
LDR_FLAGS += --initcode $(CPUDIR)/initcode.o
ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART)
LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_IN_LDR) += \
--punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
--punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):env-ldr.o
endif
ifneq (,$(findstring s,$(MAKEFLAGS)))
LDR_FLAGS += --quiet
......
......@@ -25,9 +25,9 @@ extra-y += check_initcode
# make sure our initcode (which goes into LDR) does not
# have relocs or external references
$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
$(obj)/initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
$(obj)check_initcode: $(obj)initcode.o
$(obj)/check_initcode: $(obj)/initcode.o
ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
@if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
echo "$< contains external references!" 1>&2 ; \
......@@ -35,7 +35,7 @@ ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
fi
endif
$(obj)init.lds: init.lds.S
$(obj)/init.lds: $(src)/init.lds.S
$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
$(obj)/init.elf: $(obj)/init.lds $(obj)/init.o $(obj)/initcode.o
$(LD) $(LDFLAGS) -T $^ -o $@
......@@ -21,4 +21,4 @@ else
PLATFORM_LDFLAGS += -m elf32ltsmip
endif
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds
......@@ -21,4 +21,4 @@ else
PLATFORM_LDFLAGS += -m elf64ltsmip
endif
CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T mips64.lds
CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T $(srctree)/$(src)/mips64.lds
......@@ -12,4 +12,4 @@ else
PLATFORM_LDFLAGS += -m elf32ltsmip
endif
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds
......@@ -10,7 +10,7 @@
CROSS_COMPILE ?= nds32le-linux-
CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T nds32.lds
CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T $(srctree)/$(src)/nds32.lds
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax
PLATFORM_RELFLAGS += -gdwarf-2
......
......@@ -54,11 +54,11 @@ ifndef CONFIG_SPL_BUILD
# Workaround for local bus unaligned access problems
# on MPC512x and MPC5200
ifdef CONFIG_MPC512X
$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
$(obj)/ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
obj-y += memcpy_mpc5200.o
endif
ifdef CONFIG_MPC5200
$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
$(obj)/ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
obj-y += memcpy_mpc5200.o
endif
endif
......
......@@ -10,7 +10,7 @@
obj-y := cpu.o os.o start.o state.o
# os.c is build in the system environment, so needs standard includes
$(obj)os.o: CFLAGS := $(filter-out -nostdinc,\
$(obj)/os.o: CFLAGS := $(filter-out -nostdinc,\
$(patsubst -I%,-idirafter%,$(CFLAGS)))
$(obj).depend.os: CPPFLAGS := $(filter-out -nostdinc,\
$(obj)/.depend.os: CPPFLAGS := $(filter-out -nostdinc,\
$(patsubst -I%,-idirafter%,$(CPPFLAGS)))
......@@ -7,6 +7,7 @@
CROSS_COMPILE ?= sparc-elf-
CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) -T sparc.lds
CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
-T $(srctree)/$(src)/sparc.lds
PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
......@@ -23,5 +23,5 @@ obj-$(CONFIG_CMD_ZBOOT) += zimage.o
LIBGCC := $(notdir $(NORMAL_LIBGCC))
extra-y := $(LIBGCC)
$(obj)$(LIBGCC): $(NORMAL_LIBGCC)
$(obj)/$(LIBGCC): $(NORMAL_LIBGCC)
$(OBJCOPY) $< $@ --prefix-symbols=__normal_
......@@ -9,7 +9,7 @@
UBL_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/ublimage.cfg
ifndef CONFIG_SPL_BUILD
ALL-y += $(obj)u-boot.ubl
ALL-y += u-boot.ubl
else
# as SPL_TEXT_BASE is not page-aligned, we need for some
# linkers the -n flag (Do not page align data), to prevent
......
......@@ -9,4 +9,4 @@
obj-y := ../common/tamonten.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -9,4 +9,4 @@
obj-y := ../common/tamonten.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -7,4 +7,4 @@
obj-y := ../common/tamonten-ng.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -9,4 +9,4 @@
obj-y := ../common/tamonten.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -16,4 +16,4 @@
obj-y := paz00.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -7,4 +7,4 @@
obj-y := trimslice.o
include ../../nvidia/common/common.mk
include $(srctree)/board/nvidia/common/common.mk
......@@ -9,8 +9,8 @@ obj-y = L1.o flash.o
obj-y += init.o
obj-y += bootscript.o
$(obj)bootscript.c: $(obj)bootscript.image
od -t x1 -v -A x $^ | awk -f x2c.awk > $@
$(obj)/bootscript.c: $(obj)/bootscript.image
od -t x1 -v -A x $^ | awk -f $(srctree)/$(src)/x2c.awk > $@
$(obj)bootscript.image: $(src)bootscript.hush $(src)Makefile
-$(OBJTREE)/tools/mkimage -A ppc -O linux -T script -C none -a 0 -e 0 -n bootscript -d $(src)bootscript.hush $@
$(obj)/bootscript.image: $(src)/bootscript.hush
-$(OBJTREE)/tools/mkimage -A ppc -O linux -T script -C none -a 0 -e 0 -n bootscript -d $< $@
......@@ -10,5 +10,5 @@ obj-y := h2200.o
extra-y := h2200-header.bin
$(obj)h2200-header.bin: $(obj)h2200-header.o
$(obj)/h2200-header.bin: $(obj)/h2200-header.o
$(OBJCOPY) -O binary $< $@
......@@ -8,5 +8,5 @@ obj-y := mvblm7.o pci.o fpga.o
extra-y := bootscript.img
$(obj)bootscript.img:
@mkimage -T script -C none -n M7_script -d bootscript $@
$(obj)/bootscript.img: $(src)/bootscript
@mkimage -T script -C none -n M7_script -d $< $@
......@@ -12,5 +12,5 @@ obj-y := mvsmr.o fpga.o
extra-y := bootscript.img
$(obj)bootscript.img: bootscript
$(obj)/bootscript.img: $(src)/bootscript
@mkimage -T script -C none -n mvSMR_Script -d $< $@
# Copyright (c) 2011 The Chromium OS Authors.
# SPDX-License-Identifier: GPL-2.0+
include common.mk
include $(src)/common.mk
......@@ -10,7 +10,7 @@
#
# Check the U-Boot Image with a SHA1 checksum
ALL-y += $(obj)u-boot.sha1
ALL-y += u-boot.sha1
PLATFORM_CPPFLAGS += -DCONFIG_440=1
......
......@@ -13,7 +13,7 @@ always := $(hostprogs-y)
#
# TODO:
# Fix the root cause in tools/mkorigenspl.c and delete the following work-around
$(obj)tools/mkorigenspl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
$(obj)/tools/mkorigenspl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
else
obj-y += origen.o
endif
......@@ -238,11 +238,10 @@ obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
obj-y += memsize.o
obj-y += stdio.o
$(obj)env_embedded.o: $(src)env_embedded.c
$(obj)/env_embedded.o: $(src)/env_embedded.c
$(CC) $(AFLAGS) -Wa,--no-warn \
-DENV_CRC=$(shell $(obj)../tools/envcrc) \
-c -o $@ $(src)env_embedded.c
-DENV_CRC=$(shell tools/envcrc) -c -o $@ $<
# SEE README.arm-unaligned-accesses
$(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
$(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
$(obj)/hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
$(obj)/fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
......@@ -6,42 +6,6 @@
#
#########################################################################
ifeq ($(CURDIR),$(SRCTREE))
dir :=
else
dir := $(subst $(SRCTREE)/,,$(CURDIR))
endif
ifneq ($(OBJTREE),$(SRCTREE))
# Create object files for SPL in a separate directory
ifeq ($(CONFIG_SPL_BUILD),y)
ifeq ($(CONFIG_TPL_BUILD),y)
obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
else
obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
endif
else
obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)
endif
src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/)
$(shell mkdir -p $(obj))
else
# Create object files for SPL in a separate directory
ifeq ($(CONFIG_SPL_BUILD),y)
ifeq ($(CONFIG_TPL_BUILD),y)
obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
else
obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
endif
$(shell mkdir -p $(obj))
else
obj :=
endif
src :=
endif
# clean the slate ...
PLATFORM_RELFLAGS =
PLATFORM_CPPFLAGS =
......@@ -52,14 +16,14 @@ PLATFORM_LDFLAGS =
# Load generated board configuration
ifeq ($(CONFIG_TPL_BUILD),y)
# Include TPL autoconf
sinclude $(OBJTREE)/include/tpl-autoconf.mk
sinclude include/tpl-autoconf.mk
else
ifeq ($(CONFIG_SPL_BUILD),y)
# Include SPL autoconf
sinclude $(OBJTREE)/include/spl-autoconf.mk
sinclude include/spl-autoconf.mk
else
# Include normal autoconf
sinclude $(OBJTREE)/include/autoconf.mk
sinclude include/autoconf.mk
endif
endif
sinclude $(OBJTREE)/include/config.mk
......
......@@ -6,8 +6,6 @@
# To add a new book the only step required is to add the book to the
# list of DOCBOOKS.
include $(TOPDIR)/config.mk
DOCBOOKS := fs.xml linker_lists.xml stdio.xml
###
......@@ -122,7 +120,7 @@ quiet_cmd_db2pdf = PDF $@
index = index.html
main_idx = $(index)
main_idx = doc/DocBook/$(index)
build_main_index = rm -rf $(main_idx); \
echo '<h1>U-Boot Bootloader HTML Documentation</h1>' >> $(main_idx) && \
echo '<h2>U-Boot Version: $(U_BOOT_VERSION)</h2>' >> $(main_idx) && \
......@@ -151,7 +149,7 @@ quiet_cmd_db2man = MAN $@
@(which xmlto > /dev/null 2>&1) || \
(echo "*** You need to install xmlto ***"; \
exit 1)
$(Q)mkdir -p $(obj)man
$(Q)mkdir -p $(obj)/man
$(call cmd_db2man)
@touch $@
......
......@@ -8,7 +8,7 @@ obj-y = atibios.o biosemu.o besys.o bios.o \
$(X86DIR)/sys.o \
$(X86DIR)/debug.o
EXTRA_CFLAGS += -I. -I./include \
EXTRA_CFLAGS += -I$(srctree)/$(src) -I$(srctree)/$(src)/include \
-D__PPC__ -D__BIG_ENDIAN__
CFLAGS += $(EXTRA_CFLAGS)
......
......@@ -26,7 +26,7 @@ DTC_FLAGS := -R 4 -p 0x1000 \
# Use a constant name for this so we can access it from C code.
# objcopy doesn't seem to allow us to set the symbol name independently of
# the filename.
DT_BIN := $(obj)dt.dtb
DT_BIN := $(obj)/dt.dtb
$(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
$(CPP) $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
......@@ -38,7 +38,7 @@ process_lds = \
# Run the compiler and get the link script from the linker
GET_LDS = $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--verbose 2>&1
$(obj)dt.o: $(DT_BIN)
$(obj)/dt.o: $(DT_BIN)
# We want the output format and arch.
# We also hope to win a prize for ugliest Makefile / shell interaction
# We look in the LDSCRIPT first.
......@@ -62,7 +62,7 @@ $(obj)dt.o: $(DT_BIN)
\
cd $(dir ${DT_BIN}) && \
$(OBJCOPY) -I binary -O $${oformat} -B $${oarch} \
$(notdir ${DT_BIN}) $@
$(notdir ${DT_BIN}) $(notdir $@)
rm $(DT_BIN)
obj-$(CONFIG_OF_EMBED) := dt.o
......
......@@ -40,23 +40,23 @@ SRCS += $(addprefix $(SRCTREE)/examples/api/,$(COBJ_FILES-y:.o=.c))
SRCS += $(addprefix $(SRCTREE)/examples/api/,$(SOBJ_FILES-y:.o=.S))
# Create a list of object files to be compiled
OBJS += $(addprefix $(obj),$(SOBJ_FILES-y))
OBJS += $(addprefix $(obj),$(COBJ_FILES-y))
OBJS += $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
OBJS += $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
OBJS += $(addprefix $(obj)/,$(SOBJ_FILES-y))
OBJS += $(addprefix $(obj)/,$(COBJ_FILES-y))
OBJS += $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y)))
OBJS += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y)))
#########################################################################
$(obj)demo: $(OBJS)
$(obj)/demo: $(OBJS)
$(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS)
$(obj)demo.bin: $(obj)demo
$(obj)/demo.bin: $(obj)/demo
$(OBJCOPY) -O binary $< $@ 2>/dev/null
# Rule to build generic library C files
$(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c
$(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c
$(CC) -g $(CFLAGS) -c -o $@ $<
# Rule to build architecture-specific library assembly files
$(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
$(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
$(CC) -g $(CFLAGS) -c -o $@ $<
......@@ -31,7 +31,7 @@ clean-files := $(extra-) $(addsuffix .srec,$(extra-)) $(addsuffix .bin,$(extra-
COBJS := $(ELF:=.o)
LIB = $(obj)libstubs.o
LIB = $(obj)/libstubs.o
LIBAOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
LIBAOBJS-$(CONFIG_8xx) += test_burst_lib.o
......@@ -39,11 +39,11 @@ LIBAOBJS := $(LIBAOBJS-y)
LIBCOBJS = stubs.o
LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
LIBOBJS = $(addprefix $(obj)/,$(LIBAOBJS) $(LIBCOBJS))
SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
OBJS := $(addprefix $(obj),$(COBJS))
ELF := $(addprefix $(obj),$(ELF))
OBJS := $(addprefix $(obj)/,$(COBJS))
ELF := $(addprefix $(obj)/,$(ELF))
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
......@@ -67,13 +67,13 @@ $(LIB): $(LIBOBJS)
$(call cmd_link_o_target, $(LIBOBJS))
$(ELF):
$(obj)%: $(obj)%.o $(LIB)
$(obj)/%: $(obj)/%.o $(LIB)
$(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-L$(gcclibdir) -lgcc
$(obj)%.srec: $(obj)%
$(obj)/%.srec: $(obj)/%
$(OBJCOPY) -O srec $< $@ 2>/dev/null
$(obj)%.bin: $(obj)%
$(obj)/%.bin: $(obj)/%
$(OBJCOPY) -O binary $< $@ 2>/dev/null
......@@ -15,4 +15,4 @@ obj-y += tnc.o tnc_misc.o debug.o crc16.o budget.o
obj-y += log.o orphan.o recovery.o replay.o
# SEE README.arm-unaligned-accesses
$(obj)super.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
$(obj)/super.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
......@@ -67,4 +67,4 @@ obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
# SEE README.arm-unaligned-accesses
$(obj)bzlib.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
$(obj)/bzlib.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
......@@ -23,7 +23,7 @@ options=""
if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
# Automatic mode
line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' boards.cfg`
line=`awk '($0 !~ /^#/ && $7 ~ /^'"$2"'$/) { print $1, $2, $3, $4, $5, $6, $7, $8 }' $srctree/boards.cfg`
if [ -z "$line" ] ; then
echo "make: *** No rule to make target \`$2_config'. Stop." >&2
exit 1
......
......@@ -18,8 +18,8 @@ CFLAGS += -DCONFIG_NAND_SPL
SOBJS = start.o resetvec.o cache.o
COBJS = gpio.o nand_boot.o nand_ecc.o memory.o ndfc.o pll.o
SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
__OBJS := $(SOBJS) $(COBJS)
LNDIR := $(nandobj)board/$(BOARDDIR)
......@@ -47,49 +47,41 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)
# create symbolic links for common files
# from cpu directory
$(obj)cache.S:
$(obj)/cache.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $@
$(obj)gpio.c:
$(obj)/gpio.c:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/gpio.c $@
$(obj)ndfc.c:
$(obj)/ndfc.c:
@rm -f $@
ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
$(obj)resetvec.S:
$(obj)/resetvec.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
$(obj)start.S:
$(obj)/start.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
# from board directory
$(obj)memory.c:
$(obj)/memory.c:
@rm -f $@
ln -s $(SRCTREE)/board/amcc/acadia/memory.c $@
$(obj)pll.c:
$(obj)/pll.c:
@rm -f $@
ln -s $(SRCTREE)/board/amcc/acadia/pll.c $@
# from nand_spl directory
$(obj)nand_boot.c:
$(obj)/nand_boot.c:
@rm -f $@
ln -s $(SRCTREE)/nand_spl/nand_boot.c $@
# from drivers/mtd/nand directory
$(obj)nand_ecc.c:
$(obj)/nand_ecc.c:
@rm -f $@
ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@
#########################################################################
$(obj)%.o: $(obj)%.S
$(CC) $(AFLAGS) -c -o $@ $<
$(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $<
......@@ -18,8 +18,8 @@ CFLAGS += -DCONFIG_NAND_SPL
SOBJS = start.o init.o resetvec.o
COBJS = nand_boot.o nand_ecc.o ndfc.o sdram.o
SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
__OBJS := $(SOBJS) $(COBJS)
LNDIR := $(nandobj)board/$(BOARDDIR)
......@@ -41,43 +41,29 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)
# create symbolic links for common files
# from cpu directory
$(obj)ndfc.c:
$(obj)/ndfc.c:
@rm -f $@
ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
$(obj)resetvec.S:
$(obj)/resetvec.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
$(obj)start.S:
$(obj)/start.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
# from board directory
$(obj)init.S:
$(obj)/init.S:
@rm -f $@
ln -s $(SRCTREE)/board/amcc/bamboo/init.S $@
# from nand_spl directory
$(obj)nand_boot.c:
$(obj)/nand_boot.c:
@rm -f $@
ln -s $(SRCTREE)/nand_spl/nand_boot.c $@
# from drivers/mtd/nand directory
$(obj)nand_ecc.c:
$(obj)/nand_ecc.c:
@rm -f $@
ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@
ifneq ($(OBJTREE), $(SRCTREE))
$(obj)sdram.c:
@rm -f $@
ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/sdram.c $@
endif
#########################################################################
$(obj)%.o: $(obj)%.S
$(CC) $(AFLAGS) -c -o $@ $<
$(obj)%.o: $(obj)%.c
$(CC) $(CFLAGS) -c -o $@ $<
......@@ -23,8 +23,8 @@ COBJS += nand_boot.o
COBJS += nand_ecc.o
COBJS += ndfc.o
SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
__OBJS := $(SOBJS) $(COBJS)
LNDIR := $(nandobj)board/$(BOARDDIR)
......@@ -46,43 +46,29 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)
# create symbolic links for common files
# from cpu directory
$(obj)ndfc.c:
$(obj)/ndfc.c:
@rm -f $@
ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
$(obj)resetvec.S:
$(obj)/resetvec.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
$(obj)start.S:
$(obj)/start.S:
@rm -f $@
ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
# from board directory
$(obj)init.S:
$(obj)/init.S:
@rm -f $@
ln -s $(SRCTREE)/board/amcc/canyonlands/init.S $@