Commit 236eb452 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: fixes for separate output directory

- Error out if specified directory does not exist
- Do not build the kernel three times wheh specifying "defconfig all"
- Removed warning when the target all was specified
parent a2343b84
......@@ -37,7 +37,7 @@ ifdef V
endif
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
KBUILD_VERBOSE = 0
endif
# Call sparse as part of compilation of C files
......@@ -79,16 +79,24 @@ ifdef O
endif
endif
# That's our default target when none is given on the command line
.PHONY: all
all:
ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT); /bin/pwd)
# check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(wildcard $(KBUILD_OUTPUT)),, \
$(error output directory "$(saved-output)" does not exist))
.PHONY: $(MAKECMDGOALS) all
.PHONY: $(MAKECMDGOALS)
$(MAKECMDGOALS) all:
$(filter-out all,$(MAKECMDGOALS)) all:
$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
KBUILD_SRC=$(CURDIR) KBUILD_VERBOSE=$(KBUILD_VERBOSE) \
KBUILD_CHECK=$(KBUILD_CHECK) -f $(CURDIR)/Makefile $(MAKECMDGOALS)
KBUILD_CHECK=$(KBUILD_CHECK) -f $(CURDIR)/Makefile $@
# Leave processing to above invocation of make
skip-makefile := 1
......@@ -156,13 +164,6 @@ HOSTCXX = g++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
# That's our default target when none is given on the command line
# Note that 'modules' will be added as a prerequisite as well,
# in the CONFIG_MODULES part below
all: vmlinux
# Decide whether to build built-in, modular, or both.
# Normally, just do built-in.
......@@ -366,6 +367,12 @@ else
# Build targets only - this includes vmlinux, arch specific targets, clean
# targets and others. In general all targets except *config targets.
# That's our default target when none is given on the command line
# Note that 'modules' will be added as a prerequisite as well,
# in the CONFIG_MODULES part below
all: vmlinux
# Objects we will link into vmlinux / subdirs we need to visit
init-y := init/
drivers-y := drivers/ sound/
......@@ -877,7 +884,7 @@ help:
@echo ' mrproper - remove all generated files + config + various backup files'
@echo ''
@echo 'Configuration targets:'
@$(MAKE) -f scripts/kconfig/Makefile help
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
@echo ''
@echo 'Other generic targets:'
@echo ' all - Build all targets marked with [*]'
......@@ -890,7 +897,7 @@ help:
@echo ' tags/TAGS - Generate tags file for editors'
@echo ''
@echo 'Documentation targets:'
@$(MAKE) -f Documentation/DocBook/Makefile dochelp
@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
@echo ''
@echo 'Architecture specific targets ($(ARCH)):'
@$(if $(archhelp),$(archhelp),\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment