2008-01-01 07:13:12

by Cong Wang

[permalink] [raw]
Subject: [Patch 0/8] Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use srctree or objtree instead.

This patch set removes all the TOPDIR use in the whole
source tree and finally drops it in the top Makefile.
They're against the current linus-tree.

Note that Patch [8/8] should be applied _after_ all the
previous patches are applied.

Regards.

Cc: Sam Ravnborg <[email protected]>
Cc: Andrew Morton <[email protected]>


2008-01-01 07:18:47

by Cong Wang

[permalink] [raw]
Subject: [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all UML Makefiles.

Cc: Jeff Dike <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/um/Makefile b/arch/um/Makefile
index ba6813a..57491af 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -158,7 +158,7 @@ ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/include/asm-um
$(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@
else
- $(Q)cd $(TOPDIR)/$(dir $@) ; \
+ $(Q)cd $(objtree)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
endif

@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/include/asm-um
$(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
else
- $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
+ $(Q)cd $(objtree)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
endif

$(objtree)/$(ARCH_DIR)/include:
diff --git a/arch/um/sys-ppc/Makefile b/arch/um/sys-ppc/Makefile
index a9814a7..a3cfae7 100644
--- a/arch/um/sys-ppc/Makefile
+++ b/arch/um/sys-ppc/Makefile
@@ -6,7 +6,7 @@ OBJ = built-in.o
OBJS = ptrace.o sigcontext.o semaphore.o checksum.o miscthings.o misc.o \
ptrace_user.o sysrq.o

-EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(TOPDIR)/arch/ppc/kernel
+EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(objtree)/arch/ppc/kernel

all: $(OBJ)

@@ -22,25 +22,25 @@ sigcontext.o: sigcontext.c

semaphore.c:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(objtree)/arch/ppc/kernel/$@ $@

checksum.S:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/lib/$@ $@
+ ln -s $(objtree)/arch/ppc/lib/$@ $@

mk_defs.c:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(objtree)/arch/ppc/kernel/$@ $@

ppc_defs.head:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(objtree)/arch/ppc/kernel/$@ $@

ppc_defs.h: mk_defs.c ppc_defs.head \
- $(TOPDIR)/include/asm-ppc/mmu.h \
- $(TOPDIR)/include/asm-ppc/processor.h \
- $(TOPDIR)/include/asm-ppc/pgtable.h \
- $(TOPDIR)/include/asm-ppc/ptrace.h
+ $(objtree)/include/asm-ppc/mmu.h \
+ $(objtree)/include/asm-ppc/processor.h \
+ $(objtree)/include/asm-ppc/pgtable.h \
+ $(objtree)/include/asm-ppc/ptrace.h
# $(CC) $(CFLAGS) -S mk_defs.c
cp ppc_defs.head ppc_defs.h
# for bk, this way we can write to the file even if it's not checked out
@@ -56,13 +56,13 @@ ppc_defs.h: mk_defs.c ppc_defs.head \

checksum.o: checksum.S
rm -f asm
- ln -s $(TOPDIR)/include/asm-ppc asm
+ ln -s $(objtree)/include/asm-ppc asm
$(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
rm -f asm

misc.o: misc.S ppc_defs.h
rm -f asm
- ln -s $(TOPDIR)/include/asm-ppc asm
+ ln -s $(objtree)/include/asm-ppc asm
$(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
rm -f asm

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32

2008-01-01 07:22:33

by Cong Wang

[permalink] [raw]
Subject: [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all Mips Makefiles.

Cc: Ralf Baechle <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449..5196962 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,7 +12,7 @@ endif

MKLASATIMG = mklasatimg
MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
-KERNEL_IMAGE = $(TOPDIR)/vmlinux
+KERNEL_IMAGE = $(objtree)/vmlinux
KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )

@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
-D TIMESTAMP=$(shell date +%s)

$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
- $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
+ $(CC) -fno-pic $(HEAD_DEFINES) -I$(objtree)/include -c -o $@ $<

OBJECTS = head.o kImage.o

2008-01-01 07:25:51

by Cong Wang

[permalink] [raw]
Subject: [Patch 3/8] S390: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all s390 Makefiles.

Cc: Martin Schwidefsky <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 56cb710..a753a71 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -34,4 +34,4 @@ obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
#
# This is just to get the dependencies...
#
-binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
+binfmt_elf32.o: $(objtree)/fs/binfmt_elf.c

2008-01-01 07:29:18

by Cong Wang

[permalink] [raw]
Subject: [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all Cris Makefiles.

Cc: Mikael Starvik <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 9f77eda..8586922 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -7,7 +7,7 @@
target = $(target_compressed_dir)
src = $(src_compressed_dir)

-CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
+CC = gcc-cris -mlinux -march=v32 -I $(objtree)/include
CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris

2008-01-01 07:33:29

by Cong Wang

[permalink] [raw]
Subject: [Patch 5/8] INFINIBAND: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all infiniband Makefiles.

Cc: Sam Ravnborg <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/drivers/infiniband/hw/cxgb3/Makefile b/drivers/infiniband/hw/cxgb3/Makefile
index 36b9898..b82286a 100644
--- a/drivers/infiniband/hw/cxgb3/Makefile
+++ b/drivers/infiniband/hw/cxgb3/Makefile
@@ -1,5 +1,5 @@
-EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
- -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
+EXTRA_CFLAGS += -I$(objtree)/drivers/net/cxgb3 \
+ -I$(objtree)/drivers/infiniband/hw/cxgb3/core

obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o

2008-01-01 07:36:40

by Cong Wang

[permalink] [raw]
Subject: [Patch 6/8] FRV: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all frv Makefiles.

Cc: David Howells <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
index dc6f038..d93f768 100644
--- a/arch/frv/boot/Makefile
+++ b/arch/frv/boot/Makefile
@@ -10,7 +10,7 @@

targets := Image zImage bootpImage

-SYSTEM =$(TOPDIR)/$(LINUX)
+SYSTEM =$(objtree)/$(LINUX)

ZTEXTADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@

-compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
+compressed/$(LINUX): $(objtree)/$(LINUX) dep
@$(MAKE) -C compressed $(LINUX)

bootp/bootp: zImage initrd
@@ -59,10 +59,10 @@ initrd:
# installation
#
install: $(CONFIGURE) Image
- sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) Image $(objtree)/System.map "$(INSTALL_PATH)"

zinstall: $(CONFIGURE) zImage
- sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) zImage $(objtree)/System.map "$(INSTALL_PATH)"

#
# miscellany

2008-01-01 07:41:00

by Cong Wang

[permalink] [raw]
Subject: [Patch 7/8] FS: Remove 'TOPDIR' from Makefiles


TOPDIR is obsolete, use objtree instead.
This patch removes TOPDIR from all fs/ Makefiles.

Cc: Alexander Viro <[email protected]>
Cc: Tim Shimmin <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 6673ee8..9b5e92b 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -34,5 +34,5 @@ proto:
@echo >> proto2.h "struct sock;"
@echo >> proto2.h "struct statfs;"
@echo >> proto2.h ""
- cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
+ cproto -E "gcc -E" -e -v -I $(objtree)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
mv proto2.h proto.h
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 49e3e7e..d1d3d49 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -1 +1 @@
-include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
+include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)

2008-01-01 07:43:49

by Cong Wang

[permalink] [raw]
Subject: [Patch 8/8] Remove 'TOPDIR' from the Top Makefile


TOPDIR is obsolete, thus can be removed.
This patch removes TOPDIR from the top Makefile.

Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/Makefile b/Makefile
index fbb8dfc..c892d14 100644
--- a/Makefile
+++ b/Makefile
@@ -148,15 +148,13 @@ _all: modules
endif

srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
-TOPDIR := $(srctree)
-# FIXME - TOPDIR is obsolete, use srctree/objtree
objtree := $(CURDIR)
src := $(srctree)
obj := $(objtree)

VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))

-export srctree objtree VPATH TOPDIR
+export srctree objtree VPATH


# SUBARCH tells the usermode build what the underlying arch is. That is set

2008-01-01 10:09:41

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 0/8] Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:13:11PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use srctree or objtree instead.

