Skip to contentSkip to conversation

KBUILD: Create the source symlink earlier in the objdir

PATCH In review Andi Kleen 2 participants 4 messages Jan 10, 2009 – Feb 15, 2009 Kbuild

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 KBUILD: Create the source symlink earlier in the objdir

KBUILD: Create the source symlink earlier in the objdir

It's useful to already have the source symlink in a objdir when one just runs make *config. Then one can do

mkdir obj-allyes
cd obj-allyes
make -C ../sourcedir O=$(pwd) allyesconfig
./source/scripts/config --disable debug_info
make CC=icecc -j18

without having to interrupt the make first just to get the source symlink.

---
 Makefile |    1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
Index: linux-2.6.28-kbuild/Makefile
===================================================================
@@ -383,6 +383,7 @@
 # output directory.
 outputmakefile:
 ifneq ($(KBUILD_SRC),)
+	@ln -fsn $(srctree) $(objtree)/source
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
 	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
 endif
#1 lore raw
Quoted 27 lines · Andi Kleen

KBUILD: Create the source symlink earlier in the objdir

It's useful to already have the source symlink in a objdir when one just runs make *config. Then one can do

mkdir obj-allyes
cd obj-allyes
make -C ../sourcedir O=$(pwd) allyesconfig
./source/scripts/config --disable debug_info
make CC=icecc -j18

without having to interrupt the make first just to get the source symlink.

---
 Makefile |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.28-kbuild/Makefile
===================================================================

Makefile line 389

Quoted 7 lines
Makefile +1 -0
@@ -383,6 +383,7 @@
 # output directory.
 outputmakefile:
 ifneq ($(KBUILD_SRC),)
+	@ln -fsn $(srctree) $(objtree)/source
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
 	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
 endif

But we do not want to create this symlink in two places. So the following is better:

Sam

Makefile +1 -1
index 22d7584..76ee131 100644
@@ -388,6 +388,7 @@ PHONY += outputmakefile
 # separate output directory. This allows convenient use of make in the
 # output directory.
 outputmakefile:
+	$(Q)ln -fsn $(srctree) source
 ifneq ($(KBUILD_SRC),)
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
 	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
@@ -946,7 +947,6 @@ ifneq ($(KBUILD_SRC),)
 	    mkdir -p include2;                                          \
 	    ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm;     \
 	fi
-	ln -fsn $(srctree) source
 endif
 
 # prepare2 creates a makefile if using a separate output directory
author
#2 lore raw

Makefile PHONY += outputmakefile · line 392

Quoted 10 lines
Makefile +1 -0
index 22d7584..76ee131 100644
@@ -388,6 +388,7 @@ PHONY += outputmakefile
 # separate output directory. This allows convenient use of make in the
 # output directory.
 outputmakefile:
+	$(Q)ln -fsn $(srctree) source
 ifneq ($(KBUILD_SRC),)

Haven't tried it, but
doesn't that create the symlink in the non separate objdir case too because it's outside the ifneq?

Makefile ifneq ($(KBUILD_SRC),) · line 950

Quoted 8 lines
Makefile +0 -1
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
 	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
@@ -946,7 +947,6 @@ ifneq ($(KBUILD_SRC),)
 	    mkdir -p include2;                                          \
 	    ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm;     \
 	fi
-	ln -fsn $(srctree) source
 endif

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#3 lore raw
Quoted 6 lines · Andi Kleen
Quoted 6 lines
Makefile +0 -0
index 22d7584..76ee131 100644
@@ -388,6 +388,7 @@ PHONY += outputmakefile
 # separate output directory. This allows convenient use of make in the
Quoted 8 lines

Makefile PHONY += outputmakefile · line 392

Quoted 4 lines
Makefile +1 -0
 # output directory.
 outputmakefile:
+	$(Q)ln -fsn $(srctree) source
 ifneq ($(KBUILD_SRC),)

Haven't tried it, but
doesn't that create the symlink in the non separate objdir case too because it's outside the ifneq?

Yep - thanks for spotting it!

Sam