Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/fix-kbuild
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/fix-kbuild:
  kbuild: fix building with O=.. options
  kbuild: fix building with redirected output.
  • Loading branch information
Linus Torvalds committed Dec 10, 2007
2 parents af1bff4 + 18c32da commit dc3d532
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,20 @@ endif
PHONY := _all
_all:

# Cancel implicit rules on top Makefile
$(CURDIR)/Makefile Makefile: ;

ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables
# check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
$(if $(KBUILD_OUTPUT),, \
$(error output directory "$(saved-output)" does not exist))
# Check that OUTPUT directory is not the same as where we have kernel src
$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
$(error Output directory (O=...) specifies kernel src dir))

PHONY += $(MAKECMDGOALS) sub-make

$(filter-out _all sub-make,$(MAKECMDGOALS)) _all: sub-make
$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
$(Q)@:

sub-make: FORCE
Expand Down Expand Up @@ -291,7 +291,8 @@ export quiet Q KBUILD_VERBOSE
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)

# We need some generic definitions.
# We need some generic definitions (do not try to remake the file).
$(srctree)/scripts/Kbuild.include: ;
include $(srctree)/scripts/Kbuild.include

# Make variables (CC, etc...)
Expand Down Expand Up @@ -1560,9 +1561,6 @@ endif # skip-makefile
PHONY += FORCE
FORCE:

# Cancel implicit rules on top Makefile, `-rR' will apply to sub-makes.
Makefile: ;

# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable se we can use it in if_changed and friends.
.PHONY: $(PHONY)
6 changes: 6 additions & 0 deletions scripts/mkmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@


test ! -r $2/Makefile -o -O $2/Makefile || exit 0
# Only overwrite automatically generated Makefiles
# (so we do not overwrite kernel Makefile)
if ! grep -q Automatically $2/Makefile
then
exit 0
fi
echo " GEN $2/Makefile"

cat << EOF > $2/Makefile
Expand Down

0 comments on commit dc3d532

Please sign in to comment.