Glad to see this being done - long overdue.

Most of your patches (if not all) replaces TOPDIR
with objtree but usage of objtree is only
correct when dealing with output files.
Note that objtree != srctree only for O=... builds.

And a few cases should be dealt with differently.
See individual comments.

Sam

2008-01-01 10:15:50

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:22:38PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all Mips Makefiles.
>
> Cc: Ralf Baechle <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
> index 5332449..5196962 100644
> --- a/arch/mips/lasat/image/Makefile
> +++ b/arch/mips/lasat/image/Makefile
> @@ -12,7 +12,7 @@ endif
>
> MKLASATIMG = mklasatimg
> MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
> -KERNEL_IMAGE = $(TOPDIR)/vmlinux
> +KERNEL_IMAGE = $(objtree)/vmlinux

Current directory when building is $(objtree) so here we should
just skip the use of TOPDIR like this:
> +KERNEL_IMAGE = vmlinux


> KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
> KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
>
> @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
> -D TIMESTAMP=$(shell date +%s)
>
> $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
> - $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
> + $(CC) -fno-pic $(HEAD_DEFINES) -I$(objtree)/include -c -o $@ $<
This has never worked with O=.. builds.
The correct fix here is to use:
> + $(CC) -fno-pic $(HEAD_DEFINES) -Iinclude -Iinclude2 -c -o $@ $<

The -Iinclude2 is only for O=... builds so to keep current
behaviour removing $(TOPDIR)/ would do it.

Sam

2008-01-01 10:17:28

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 3/8] S390: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:25:55PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all s390 Makefiles.
>
> Cc: Martin Schwidefsky <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
> index 56cb710..a753a71 100644
> --- a/arch/s390/kernel/Makefile
> +++ b/arch/s390/kernel/Makefile
> @@ -34,4 +34,4 @@ obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
> #
> # This is just to get the dependencies...
> #
> -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
> +binfmt_elf32.o: $(objtree)/fs/binfmt_elf.c

This prerequisite listing looks just bogus and should be removed altogether.
We only need to list prerequisites explicit for generated files.

Sam

2008-01-01 10:20:23

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:29:22PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all Cris Makefiles.
>
> Cc: Mikael Starvik <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
> index 9f77eda..8586922 100644
> --- a/arch/cris/arch-v32/boot/compressed/Makefile
> +++ b/arch/cris/arch-v32/boot/compressed/Makefile
> @@ -7,7 +7,7 @@
> target = $(target_compressed_dir)
> src = $(src_compressed_dir)
>
> -CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
> +CC = gcc-cris -mlinux -march=v32 -I $(objtree)/include

As in the mips case the right fix is to use:
> +CC = gcc-cris -mlinux -march=v32 -Iinclude -Iinclude2

In this way we pick up the includes also in the O=..
case.

PS. Mikael - should Jesper be mentioned in MAINTAINERS?

Sam

2008-01-01 10:26:46

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 5/8] INFINIBAND: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:33:31PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all infiniband Makefiles.
>
> Cc: Sam Ravnborg <[email protected]>
> Cc: Roland Dreier <[email protected]>
> Cc: Sean Hefty <[email protected]>
> Cc: Hal Rosenstock <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/drivers/infiniband/hw/cxgb3/Makefile b/drivers/infiniband/hw/cxgb3/Makefile
> index 36b9898..b82286a 100644
> --- a/drivers/infiniband/hw/cxgb3/Makefile
> +++ b/drivers/infiniband/hw/cxgb3/Makefile
> @@ -1,5 +1,5 @@
> -EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
> - -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core

> +EXTRA_CFLAGS += -I$(objtree)/drivers/net/cxgb3 \
Drop $(TOPDIR) like this:
> +EXTRA_CFLAGS += -Idrivers/net/cxgb3 \

> + -I$(objtree)/drivers/infiniband/hw/cxgb3/core
And this line can be deleted - there is no such directory.
At least not in my tree.

Sam

2008-01-01 10:28:12

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 6/8] FRV: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:36:45PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all frv Makefiles.
>
> Cc: David Howells <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
> index dc6f038..d93f768 100644
> --- a/arch/frv/boot/Makefile
> +++ b/arch/frv/boot/Makefile
> @@ -10,7 +10,7 @@
>
> targets := Image zImage bootpImage
>
> -SYSTEM =$(TOPDIR)/$(LINUX)
> +SYSTEM =$(objtree)/$(LINUX)
>
> ZTEXTADDR = 0x02080000
> PARAMS_PHYS = 0x0207c000
> @@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
> bootpImage: bootp/bootp
> $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
>
> -compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
> +compressed/$(LINUX): $(objtree)/$(LINUX) dep
> @$(MAKE) -C compressed $(LINUX)
>
> bootp/bootp: zImage initrd
> @@ -59,10 +59,10 @@ initrd:
> # installation
> #
> install: $(CONFIGURE) Image
> - sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
> + sh ./install.sh $(KERNELRELEASE) Image $(objtree)/System.map "$(INSTALL_PATH)"
>
> zinstall: $(CONFIGURE) zImage
> - sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
> + sh ./install.sh $(KERNELRELEASE) zImage $(objtree)/System.map "$(INSTALL_PATH)"

