Skip to contentSkip to conversation

ppc: Makefile tidy-up round 2

PATCH Sam Ravnborg 2 participants 7 messages Mar 20, 2003 – Mar 24, 2003 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

Hi Tom.

First batch of makefile tidy-up got merged by Paul, so here is next. Made on top of linuxppc-2.5 as of today.

So far only 2 cset's. Openfirmware and simple will show up later.

For prep the output looks nice when trying: "make V=0" One of the good things is that warnings becomes soo visible:

  AS      arch/ppc/boot/prep/head.o
  CC      arch/ppc/boot/prep/misc.o
  CC      arch/ppc/boot/prep/vreset.o

arch/ppc/boot/prep/vreset.c:694: warning: missing braces around initializer arch/ppc/boot/prep/vreset.c:694: warning: (near initialization for `PCI_slots[0].regs')
CC arch/ppc/boot/prep/kbd.o
CC arch/ppc/boot/prep/dummy.o
OBJCOPY arch/ppc/boot/prep/image.o
LD arch/ppc/boot/prep/zImage.bin
OBJCOPY arch/ppc/boot/prep/zImage
MKPREP arch/ppc/boot/images/zImage.prep
kernel: zImage is ready (arch/ppc/boot/images/zImage.prep)

I have made compiletime tests only - but the changes are straightforward. See description of the cset's below diffstat.

Attached as patches, but also available for bk pulling:

bk pull bk://linux-sam.bkbits.net/ppc-2.5

Sam

 arch/ppc/boot/utils/Makefile    |   20 -------
 b/arch/ppc/Makefile             |    4 -
 b/arch/ppc/boot/Makefile        |   19 +-----
 b/arch/ppc/boot/images/Makefile |   12 ++--
 b/arch/ppc/boot/prep/Makefile   |  114 +++++++++++++++++++++------------------- b/arch/ppc/boot/prep/dummy.c    |    4 +
 b/arch/ppc/kernel/Makefile      |   12 +---
 b/arch/ppc/ocp/Makefile         |    9 ---
 b/arch/ppc/ocp/xilinx/Makefile  |    2
 9 files changed, 84 insertions(+), 112 deletions(-)

[email protected], 2003-03-20 23:02:24+01:00, [email protected]
ppc: boot/prep/Makefile

Cleaned up, and utilise kbuild infrastructure.
Changes in commandlines are now detected, and recompile is forced. Output is nice with "make V=0"

Compile time tested only.

To avoid symlinking a copy of dummy.c is located in prep/.
The file is too simple to require symlinking to share it. (3 lines of code)

[email protected], 2003-03-20 22:46:06+01:00, [email protected]
ppc: Makefile tidy-up round 2

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.870 -> 1.871
# arch/ppc/Makefile 1.59 -> 1.60
# arch/ppc/boot/images/Makefile 1.15 -> 1.16
# arch/ppc/ocp/Makefile 1.2 -> 1.3
# arch/ppc/boot/Makefile 1.25 -> 1.26
# arch/ppc/ocp/xilinx/Makefile 1.4 -> 1.5
# arch/ppc/boot/utils/Makefile 1.5 -> (deleted)
# arch/ppc/kernel/Makefile 1.48 -> 1.49
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/20 [email protected] 1.871
# ppc: Makefile tidy-up round 2
# --------------------------------------------
#

arch/ppc/Makefile +2 -2
diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
@@ -11,10 +11,10 @@
 #
 
 # This must match PAGE_OFFSET in include/asm-ppc/page.h.
-KERNELLOAD	=$(CONFIG_KERNEL_START)
+KERNELLOAD	:= $(CONFIG_KERNEL_START)
 
 LDFLAGS_BLOB	:= --format binary --oformat elf32-powerpc
-LDFLAGS_vmlinux	= -Ttext $(KERNELLOAD) -Bstatic
+LDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic
 CPPFLAGS	+= -Iarch/$(ARCH)
 AFLAGS		+= -Iarch/$(ARCH)
 cflags-y	+= -Iarch/$(ARCH) -msoft-float -pipe \
arch/ppc/boot/Makefile +4 -15
diff -Nru a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
@@ -13,28 +13,17 @@
 CFLAGS	 	+= -fno-builtin -D__BOOTER__ -Iarch/$(ARCH)/boot/include
 HOSTCFLAGS	+= -Iarch/$(ARCH)/boot/include
 
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
+BOOT_TARGETS	= zImage zImage.initrd znetboot znetboot.initrd
 
 bootdir-y			:= simple
 bootdir-$(CONFIG_ALL_PPC)	:= openfirmware prep
-subdir-y			:= lib common images
-subdir-$(CONFIG_ALL_PPC)	+= of1275
+subdir-y				:= lib/ common/ images/
+subdir-$(CONFIG_ALL_PPC)		+= of1275/
 
 # for cleaning
 subdir-				+= simple/ openfirmware/ prep/
 
-tools-$(CONFIG_ALL_PPC)		:= addnote mknote hack-coff mkprep
-tools-$(CONFIG_PPLUS)		:= mkbugboot mkprep
-tools-$(CONFIG_4xx)		:= mktree
-tools-$(CONFIG_LOPEC)		:= mkbugboot mkprep
-tools-$(CONFIG_MCPN765)		:= mkbugboot mkprep
-tools-$(CONFIG_MENF1)		:= mkprep
-tools-$(CONFIG_MVME5100)	:= mkbugboot mkprep
-tools-$(CONFIG_PRPMC750)	:= mkbugboot mkprep
-tools-$(CONFIG_PRPMC800)	:= mkbugboot mkprep
-tools-$(CONFIG_SPRUCE)		:= mktree
-
-host-progs			:= $(addprefix utils/,$(tools-y))
+host-progs := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
 
 .PHONY: $(BOOT_TARGETS) $(bootdir-y)
 
arch/ppc/boot/images/Makefile +7 -5
diff -Nru a/arch/ppc/boot/images/Makefile b/arch/ppc/boot/images/Makefile
@@ -2,12 +2,14 @@
 # This dir holds all of the images for PPC machines.
 # Tom Rini	January 2001
 
-extra-y		:= vmlinux.gz
-GZIP_FLAGS	:= -v9f
+extra-y		:= vmlinux.bin vmlinux.gz
 
-$(obj)/vmlinux.gz: vmlinux
-	$(OBJCOPY) -O binary $< $(@:.gz=)
-	gzip $(GZIP_FLAGS) $(@:.gz=)
+OBJCOPYFLAGS_vmlinux.bin := -O binary
+$(obj)/vmlinux.bin: vmlinux FORCE
+	$(call if_changed,objcopy)
+
+$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
+	$(call if_changed,gzip)
 
 # Files generated that shall be removed upon make clean
 clean-files	:= sImage vmapus vmlinux* miboot* zImage*
arch/ppc/boot/utils/Makefile deleted +0 -20
diff -Nru a/arch/ppc/boot/utils/Makefile b/arch/ppc/boot/utils/Makefile
@@ -1,20 +0,0 @@
-#
-# arch/ppc/boot/utils/Makefile
-#
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "COPYING" in the main directory of this archive
-# for more details.
-
-HOSTCFLAGS += -I$(TOPDIR)/arch/$(ARCH)/boot/include
-
-all: FORCE
-
-# Simple programs with 1 file and no extra CFLAGS
-UTILS = addnote hack-coff mkprep mknote mkbugboot mktree \
-	addSystemMap addRamdDisk
-
-$(UTILS):
-	$(HOSTCC) $(HOSTCFLAGS) -o $@ [email protected]
-
-clean:
-	rm -f $(UTILS)
arch/ppc/kernel/Makefile +5 -7
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
@@ -10,13 +10,11 @@
 endif
 
 # Start off with 'head.o', change as needed.
-HEAD-y				:= head.o
-HEAD-$(CONFIG_40x)		:= head_4xx.o
-HEAD-$(CONFIG_440)		:= head_44x.o
-HEAD-$(CONFIG_8xx)		:= head_8xx.o
-HEAD-$(CONFIG_6xx)		+= idle_6xx.o
-
-extra-y	:= $(HEAD-y)
+extra-y				:= head.o
+extra-$(CONFIG_40x)		:= head_4xx.o
+extra-$(CONFIG_440)		:= head_44x.o
+extra-$(CONFIG_8xx)		:= head_8xx.o
+extra-$(CONFIG_6xx)		+= idle_6xx.o
 
 obj-y				:= entry.o traps.o irq.o idle.o time.o misc.o \
 					process.o signal.o ptrace.o align.o \
arch/ppc/ocp/Makefile +1 -8
diff -Nru a/arch/ppc/ocp/Makefile b/arch/ppc/ocp/Makefile
@@ -1,13 +1,6 @@
 #
 # Makefile for the linux kernel.
 #
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now in the main makefile...
-#
-# NB: cribbed from the drivers/sbus/Makefile -- PMM
 
-obj-y   	+= ocp.o ocp-driver.o ocp-probe.o
+obj-y   	:= ocp.o ocp-driver.o ocp-probe.o
 
arch/ppc/ocp/xilinx/Makefile +0 -2
diff -Nru a/arch/ppc/ocp/xilinx/Makefile b/arch/ppc/ocp/xilinx/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the Xilinx On Chip Peripheral support code
 #
 
-export-objs += xilinx_syms.o
-
 obj-$(CONFIG_XILINX_OCP)	+= xilinx_ocp.o
 
 # The Xilinx OS independent code.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.871 -> 1.872
# arch/ppc/boot/prep/Makefile 1.22 -> 1.23
# (new) -> 1.1 arch/ppc/boot/prep/dummy.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/20 [email protected] 1.872
# ppc: boot/prep/Makefile
#
# Cleaned up, and utilise kbuild infrastructure.
# Changes in commandlines are now detected, and recompile is forced. # Output is nice with "make V=0"
#
# Compile time tested only.
#
# To avoid symlinking a copy of dummy.c is located in prep/.
# The file is too simple to require symlinking to share it. (3 lines of code) # --------------------------------------------
#

arch/ppc/boot/prep/Makefile +61 -53

135 lines not on this page · raw message

arch/ppc/boot/prep/dummy.c new file +4 -0
diff -Nru a/arch/ppc/boot/prep/dummy.c b/arch/ppc/boot/prep/dummy.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+	return 0;
+}

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

More Makefile tidy-up - made on top of previous patches.

1) fixed a few bugs introduced when cleaning up boot/prep/Makefile
2) cleaned up boot/openfirmware/makefile
3) Got rid of boot/common/dummy.c
It is now located in three copies but thats OK for a three line file
See cset comments below.

I have skipped "simple" clean up for now. Is it worth the effort?

Please pull from
bk pull bk://linux-sam.bkbits.net/ppc-2.5

Regular patches will follow this mail.

Sam

[email protected], 2003-03-22 22:45:13+01:00, [email protected]
ppc: boot/common/dummy.c deleted

[email protected], 2003-03-22 22:40:45+01:00, [email protected]
ppc: boot/openfirmware/Makefile rewrite

Utilises kbuild infrastructure to build the images Sample output with "make V=0":

    AS      arch/ppc/boot/openfirmware/coffcrt0.o
    GEN     arch/ppc/boot/openfirmware/image.o
    COFF    arch/ppc/boot/openfirmware/coffboot
    COFF    arch/ppc/boot/images/vmlinux.coff
    AS      arch/ppc/boot/openfirmware/crt0.o
    CC      arch/ppc/boot/openfirmware/newworldmain.o
    ELF     arch/ppc/boot/images/vmlinux.elf-pmac
    CC      arch/ppc/boot/openfirmware/chrpmain.o
    CHRP    arch/ppc/boot/images/zImage.chrp

ADDNOTE arch/ppc/boot/images/zImage.chrp-rs6k
GEN arch/ppc/boot/images/miboot.image
kernel: zImage is ready (arch/ppc/boot/images/vmlinux.coff)

[email protected], 2003-03-22 22:26:02+01:00, [email protected]
ppc: Fix initrd build for prep

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.872 -> 1.873
# arch/ppc/boot/prep/Makefile 1.23 -> 1.24
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/22 [email protected] 1.873
# ppc: Fix initrd build for prep
# --------------------------------------------
#

arch/ppc/boot/prep/Makefile +22 -8
diff -Nru a/arch/ppc/boot/prep/Makefile b/arch/ppc/boot/prep/Makefile
@@ -45,7 +45,7 @@
 zImage.initrd: $(images)/zImage.initrd.prep
 	@echo '  kernel: $@ is ready ($<)'
 
-mages)/ramdisk.image.gz:
+$(images)/ramdisk.image.gz:
 	@echo '  MISSING $@'
 	@echo '          RAM disk image must be provided separatly'
 	@/bin/false
@@ -68,20 +68,28 @@
 
 LDFLAGS_zImage.bin		:= -Ttext 0x00800000 -Bstatic -T
 LDFLAGS_zImage.initrd.bin	:= -Ttext 0x00800000 -Bstatic -T
-targets				+= zImage.bin zImage.initrd.bin
-$(obj)/zImage$(initrd).bin: $(boot)/ld.script $(OBJS) $(obj)/image.o $(LIBS)
+targets += zImage.bin
+$(obj)/zImage.bin: $(boot)/ld.script $(OBJS) $(obj)/image.o $(LIBS)
+	$(call if_changed,ld)
+targets += zImage.initrd.bin
+$(obj)/zImage.initrd.bin: $(boot)/ld.script $(OBJS) $(obj)/image.initrd.o $(LIBS)
 	$(call if_changed,ld)
 
 OBJCOPYFLAGS_zImage		:= -R .comment -R .stab -R .stabstr
 OBJCOPYFLAGS_zImage.initrd	:= -R .comment -R .stab -R .stabstr
-targets				+= zImage zImage.initrd
-$(obj)/zImage$(initrd): %: %.bin FORCE
+targets += zImage
+$(obj)/zImage: %: %.bin FORCE
+	$(call if_changed,objcopy)
+targets += zImage.initrd
+$(obj)/zImage.initrd: %: %.bin FORCE
 	$(call if_changed,objcopy)
 
 quiet_cmd_mkprep = MKPREP  $@
       cmd_mkprep = $(utils)/mkprep -pbp $< $@
 
-$(images)/zImage$(initrd).prep: $(obj)/zImage$(initrd) $(utils)/mkprep FORCE
+$(images)/zImage.prep: $(obj)/zImage $(utils)/mkprep
+	$(call cmd,mkprep)
+$(images)/zImage.initrd.prep: $(obj)/zImage.initrd $(utils)/mkprep
 	$(call cmd,mkprep)
 
 #
@@ -90,5 +98,11 @@
 floppy: zImage
 	dd if=$(images)/zImage.prep of=/dev/fd0H1440 bs=64b
 
-znetboot.initrd : zImage$(initrd)
-	cp $(images)/zImage$(initrd).prep $(TFTPIMAGE)
+znetboot : zImage
+	cp $(images)/zImage.prep $(TFTPIMAGE)
+	@echo '  kernel: $@ is ready ($<)'
+
+znetboot.initrd : zImage.initrd
+	cp $(images)/zImage.initrd.prep $(TFTPIMAGE)
+	@echo '  kernel: $@ is ready ($<)'
+

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.873 -> 1.874
# arch/ppc/boot/openfirmware/Makefile 1.23 -> 1.24
# (new) -> 1.1 arch/ppc/boot/openfirmware/dummy.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/22 [email protected] 1.874
# ppc: boot/openfirmware/Makefile rewrite
#
# Utilises kbuild infrastructure to build the images
# Sample output with "make V=0":

#   AS      arch/ppc/boot/openfirmware/coffcrt0.o
#   GEN     arch/ppc/boot/openfirmware/image.o
#   COFF    arch/ppc/boot/openfirmware/coffboot
#   COFF    arch/ppc/boot/images/vmlinux.coff
#   AS      arch/ppc/boot/openfirmware/crt0.o
#   CC      arch/ppc/boot/openfirmware/newworldmain.o
#   ELF     arch/ppc/boot/images/vmlinux.elf-pmac
#   CC      arch/ppc/boot/openfirmware/chrpmain.o
#   CHRP    arch/ppc/boot/images/zImage.chrp
#   ADDNOTE arch/ppc/boot/images/zImage.chrp-rs6k
#   GEN     arch/ppc/boot/images/miboot.image
#   kernel: zImage is ready (arch/ppc/boot/images/vmlinux.coff)

# --------------------------------------------
#

arch/ppc/boot/openfirmware/Makefile +139 -113
diff -Nru a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
@@ -10,36 +10,34 @@
 #	Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
 #	rules.
 
-clean-files := note coffboot coffboot.initrd
+zImage.initrd znetboot.initrd: del-ramdisk-sec	:= -R .ramdisk
+zImage.initrd znetboot.initrd: initrd		:= .initrd
 
-boot: zImage
 
-boot := arch/ppc/boot
-common := $(boot)/common
-utils := $(boot)/utils
-bootlib := $(boot)/lib
-of1275 := $(boot)/of1275
-images := $(boot)/images
-
-OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
-COFF_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
-CHRP_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00800000
-NEWWORLD_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x01000000
+boot	:= arch/ppc/boot
+common	:= $(boot)/common
+utils	:= $(boot)/utils
+bootlib	:= $(boot)/lib
+of1275	:= $(boot)/of1275
+images	:= $(boot)/images
+
+OBJCOPY_ARGS	:= -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
+COFF_LD_ARGS	:= -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
+CHRP_LD_ARGS	:= -T $(boot)/ld.script -e _start -Ttext 0x00800000
+NEWWORLD_LD_ARGS:= -T $(boot)/ld.script -e _start -Ttext 0x01000000
 
 COMMONOBJS	:= start.o misc.o common.o
 COFFOBJS	:= coffcrt0.o $(COMMONOBJS) coffmain.o
-CHRPOBJS	:= crt0.o $(COMMONOBJS) chrpmain.o
-NEWWORLDOBJS	:= crt0.o $(COMMONOBJS) newworldmain.o
+CHRPOBJS	:= crt0.o     $(COMMONOBJS) chrpmain.o
+NEWWORLDOBJS	:= crt0.o     $(COMMONOBJS) newworldmain.o
 
-EXTRA_TARGETS := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS)
+targets 	:= $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o
 COFFOBJS	:= $(addprefix $(obj)/, $(COFFOBJS))
 CHRPOBJS	:= $(addprefix $(obj)/, $(CHRPOBJS))
 NEWWORLDOBJS	:= $(addprefix $(obj)/, $(NEWWORLDOBJS))
 
-LIBS = lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
+LIBS		:= lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
 
-ADDNOTE := $(utils)/addnote
-MKNOTE := $(utils)/mknote
 HACKCOFF := $(utils)/hack-coff
 
 ifdef CONFIG_SMP
@@ -49,108 +47,136 @@
 END += .64
 endif
 
-TFTPIMAGE=/tftpboot/zImage.
 
-$(obj)/dummy.o: $(common)/dummy.c
-	$(CC) -c -o $@ $(common)/dummy.c
-
-$(obj)/image.o: $(images)/vmlinux.gz $(obj)/dummy.o
-	$(OBJCOPY) $(obj)/dummy.o $@ -R .comment \
-		--add-section=.image=$(images)/vmlinux.gz \
-		--set-section-flags=.image=contents,alloc,load,readonly,data
-ifdef CONFIG_XMON
-	$(OBJCOPY) $@ $@ \
-		--add-section=.sysmap=$(TOPDIR)/System.map \
-		--set-section-flags=.sysmap=contents,alloc,load,readonly,data
-endif
+$(images)/ramdisk.image.gz:
+	@echo '  MISSING $@'
+	@echo '          RAM disk image must be provided seperatly'
+	@/bin/false
+
+objcpxmon-$(CONFIG_XMON) := --add-section=.sysmap=System.map \
+	--set-section-flags=.sysmap=contents,alloc,load,readonly,data
+quiet_cmd_genimage = GEN     $@
+      cmd_genimage = $(OBJCOPY) -R .comment       \
+	--add-section=.image=$(images)/vmlinux.gz \
+	--set-section-flags=.image=contents,alloc,load,readonly,data \
+	$(objcpxmon-y) $< $@
+
+targets += image.o
+$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
+	$(call if_changed,genimage)
 
 # Place the ramdisk in the initrd image.
-$(obj)/image-initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz
-	$(OBJCOPY) $(obj)/image.o $@ \
-		--add-section=.ramdisk=$(images)/ramdisk.image.gz \
-		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+quiet_cmd_genimage-initrd = GEN     $@
+      cmd_genimage-initrd = $(OBJCOPY) $< $@ \
+	--add-section=.ramdisk=$(images)/ramdisk.image.gz \
+	--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+targets += image.initrd.o
+$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
+	$(call if_changed,genimage-initrd)
 
 # Create the note section for New-World PowerMacs.
-$(obj)/note: $(MKNOTE)
-	$(MKNOTE) > $(obj)/note
-
-znetboot: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac $(images)/zImage.chrp
-	cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
-	cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END)elf
-	cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
-
-znetboot.initrd: $(images)/vmlinux.initrd.coff \
-		$(images)/vmlinux.initrd.elf-pmac \
-		$(images)/zImage.initrd.chrp
-	cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
-	cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
-	cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
+quit_cmd_mknote  = MKNOTE  $@
+     cmd_mknote  = $(utils)/mknote > $@
+targets		+= note
+$(obj)/note: $(utils)/mknote FORCE
+	$(call if_changed,mknote)
+
+
+$(obj)/coffcrt0.o: EXTRA_AFLAGS := -traditional -DXCOFF
+$(obj)/crt0.o:     EXTRA_AFLAGS := -traditional
+targets += coffcrt0.o crt0.o
+$(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
+	$(call if_changed_dep,as_o_S)
+
+quiet_cmd_gencoffb = COFF    $@
+      cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(filter-out FORCE,$^) && \
+                     $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
+targets += coffboot
+$(obj)/coffboot: $(COFFOBJS) $(obj)/image.o $(LIBS) FORCE
+	$(call if_changed,gencoffb)
+targets += coffboot.initrd
+$(obj)/coffboot.initrd: $(COFFOBJS) $(obj)/image.initrd.o $(LIBS) FORCE
+	$(call if_changed,gencoffb)
+
+
+quiet_cmd_gen-coff = COFF    $@
+      cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
+			$(HACKCOFF) $@ && \
+			ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
+
+$(images)/vmlinux.coff: $(obj)/coffboot
+	$(call cmd,gen-coff)
+
+$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
+	$(call cmd,gen-coff)
+
+quiet_cmd_gen-elf-pmac = ELF     $@
+      cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
+				$(NEWWORLDOBJS) $(LIBS) $< && \
+			$(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
+					 -R .comment $(del-ramdisk-sec)
+
+$(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) $(obj)/note
+	$(call cmd,gen-elf-pmac)
+$(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
+				   $(LIBS) $(obj)/note
+	$(call cmd,gen-elf-pmac)
+
+quiet_cmd_gen-chrp = CHRP    $@
+      cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $^ && \
+			$(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
 
+$(images)/zImage.chrp: $(CHRPOBJS) $(obj)/image.o $(LIBS)
+	$(call cmd,gen-chrp)
+$(images)/zImage.initrd.chrp: $(CHRPOBJS) $(obj)/image.initrd.o $(LIBS)
+	$(call cmd,gen-chrp)
+
+quiet_cmd_addnote = ADDNOTE $@
+      cmd_addnote = cat $< > $@ && $(utils)/addnote $@
+$(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
+	%-rs6k: %
+	$(call cmd,addnote)
+
+quiet_cmd_gen-miboot = GEN     $@
+      cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
+		       --add-section=image=$(word 2, $^) $< $@
 $(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
-	$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=$(images)/vmlinux.gz \
-		$(obj)/dummy.o $@
+	$(call cmd,gen-miboot)
 
 $(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
-	$(OBJCOPY) $(OBJCOPY_ARGS) \
-		--add-section=initrd=$(images)/ramdisk.image.gz \
-		$(images)/miboot.image $@
-
-$(obj)/coffcrt0.o: $(common)/crt0.S
-	$(CC) $(AFLAGS) -DXCOFF -traditional -c -o $@ $(common)/crt0.S
-
-$(obj)/crt0.o: $(common)/crt0.S
-	$(CC) $(AFLAGS) -traditional -c -o $@ $(common)/crt0.S
-
-$(obj)/coffboot: $(COFFOBJS) $(obj)/image.o $(LIBS)
-	$(LD) -o $@ $(COFF_LD_ARGS) $^
-	$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
-
-$(obj)/coffboot.initrd: $(COFFOBJS) $(obj)/image-initrd.o $(LIBS)
-	$(LD) -o $@ $(COFF_LD_ARGS) $^
-	$(OBJCOPY) $@ $@ -R .comment
-
-$(images)/vmlinux.coff: $(obj)/coffboot $(HACKCOFF)
-	$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot $@
-	$(HACKCOFF) $@
-	ln -sf vmlinux.coff $(images)/zImage.pmac
-
-$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd $(HACKCOFF)
-	$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot.initrd $@
-	$(HACKCOFF) $@
-	ln -sf vmlinux.initrd.coff $(images)/zImage.initrd.pmac
-
-$(images)/vmlinux.elf-pmac: $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o $(obj)/note
-	$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o
-	$(OBJCOPY) $@ $@ \
-		--add-section=.note=$(obj)/note -R .comment -R .ramdisk
-
-$(images)/vmlinux.initrd.elf-pmac: $(NEWWORLDOBJS) $(LIBS) \
-		$(obj)/image-initrd.o $(obj)/note
-	$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) \
-		$(obj)/image-initrd.o
-	$(OBJCOPY) $@ $@ \
-		--add-section=.note=$(obj)/note -R .comment
+	$(call cmd,gen-miboot)
 
-$(images)/zImage.chrp: $(CHRPOBJS) $(obj)/image.o $(LIBS)
-	$(LD) $(CHRP_LD_ARGS) -o $@ $^
-	$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
+# The targets used on the make command-line
+
+.PHONY: zImage zImage.initrd
+zImage:		 $(images)/vmlinux.coff 	\
+		 $(images)/vmlinux.elf-pmac	\
+		 $(images)/zImage.chrp		\
+		 $(images)/zImage.chrp-rs6k	\
+		 $(images)/miboot.image
+	@echo '  kernel: $@ is ready ($<)'
+zImage.initrd:	 $(images)/vmlinux.initrd.coff 		\
+		 $(images)/vmlinux.initrd.elf-pmac	\
+		 $(images)/zImage.initrd.chrp		\
+		 $(images)/zImage.initrd.chrp-rs6k	\
+		 $(images)/miboot.initrd.image
+	@echo '  kernel: $@ is ready ($<)'
+
+TFTPIMAGE	:= /tftpboot/zImage.
+
+.PHONY: znetboot znetboot.initrd
+znetboot:	$(images)/vmlinux.coff		\
+		$(images)/vmlinux.elf-pmac	\
+		$(images)/zImage.chrp
+	cp $(images)/vmlinux.coff     $(TFTPIMAGE).pmac$(END)
+	cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
+	cp $(images)/zImage.chrp      $(TFTPIMAGE).chrp$(END)
+	@echo '  kernel: $@ is ready ($<)'
+znetboot.initrd:$(images)/vmlinux.initrd.coff		\
+		$(images)/vmlinux.initrd.elf-pmac	\
+		$(images)/zImage.initrd.chrp
+	cp $(images)/vmlinux.initrd.coff     $(TFTPIMAGE).pmac$(END)
+	cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
+	cp $(images)/zImage.initrd.chrp      $(TFTPIMAGE).chrp$(END)
+	@echo '  kernel: $@ is ready ($<)'
 
-$(images)/zImage.initrd.chrp: $(CHRPOBJS) $(obj)/image-initrd.o $(LIBS)
-	$(LD) $(CHRP_LD_ARGS) -o $@ $^
-	$(OBJCOPY) $@ $@ -R .comment
-
-$(images)/zImage.chrp-rs6k: $(images)/zImage.chrp $(ADDNOTE)
-	cp $(images)/zImage.chrp $@
-	$(ADDNOTE) $@
-
-$(images)/zImage.initrd.chrp-rs6k: $(images)/zImage.initrd.chrp $(ADDNOTE)
-	cp $(images)/zImage.initrd.chrp $@
-	$(ADDNOTE) $@
-
-zImage: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac \
-		$(images)/zImage.chrp $(images)/zImage.chrp-rs6k \
-		$(images)/miboot.image
-
-zImage.initrd: $(images)/vmlinux.initrd.coff $(images)/vmlinux.initrd.elf-pmac\
-		$(images)/zImage.initrd.chrp $(images)/zImage.initrd.chrp-rs6k\
-		$(images)/miboot.initrd.image
arch/ppc/boot/openfirmware/dummy.c new file +4 -0
diff -Nru a/arch/ppc/boot/openfirmware/dummy.c b/arch/ppc/boot/openfirmware/dummy.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+	return 0;
+}

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
In reply to Sam Ravnborg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.874 -> 1.875
# arch/ppc/boot/simple/Makefile 1.35 -> 1.36
# arch/ppc/boot/common/dummy.c 1.2 -> (deleted)
# (new) -> 1.1 arch/ppc/boot/simple/dummy.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/03/22 [email protected] 1.875
# ppc: boot/common/dummy.c deleted
# --------------------------------------------
#

arch/ppc/boot/common/dummy.c deleted +0 -4
diff -Nru a/arch/ppc/boot/common/dummy.c b/arch/ppc/boot/common/dummy.c
@@ -1,4 +0,0 @@
-int main(void)
-{
-	return 0;
-}
arch/ppc/boot/simple/Makefile +1 -2
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
@@ -160,8 +160,7 @@
 MKPREP				:= $(utils)/mkprep
 MKTREE				:= $(utils)/mktree
 
-$(obj)/dummy.o: $(common)/dummy.c
-	$(CC) -c -o $@ $(common)/dummy.c
+targets := dummy.o
 
 $(obj)/zvmlinux: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
 		$(obj)/dummy.o
arch/ppc/boot/simple/dummy.c new file +4 -0
diff -Nru a/arch/ppc/boot/simple/dummy.c b/arch/ppc/boot/simple/dummy.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+	return 0;
+}

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
In reply to Sam Ravnborg
Quoted 9 lines · Sam Ravnborg

More Makefile tidy-up - made on top of previous patches.

1) fixed a few bugs introduced when cleaning up boot/prep/Makefile
2) cleaned up boot/openfirmware/makefile
3) Got rid of boot/common/dummy.c
It is now located in three copies but thats OK for a three line file
See cset comments below.

I have skipped "simple" clean up for now. Is it worth the effort?

Well, it's the most used, and has some other bits which need to be cleaned up. So, yes please.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 3 lines · Tom Rini

Well, it's the most used, and has some other bits which need to be cleaned up. So, yes please.

I wondered since it was not part of defconfig.
I will give it a spin - in two or three steps.

Sam

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/