In this file we can just drop use of $(TOPDIR) since this is our
current directory anyway.

Sam

2008-01-01 10:30:33

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 7/8] FS: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:41:05PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all fs/ Makefiles.
>
> Cc: Alexander Viro <[email protected]>
> Cc: Tim Shimmin <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
> index 6673ee8..9b5e92b 100644
> --- a/fs/smbfs/Makefile
> +++ b/fs/smbfs/Makefile
> @@ -34,5 +34,5 @@ proto:
> @echo >> proto2.h "struct sock;"
> @echo >> proto2.h "struct statfs;"
> @echo >> proto2.h ""
> - cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
> + cproto -E "gcc -E" -e -v -I $(objtree)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
> mv proto2.h proto.h
> diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
> index 49e3e7e..d1d3d49 100644
> --- a/fs/xfs/Makefile
> +++ b/fs/xfs/Makefile
> @@ -1 +1 @@
> -include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
> +include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)

The whole "Maintainer rules" part of this file should be deleted.
I cannot see how it can be used anyway.

Sam

2008-01-01 10:33:51

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:18:46PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all UML Makefiles.
>

I do not feel confident with these changes.
In some places I had expected to see srctree and not objtree.
I would like to see this tested before applying it.

Building a ppc toolchain now to test it...

Sam

2008-01-01 10:49:50

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 11:33:42AM +0100, Sam Ravnborg wrote:
> On Tue, Jan 01, 2008 at 03:18:46PM +0800, WANG Cong wrote:
> >
> > TOPDIR is obsolete, use objtree instead.
> > This patch removes TOPDIR from all UML Makefiles.
> >
>
> I do not feel confident with these changes.
> In some places I had expected to see srctree and not objtree.
> I would like to see this tested before applying it.
>
> Building a ppc toolchain now to test it...

It seems that building a ppc based um kernel is not supported
in mainline.
Kconfig.ppc is missing and when creating it um build fails
in sys-ppc/ due to user-offset.c is missing.

As most of your patch touches ppc specific code I suggest
to just replace TOPDIR with srctree all over (no semantic change)
and the the um people can figure out the ppc stuff when they get to it.

Sam

2008-01-01 13:01:22

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 11:49:42AM +0100, Sam Ravnborg wrote:
>On Tue, Jan 01, 2008 at 11:33:42AM +0100, Sam Ravnborg wrote:
>> On Tue, Jan 01, 2008 at 03:18:46PM +0800, WANG Cong wrote:
>> >
>> > TOPDIR is obsolete, use objtree instead.
>> > This patch removes TOPDIR from all UML Makefiles.
>> >
>>
>> I do not feel confident with these changes.
>> In some places I had expected to see srctree and not objtree.
>> I would like to see this tested before applying it.
>>
>> Building a ppc toolchain now to test it...
>
>It seems that building a ppc based um kernel is not supported
>in mainline.
>Kconfig.ppc is missing and when creating it um build fails
>in sys-ppc/ due to user-offset.c is missing.
>
>As most of your patch touches ppc specific code I suggest
>to just replace TOPDIR with srctree all over (no semantic change)
>and the the um people can figure out the ppc stuff when they get to it.

You're right. I use srctree instead. And tested with:

$ make O=../foobar/ ARCH=um linux

It works fine. Thanks for your points!

-------->

TOPDIR is obsolete, use srctree instead.
This patch removes TOPDIR from all UML Makefiles.

Cc: Jeff Dike <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/um/Makefile b/arch/um/Makefile
index ba6813a..08a2865 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -158,7 +158,7 @@ ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/include/asm-um
$(Q)ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@
else
- $(Q)cd $(TOPDIR)/$(dir $@) ; \
+ $(Q)cd $(srctree)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
endif

@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/include/asm-um
$(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
else
- $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
+ $(Q)cd $(srctree)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
endif

$(objtree)/$(ARCH_DIR)/include:
diff --git a/arch/um/sys-ppc/Makefile b/arch/um/sys-ppc/Makefile
index a9814a7..0890152 100644
--- a/arch/um/sys-ppc/Makefile
+++ b/arch/um/sys-ppc/Makefile
@@ -6,7 +6,7 @@ OBJ = built-in.o
OBJS = ptrace.o sigcontext.o semaphore.o checksum.o miscthings.o misc.o \
ptrace_user.o sysrq.o

-EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(TOPDIR)/arch/ppc/kernel
+EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(srctree)/arch/ppc/kernel

all: $(OBJ)

@@ -22,25 +22,25 @@ sigcontext.o: sigcontext.c

semaphore.c:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(srctree)/arch/ppc/kernel/$@ $@

checksum.S:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/lib/$@ $@
+ ln -s $(srctree)/arch/ppc/lib/$@ $@

mk_defs.c:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(srctree)/arch/ppc/kernel/$@ $@

ppc_defs.head:
rm -f $@
- ln -s $(TOPDIR)/arch/ppc/kernel/$@ $@
+ ln -s $(srctree)/arch/ppc/kernel/$@ $@

ppc_defs.h: mk_defs.c ppc_defs.head \
- $(TOPDIR)/include/asm-ppc/mmu.h \
- $(TOPDIR)/include/asm-ppc/processor.h \
- $(TOPDIR)/include/asm-ppc/pgtable.h \
- $(TOPDIR)/include/asm-ppc/ptrace.h
+ $(srctree)/include/asm-ppc/mmu.h \
+ $(srctree)/include/asm-ppc/processor.h \
+ $(srctree)/include/asm-ppc/pgtable.h \
+ $(srctree)/include/asm-ppc/ptrace.h
# $(CC) $(CFLAGS) -S mk_defs.c
cp ppc_defs.head ppc_defs.h
# for bk, this way we can write to the file even if it's not checked out
@@ -56,13 +56,13 @@ ppc_defs.h: mk_defs.c ppc_defs.head \

checksum.o: checksum.S
rm -f asm
- ln -s $(TOPDIR)/include/asm-ppc asm
+ ln -s $(srctree)/include/asm-ppc asm
$(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
rm -f asm

misc.o: misc.S ppc_defs.h
rm -f asm
- ln -s $(TOPDIR)/include/asm-ppc asm
+ ln -s $(srctree)/include/asm-ppc asm
$(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
rm -f asm

2008-01-01 13:11:13

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles


>> -KERNEL_IMAGE = $(TOPDIR)/vmlinux
>> +KERNEL_IMAGE = $(objtree)/vmlinux
>
>Current directory when building is $(objtree) so here we should
>just skip the use of TOPDIR like this:
>> +KERNEL_IMAGE = vmlinux
>
>
>> KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
>> KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
>>
>> @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
>> -D TIMESTAMP=$(shell date +%s)
>>
>> $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
>> - $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
>> + $(CC) -fno-pic $(HEAD_DEFINES) -I$(objtree)/include -c -o $@ $<
>This has never worked with O=.. builds.
>The correct fix here is to use:
>> + $(CC) -fno-pic $(HEAD_DEFINES) -Iinclude -Iinclude2 -c -o $@ $<
>
>The -Iinclude2 is only for O=... builds so to keep current
>behaviour removing $(TOPDIR)/ would do it.

Thank you for your explanations!

The following one corrects all the mistakes as you told.

------->

Since TOPDIR is obsolete, this patch removes TOPDIR
from the Mips Makefiles.

Cc: Ralf Baechle <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449..1ae73ce 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,7 +12,7 @@ endif

MKLASATIMG = mklasatimg
MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
-KERNEL_IMAGE = $(TOPDIR)/vmlinux
+KERNEL_IMAGE = vmlinux
KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )

@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
-D TIMESTAMP=$(shell date +%s)

$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
- $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
+ $(CC) -fno-pic $(HEAD_DEFINES) -Iinclude -Iinclude2 -c -o $@ $<

OBJECTS = head.o kImage.o

2008-01-01 13:27:40

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 3/8] S390: Tiny fixes for Makefile


>> -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
>> +binfmt_elf32.o: $(objtree)/fs/binfmt_elf.c
>
>This prerequisite listing looks just bogus and should be removed altogether.
>We only need to list prerequisites explicit for generated files.

Not so sure whether this is what s390 people do on purpose.
Thanks anyway!

The following one contains the new fix.

------------>

This patch removes TOPDIR and fixes a bogus prerequisite
in arch/s390/kernel/Makefile.

Cc: Martin Schwidefsky <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

----

diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 56cb710..4accf27 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_AUDIT) += audit.o
compat-obj-$(CONFIG_AUDIT) += compat_audit.o
obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
compat_wrapper.o compat_exec_domain.o \
- binfmt_elf32.o $(compat-obj-y)
+ binfmt_elf.o $(compat-obj-y)

obj-$(CONFIG_VIRT_TIMER) += vtime.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
@@ -34,4 +34,4 @@ obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
#
# This is just to get the dependencies...
#
-binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
+binfmt_elf.o: $(objtree)/fs/binfmt_elf.c

2008-01-01 13:34:22

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles


>> -CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
>> +CC = gcc-cris -mlinux -march=v32 -I $(objtree)/include
>
>As in the mips case the right fix is to use:
>> +CC = gcc-cris -mlinux -march=v32 -Iinclude -Iinclude2
>
>In this way we pick up the includes also in the O=..
>case.

Thanks, Sam!

Resend it. ;)

--------->

This patch removes TOPDIR from Cris Makefiles.

Cc: Mikael Starvik <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 9f77eda..27e9f15 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -7,7 +7,7 @@
target = $(target_compressed_dir)
src = $(src_compressed_dir)

-CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
+CC = gcc-cris -mlinux -march=v32 -Iinclude -Iinclude2
CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris

2008-01-01 13:41:12

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 5/8] INFINIBAND: Remove 'TOPDIR' from Makefiles


>> -EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
>> - -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
>
>> +EXTRA_CFLAGS += -I$(objtree)/drivers/net/cxgb3 \
>Drop $(TOPDIR) like this:
>> +EXTRA_CFLAGS += -Idrivers/net/cxgb3 \
>
>> + -I$(objtree)/drivers/infiniband/hw/cxgb3/core
>And this line can be deleted - there is no such directory.
>At least not in my tree.

Yes, correct. Thank you.

----------->

This patch removes TOPDIR from infiniband Makefiles.

Cc: Sam Ravnborg <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/drivers/infiniband/hw/cxgb3/Makefile b/drivers/infiniband/hw/cxgb3/Makefile
index 36b9898..7e7b5a6 100644
--- a/drivers/infiniband/hw/cxgb3/Makefile
+++ b/drivers/infiniband/hw/cxgb3/Makefile
@@ -1,5 +1,4 @@
-EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
- -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
+EXTRA_CFLAGS += -Idrivers/net/cxgb3

obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o

2008-01-01 13:44:59

by Andreas Schwab

[permalink] [raw]
Subject: Re: [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

Sam Ravnborg <[email protected]> writes:

>> @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
>> -D TIMESTAMP=$(shell date +%s)
>>
>> $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
>> - $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
>> + $(CC) -fno-pic $(HEAD_DEFINES) -I$(objtree)/include -c -o $@ $<
> This has never worked with O=.. builds.
> The correct fix here is to use:
>> + $(CC) -fno-pic $(HEAD_DEFINES) -Iinclude -Iinclude2 -c -o $@ $<
>
> The -Iinclude2 is only for O=... builds so to keep current
> behaviour removing $(TOPDIR)/ would do it.

Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2008-01-01 14:00:14

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 6/8] FRV: Drop 'TOPDIR' from Makefiles

>
>In this file we can just drop use of $(TOPDIR) since this is our
>current directory anyway.

Thanks!

-------->

This patch drops TOPDIR from frv Makefiles.

Cc: David Howells <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
index dc6f038..6ae3254 100644
--- a/arch/frv/boot/Makefile
+++ b/arch/frv/boot/Makefile
@@ -10,7 +10,7 @@

targets := Image zImage bootpImage

-SYSTEM =$(TOPDIR)/$(LINUX)
+SYSTEM =$(LINUX)

ZTEXTADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@

-compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
+compressed/$(LINUX): $(LINUX) dep
@$(MAKE) -C compressed $(LINUX)

bootp/bootp: zImage initrd
@@ -59,10 +59,10 @@ initrd:
# installation
#
install: $(CONFIGURE) Image
- sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) Image System.map "$(INSTALL_PATH)"

zinstall: $(CONFIGURE) zImage
- sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
+ sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)"

#
# miscellany

2008-01-01 14:28:53

by Cong Wang

[permalink] [raw]
Subject: (Try #2) [Patch 7/8] FS: Drop 'TOPDIR' from Makefiles and remove some dead code


>
>The whole "Maintainer rules" part of this file should be deleted.
>I cannot see how it can be used anyway.

Agreed.

I delete them all and renew the patch.
Passed compiling test.

--------->

This patch drops TOPDIR since it's obsolete and removes
some dead code from fs/smbfs/Makefile.

Cc: Alexander Viro <[email protected]>
Cc: Tim Shimmin <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 6673ee8..4faf8c4 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
#EXTRA_CFLAGS += -Werror

-#
-# Maintainer rules
-#
-
-# getopt.c not included. It is intentionally separate
-SRC = proc.c dir.c cache.c sock.c inode.c file.c ioctl.c smbiod.c request.c \
- symlink.c
-
-proto:
- -rm -f proto.h
- @echo > proto2.h "/*"
- @echo >> proto2.h " * Autogenerated with cproto on: " `date`
- @echo >> proto2.h " */"
- @echo >> proto2.h ""
- @echo >> proto2.h "struct smb_request;"
- @echo >> proto2.h "struct sock;"
- @echo >> proto2.h "struct statfs;"
- @echo >> proto2.h ""
- cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
- mv proto2.h proto.h
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 49e3e7e..d1d3d49 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -1 +1 @@
-include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
+include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)

2008-01-01 17:27:47

by Eric Sandeen

[permalink] [raw]
Subject: Re: [xfs-masters] [Patch 7/8] FS: Remove 'TOPDIR' from Makefiles

WANG Cong wrote:
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all fs/ Makefiles.

> diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
> index 49e3e7e..d1d3d49 100644
> --- a/fs/xfs/Makefile
> +++ b/fs/xfs/Makefile
> @@ -1 +1 @@
> -include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
> +include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)

FWIW $(TOPDIR) is already banished from the latest xfs build code:

http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/Makefile

and the patch is in -mm too via git:

http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc6/2.6.24-rc6-mm1/broken-out/git-xfs.patch

Thanks,

-Eric

p.s. what is $(objtree) exactly? I don't see it mentioned in
Documentation/kbuild except as one line in an example... I thought
$(obj) and $(src) should be used outside of the core kbuild
infrastructure, and in this case wouldn't it be $(src) anyway?

2008-01-01 17:37:41

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [xfs-masters] [Patch 7/8] FS: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 11:27:37AM -0600, Eric Sandeen wrote:
> WANG Cong wrote:
> > TOPDIR is obsolete, use objtree instead.
> > This patch removes TOPDIR from all fs/ Makefiles.
>
> > diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
> > index 49e3e7e..d1d3d49 100644
> > --- a/fs/xfs/Makefile
> > +++ b/fs/xfs/Makefile
> > @@ -1 +1 @@
> > -include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
> > +include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
>
> FWIW $(TOPDIR) is already banished from the latest xfs build code:
>
Good - I will ignore the xfs bits.

> http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/Makefile
>
> and the patch is in -mm too via git:
>
> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc6/2.6.24-rc6-mm1/broken-out/git-xfs.patch

You can do this simpler:
+EXTRA_CFLAGS += -I$(src) -I$(src)/linux-2.6 -funsigned-char
+
+XFS_LINUX := linux-2.6
+
+ifeq ($(CONFIG_XFS_DEBUG),y)
+ EXTRA_CFLAGS += -g
+endif
+

like this:

ccflags-y := -I$(src) -I$(src)/linux-2.6 -funsigned-char
ccflags-$(CONFIG_XFS_DEBUG) += -g

XFS_LINUX := linux-2.6

> p.s. what is $(objtree) exactly? I don't see it mentioned in
> Documentation/kbuild except as one line in an example... I thought
> $(obj) and $(src) should be used outside of the core kbuild
> infrastructure, and in this case wouldn't it be $(src) anyway?

$(objtree) specify the build directory and is only rarely used.
Half of the current users are buggy and I should fix it one day.

Sam

2008-01-01 17:42:25

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #2) [Patch 3/8] S390: Tiny fixes for Makefile

On Tue, Jan 01, 2008 at 09:27:39PM +0800, WANG Cong wrote:
>
> >> -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
> >> +binfmt_elf32.o: $(objtree)/fs/binfmt_elf.c
> >
> >This prerequisite listing looks just bogus and should be removed altogether.
> >We only need to list prerequisites explicit for generated files.
>
> Not so sure whether this is what s390 people do on purpose.
> Thanks anyway!
>
> The following one contains the new fix.
>
> ------------>
>
> This patch removes TOPDIR and fixes a bogus prerequisite
> in arch/s390/kernel/Makefile.
>
> Cc: Martin Schwidefsky <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ----
>
> diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
> index 56cb710..4accf27 100644
> --- a/arch/s390/kernel/Makefile
> +++ b/arch/s390/kernel/Makefile
> @@ -20,7 +20,7 @@ obj-$(CONFIG_AUDIT) += audit.o
> compat-obj-$(CONFIG_AUDIT) += compat_audit.o
> obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
> compat_wrapper.o compat_exec_domain.o \
> - binfmt_elf32.o $(compat-obj-y)
> + binfmt_elf.o $(compat-obj-y)
>
> obj-$(CONFIG_VIRT_TIMER) += vtime.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> @@ -34,4 +34,4 @@ obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
> #
> # This is just to get the dependencies...
> #
> -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
> +binfmt_elf.o: $(objtree)/fs/binfmt_elf.c

This is wrong. s390 have a file named binfmt_elf32.c and with this
change it does no longer build.

If the output file does not exist then kbuild does not care about the
dependencies and will just build the target.
On the second invocation when the target exists then kbuild has
created a file named .<target>.cmd that list the dependencies
and this includes any included .c file.
So there is just no pint in defining this dependency explicit
in the MAkefile - kbuild will figure it out automatically.

The right fix is just to kill the explicit listed dependency.

Sam

2008-01-01 17:58:05

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 02:44:48PM +0100, Andreas Schwab wrote:
> Sam Ravnborg <[email protected]> writes:
>
> >> @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
> >> -D TIMESTAMP=$(shell date +%s)
> >>
> >> $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
> >> - $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
> >> + $(CC) -fno-pic $(HEAD_DEFINES) -I$(objtree)/include -c -o $@ $<
> > This has never worked with O=.. builds.
> > The correct fix here is to use:
> >> + $(CC) -fno-pic $(HEAD_DEFINES) -Iinclude -Iinclude2 -c -o $@ $<
> >
> > The -Iinclude2 is only for O=... builds so to keep current
> > behaviour removing $(TOPDIR)/ would do it.
>
> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
It would be better to use $(LINUXINCLUDE) as we then pull in all config
symbols too and do not have to hardcode kbuild internal names (include2).

As for the use of KBUILD_CPPFLAGS at present the usage is not consistent
across the architectures. Why does arm for example say:
KBUILD_CPPFLAGS += -mbig-endian

This looks like a KBUILD_CFLAGS thing to me.

So we should preferably stick with LINUXINCLUDE for now.

Sam

2008-01-02 05:55:34

by Cong Wang

[permalink] [raw]
Subject: (Try #3) [Patch 7/8] FS: Remove dead code

On Tue, Jan 01, 2008 at 06:37:29PM +0100, Sam Ravnborg wrote:
>On Tue, Jan 01, 2008 at 11:27:37AM -0600, Eric Sandeen wrote:
>> WANG Cong wrote:
>> > TOPDIR is obsolete, use objtree instead.
>> > This patch removes TOPDIR from all fs/ Makefiles.
>>
>> > diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
>> > index 49e3e7e..d1d3d49 100644
>> > --- a/fs/xfs/Makefile
>> > +++ b/fs/xfs/Makefile
>> > @@ -1 +1 @@
>> > -include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
>> > +include $(objtree)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL)
>>
>> FWIW $(TOPDIR) is already banished from the latest xfs build code:
>>
>Good - I will ignore the xfs bits.

Thanks. I will drop the xfs part.

------->

Remove dead code in smbfs makefile.

Cc: Alexander Viro <[email protected]>
Cc: Tim Shimmin <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 6673ee8..4faf8c4 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
#EXTRA_CFLAGS += -Werror

-#
-# Maintainer rules
-#
-
-# getopt.c not included. It is intentionally separate
-SRC = proc.c dir.c cache.c sock.c inode.c file.c ioctl.c smbiod.c request.c \
- symlink.c
-
-proto:
- -rm -f proto.h
- @echo > proto2.h "/*"
- @echo >> proto2.h " * Autogenerated with cproto on: " `date`
- @echo >> proto2.h " */"
- @echo >> proto2.h ""
- @echo >> proto2.h "struct smb_request;"
- @echo >> proto2.h "struct sock;"
- @echo >> proto2.h "struct statfs;"
- @echo >> proto2.h ""
- cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
- mv proto2.h proto.h

2008-01-02 06:21:39

by Cong Wang

[permalink] [raw]
Subject: (Try #3) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles


>>
>> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
>It would be better to use $(LINUXINCLUDE) as we then pull in all config
>symbols too and do not have to hardcode kbuild internal names (include2).

OK. Refine this patch.

----------->

Since TOPDIR is obsolete, this patch removes TOPDIR
from the Mips Makefiles.

Cc: Ralf Baechle <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449..17f5266 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,7 +12,7 @@ endif

MKLASATIMG = mklasatimg
MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
-KERNEL_IMAGE = $(TOPDIR)/vmlinux
+KERNEL_IMAGE = vmlinux
KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )

@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
-D TIMESTAMP=$(shell date +%s)

$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
- $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
+ $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<

OBJECTS = head.o kImage.o

2008-01-02 06:28:01

by Cong Wang

[permalink] [raw]
Subject: (Try #3) [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles


Refine it as suggested by Andreas.

-------->

This patch removes TOPDIR from Cris Makefiles.

Cc: Mikael Starvik <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Andreas Schwab <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 9f77eda..609692f 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -7,7 +7,7 @@
target = $(target_compressed_dir)
src = $(src_compressed_dir)

-CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
+CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris

2008-01-02 06:42:26

by Cong Wang

[permalink] [raw]
Subject: (Try #3) [Patch 3/8] S390: Remove 'TOPDIR' from Makefile


>If the output file does not exist then kbuild does not care about the
>dependencies and will just build the target.
>On the second invocation when the target exists then kbuild has
>created a file named .<target>.cmd that list the dependencies
>and this includes any included .c file.
>So there is just no pint in defining this dependency explicit
>in the MAkefile - kbuild will figure it out automatically.
>
>The right fix is just to kill the explicit listed dependency.

If I understand you correctly, then the fix should be
the below one.

-------->

This patch removes TOPDIR from arch/s390/kernel/Makefile.

Cc: Martin Schwidefsky <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: WANG Cong <[email protected]>

---

diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 56cb710..b3b650a 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -31,7 +31,3 @@ S390_KEXEC_OBJS := machine_kexec.o crash.o
S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)

-#
-# This is just to get the dependencies...
-#
-binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c

2008-01-02 09:31:43

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: (Try #3) [Patch 3/8] S390: Remove 'TOPDIR' from Makefile

On Wed, 2008-01-02 at 14:42 +0800, WANG Cong wrote:
> diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
> index 56cb710..b3b650a 100644
> --- a/arch/s390/kernel/Makefile
> +++ b/arch/s390/kernel/Makefile
> @@ -31,7 +31,3 @@ S390_KEXEC_OBJS := machine_kexec.o crash.o
> S390_KEXEC_OBJS += $(if
> $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
> obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
>
> -#
> -# This is just to get the dependencies...
> -#
> -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c

This one is correct. I'll add it to git390.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

2008-01-02 09:49:23

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #3) [Patch 3/8] S390: Remove 'TOPDIR' from Makefile

On Wed, Jan 02, 2008 at 10:31:35AM +0100, Martin Schwidefsky wrote:
> On Wed, 2008-01-02 at 14:42 +0800, WANG Cong wrote:
> > diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
> > index 56cb710..b3b650a 100644
> > --- a/arch/s390/kernel/Makefile
> > +++ b/arch/s390/kernel/Makefile
> > @@ -31,7 +31,3 @@ S390_KEXEC_OBJS := machine_kexec.o crash.o
> > S390_KEXEC_OBJS += $(if
> > $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
> > obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
> >
> > -#
> > -# This is just to get the dependencies...
> > -#
> > -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
>
> This one is correct. I'll add it to git390.

Thanks Martin.

Sam

2008-01-02 09:52:15

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [Patch 0/8] Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 03:13:11PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use srctree or objtree instead.
>
> This patch set removes all the TOPDIR use in the whole
> source tree and finally drops it in the top Makefile.
> They're against the current linus-tree.
>
> Note that Patch [8/8] should be applied _after_ all the
> previous patches are applied.

Hi Wang.

You a heads up. I will most likely apply
the remaining of the patches tonight, except the UM stuff
which I hope Jeff to take and the final removal of TOPDIR
may wait a bit.
I want the s390, xfs and um changes to hit -mm at least
and we have several external modules that uses TOPDIR.

And some of these external modules I care about - not
all of them but some of them.

Sam

2008-01-02 15:04:56

by Jeff Dike

[permalink] [raw]
Subject: Re: (Try #2) [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 09:01:25PM +0800, WANG Cong wrote:
> TOPDIR is obsolete, use srctree instead.
> This patch removes TOPDIR from all UML Makefiles.

Thanks, I'll send this to Andrew.

Jeff

--
Work email - jdike at linux dot intel dot com

2008-01-02 17:27:19

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #2) [Patch 1/8] UML: Remove 'TOPDIR' from Makefiles

On Wed, Jan 02, 2008 at 10:02:55AM -0500, Jeff Dike wrote:
> On Tue, Jan 01, 2008 at 09:01:25PM +0800, WANG Cong wrote:
> > TOPDIR is obsolete, use srctree instead.
> > This patch removes TOPDIR from all UML Makefiles.
>
> Thanks, I'll send this to Andrew.

Thanks Jeff.

Sam

2008-01-02 19:24:26

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #3) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Wed, Jan 02, 2008 at 02:21:36PM +0800, WANG Cong wrote:
>
> >>
> >> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
> >It would be better to use $(LINUXINCLUDE) as we then pull in all config
> >symbols too and do not have to hardcode kbuild internal names (include2).
>
> OK. Refine this patch.
>
> ----------->
>
> Since TOPDIR is obsolete, this patch removes TOPDIR
> from the Mips Makefiles.
>
> Cc: Ralf Baechle <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
Applied.

Sam

2008-01-02 19:25:46

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #3) [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles

On Wed, Jan 02, 2008 at 02:27:59PM +0800, WANG Cong wrote:
>
> Refine it as suggested by Andreas.
>
> -------->
>
> This patch removes TOPDIR from Cris Makefiles.
>
> Cc: Mikael Starvik <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Cc: Andreas Schwab <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>

Added Jesper to Cc and applied.

Sam

2008-01-02 19:26:37

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #2) [Patch 5/8] INFINIBAND: Remove 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 09:41:08PM +0800, WANG Cong wrote:
>
> >> -EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
> >> - -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
> >
> >> +EXTRA_CFLAGS += -I$(objtree)/drivers/net/cxgb3 \
> >Drop $(TOPDIR) like this:
> >> +EXTRA_CFLAGS += -Idrivers/net/cxgb3 \
> >
> >> + -I$(objtree)/drivers/infiniband/hw/cxgb3/core
> >And this line can be deleted - there is no such directory.
> >At least not in my tree.
>
> Yes, correct. Thank you.
>
> ----------->
>
> This patch removes TOPDIR from infiniband Makefiles.
>
> Cc: Sam Ravnborg <[email protected]>
> Cc: Roland Dreier <[email protected]>
> Cc: Sean Hefty <[email protected]>
> Cc: Hal Rosenstock <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>

Applied.

Sam

2008-01-02 19:26:59

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #2) [Patch 6/8] FRV: Drop 'TOPDIR' from Makefiles

On Tue, Jan 01, 2008 at 10:00:04PM +0800, WANG Cong wrote:
> >
> >In this file we can just drop use of $(TOPDIR) since this is our
> >current directory anyway.
>
> Thanks!
>
> -------->
>
> This patch drops TOPDIR from frv Makefiles.
>
> Cc: David Howells <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>

Applied.

Sam

2008-01-02 19:27:24

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #2) [Patch 7/8] FS: Drop 'TOPDIR' from Makefiles and remove some dead code

On Tue, Jan 01, 2008 at 10:28:52PM +0800, WANG Cong wrote:
>
> >
> >The whole "Maintainer rules" part of this file should be deleted.
> >I cannot see how it can be used anyway.
>
> Agreed.
>
> I delete them all and renew the patch.
> Passed compiling test.
>
> --------->
>
> This patch drops TOPDIR since it's obsolete and removes
> some dead code from fs/smbfs/Makefile.
>
> Cc: Alexander Viro <[email protected]>
> Cc: Tim Shimmin <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>

Applied.

Sam

2008-01-03 04:37:35

by Cong Wang

[permalink] [raw]
Subject: Re: [Patch 0/8] Remove 'TOPDIR' from Makefiles


>Hi Wang.
>
>You a heads up. I will most likely apply
>the remaining of the patches tonight, except the UM stuff
>which I hope Jeff to take and the final removal of TOPDIR
>may wait a bit.
>I want the s390, xfs and um changes to hit -mm at least
>and we have several external modules that uses TOPDIR.
>
>And some of these external modules I care about - not
>all of them but some of them.
>
> Sam

Thanks, Sam!

Cong

2008-01-03 17:04:22

by Jesper Nilsson

[permalink] [raw]
Subject: Re: (Try #3) [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles

On Wed, Jan 02, 2008 at 08:25:35PM +0100, Sam Ravnborg wrote:
> On Wed, Jan 02, 2008 at 02:27:59PM +0800, WANG Cong wrote:
> >
> > Refine it as suggested by Andreas.
> >
> > -------->
> >
> > This patch removes TOPDIR from Cris Makefiles.

We had the TOPDIR replaced with $(srcdir) already, but this looks better.

Compiles OK for both EtraxFS and ARTPEC-3 cpus in our tree.

> > Cc: Mikael Starvik <[email protected]>
> > Cc: Sam Ravnborg <[email protected]>
> > Cc: Andreas Schwab <[email protected]>
> > Signed-off-by: WANG Cong <[email protected]>
>
> Added Jesper to Cc and applied.

Thanks!

> Sam

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2008-01-03 19:59:28

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #3) [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles

On Thu, Jan 03, 2008 at 06:03:22PM +0100, Jesper Nilsson wrote:
> On Wed, Jan 02, 2008 at 08:25:35PM +0100, Sam Ravnborg wrote:
> > On Wed, Jan 02, 2008 at 02:27:59PM +0800, WANG Cong wrote:
> > >
> > > Refine it as suggested by Andreas.
> > >
> > > -------->
> > >
> > > This patch removes TOPDIR from Cris Makefiles.
>
> We had the TOPDIR replaced with $(srcdir) already, but this looks better.
>
> Compiles OK for both EtraxFS and ARTPEC-3 cpus in our tree.

Thanks - added a:
Tested-by: Jesper Nilsson <[email protected]>

Sam

2008-01-07 07:09:37

by Mikael Starvik

[permalink] [raw]
Subject: RE: [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles

>PS. Mikael - should Jesper be mentioned in MAINTAINERS?

Yes, that is a good idea. Down the road Jesper will take over maintainership
I guess.

-----Original Message-----
From: Sam Ravnborg [mailto:[email protected]]
Sent: Tuesday, January 01, 2008 11:20 AM
To: WANG Cong
Cc: Mikael Starvik; LKML; [email protected]; Andrew Morton;
dev-etrax
Subject: Re: [Patch 4/8] CRIS: Remove 'TOPDIR' from Makefiles


On Tue, Jan 01, 2008 at 03:29:22PM +0800, WANG Cong wrote:
>
> TOPDIR is obsolete, use objtree instead.
> This patch removes TOPDIR from all Cris Makefiles.
>
> Cc: Mikael Starvik <[email protected]>
> Cc: Sam Ravnborg <[email protected]>
> Signed-off-by: WANG Cong <[email protected]>
>
> ---
>
> diff --git a/arch/cris/arch-v32/boot/compressed/Makefile
b/arch/cris/arch-v32/boot/compressed/Makefile
> index 9f77eda..8586922 100644
> --- a/arch/cris/arch-v32/boot/compressed/Makefile
> +++ b/arch/cris/arch-v32/boot/compressed/Makefile
> @@ -7,7 +7,7 @@
> target = $(target_compressed_dir)
> src = $(src_compressed_dir)
>
> -CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
> +CC = gcc-cris -mlinux -march=v32 -I $(objtree)/include

As in the mips case the right fix is to use:
> +CC = gcc-cris -mlinux -march=v32 -Iinclude -Iinclude2

In this way we pick up the includes also in the O=..
case.

PS. Mikael - should Jesper be mentioned in MAINTAINERS?

Sam

2008-01-11 14:18:29

by Ralf Baechle

[permalink] [raw]
Subject: Re: (Try #3) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Wed, Jan 02, 2008 at 02:21:36PM +0800, WANG Cong wrote:

> >> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
> >It would be better to use $(LINUXINCLUDE) as we then pull in all config
> >symbols too and do not have to hardcode kbuild internal names (include2).
>
> OK. Refine this patch.

LDSCRIPT also needed fixing to get builds in a separate object directory
working again.

I've applied below fix.

Ralf

>From 8babf06e1265214116fb8ffc634c04df85597c52 Mon Sep 17 00:00:00 2001
From: WANG Cong <[email protected]>
Date: Wed, 2 Jan 2008 14:21:36 +0800
Subject: [PATCH] [MIPS] Lasat: Fix built in separate object directory.

Signed-off-by: WANG Cong <[email protected]>

[Ralf: The LDSCRIPT script needed fixing, too]

Signed-off-by: Ralf Baechle <[email protected]>

diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449..7ccd40d 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,11 +12,11 @@ endif

MKLASATIMG = mklasatimg
MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
-KERNEL_IMAGE = $(TOPDIR)/vmlinux
+KERNEL_IMAGE = vmlinux
KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )

-LDSCRIPT= -L$(obj) -Tromscript.normal
+LDSCRIPT= -L$(srctree)/$(obj) -Tromscript.normal

HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
-D_kernel_entry=0x$(KERNEL_ENTRY) \
@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
-D TIMESTAMP=$(shell date +%s)

$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
- $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
+ $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<

OBJECTS = head.o kImage.o

2008-01-11 17:02:24

by Sam Ravnborg

[permalink] [raw]
Subject: Re: (Try #3) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Fri, Jan 11, 2008 at 02:17:54PM +0000, Ralf Baechle wrote:
> On Wed, Jan 02, 2008 at 02:21:36PM +0800, WANG Cong wrote:
>
> > >> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
> > >It would be better to use $(LINUXINCLUDE) as we then pull in all config
> > >symbols too and do not have to hardcode kbuild internal names (include2).
> >
> > OK. Refine this patch.
>
> LDSCRIPT also needed fixing to get builds in a separate object directory
> working again.
>
> I've applied below fix.

Great - I will drop it from my tree.

See small comment below.

Sam


> Ralf
>
> From 8babf06e1265214116fb8ffc634c04df85597c52 Mon Sep 17 00:00:00 2001
> From: WANG Cong <[email protected]>
> Date: Wed, 2 Jan 2008 14:21:36 +0800
> Subject: [PATCH] [MIPS] Lasat: Fix built in separate object directory.
>
> Signed-off-by: WANG Cong <[email protected]>
>
> [Ralf: The LDSCRIPT script needed fixing, too]
>
> Signed-off-by: Ralf Baechle <[email protected]>
>
> diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
> index 5332449..7ccd40d 100644
> --- a/arch/mips/lasat/image/Makefile
> +++ b/arch/mips/lasat/image/Makefile
> @@ -12,11 +12,11 @@ endif
>
> MKLASATIMG = mklasatimg
> MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
> -KERNEL_IMAGE = $(TOPDIR)/vmlinux
> +KERNEL_IMAGE = vmlinux
> KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
> KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
>
> -LDSCRIPT= -L$(obj) -Tromscript.normal
> +LDSCRIPT= -L$(srctree)/$(obj) -Tromscript.normal

This needs to read:
> +LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal


(There is no difference between src and obj in normal cases but to be consistent
it shuld be like above).

>
> HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
> -D_kernel_entry=0x$(KERNEL_ENTRY) \
> @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
> -D TIMESTAMP=$(shell date +%s)
>
> $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
> - $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
> + $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<
>
> OBJECTS = head.o kImage.o
>

2008-01-14 06:27:41

by Cong Wang

[permalink] [raw]
Subject: Re: (Try #3) [Patch 2/8] MIPS: Remove 'TOPDIR' from Makefiles

On Fri, Jan 11, 2008 at 06:02:04PM +0100, Sam Ravnborg wrote:
>On Fri, Jan 11, 2008 at 02:17:54PM +0000, Ralf Baechle wrote:
>> On Wed, Jan 02, 2008 at 02:21:36PM +0800, WANG Cong wrote:
>>
>> > >> Shouldn't that use $(LINUXINCLUDE), or $(KBUILD_CPPFLAGS)?
>> > >It would be better to use $(LINUXINCLUDE) as we then pull in all config
>> > >symbols too and do not have to hardcode kbuild internal names (include2).
>> >
>> > OK. Refine this patch.
>>
>> LDSCRIPT also needed fixing to get builds in a separate object directory
>> working again.
>>
>> I've applied below fix.
>
>Great - I will drop it from my tree.
>
>See small comment below.
>
> Sam
>
>
>> Ralf
>>
>> From 8babf06e1265214116fb8ffc634c04df85597c52 Mon Sep 17 00:00:00 2001
>> From: WANG Cong <[email protected]>
>> Date: Wed, 2 Jan 2008 14:21:36 +0800
>> Subject: [PATCH] [MIPS] Lasat: Fix built in separate object directory.
>>
>> Signed-off-by: WANG Cong <[email protected]>
>>
>> [Ralf: The LDSCRIPT script needed fixing, too]
>>
>> Signed-off-by: Ralf Baechle <[email protected]>
>>
>> diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
>> index 5332449..7ccd40d 100644
>> --- a/arch/mips/lasat/image/Makefile
>> +++ b/arch/mips/lasat/image/Makefile
>> @@ -12,11 +12,11 @@ endif
>>
>> MKLASATIMG = mklasatimg
>> MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
>> -KERNEL_IMAGE = $(TOPDIR)/vmlinux
>> +KERNEL_IMAGE = vmlinux
>> KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
>> KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
>>
>> -LDSCRIPT= -L$(obj) -Tromscript.normal
>> +LDSCRIPT= -L$(srctree)/$(obj) -Tromscript.normal
>
>This needs to read:
>> +LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal
>
>
>(There is no difference between src and obj in normal cases but to be consistent
>it shuld be like above).

Agreed. Thank you!