kernel-ark/arch/ppc/boot/openfirmware/Makefile
Paul Smith 4f1933620f kbuild: change kbuild to not rely on incorrect GNU make behavior
The kbuild system takes advantage of an incorrect behavior in GNU make.
Once this behavior is fixed, all files in the kernel rebuild every time,
even if nothing has changed.  This patch ensures kbuild works with both
the incorrect and correct behaviors of GNU make.

For more details on the incorrect behavior, see:

http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html

Changes in this patch:
  - Keep all targets that are to be marked .PHONY in a variable, PHONY.
  - Add .PHONY: $(PHONY) to mark them properly.
  - Remove any $(PHONY) files from the $? list when determining whether
    targets are up-to-date or not.

Signed-off-by: Paul Smith <psmith@gnu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-03-06 00:09:51 +01:00

110 lines
3.2 KiB
Makefile

# Makefile for making bootable images on various OpenFirmware machines.
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies.
#
# Paul Mackerras January 1997
# XCOFF bootable images for PowerMacs
# Geert Uytterhoeven September 1997
# ELF bootable iamges for CHRP machines.
# Tom Rini January 2001
# Cleaned up, moved into arch/ppc/boot/pmac
# Tom Rini July/August 2002
# Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
# rules.
zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
zImage.initrd znetboot.initrd: initrd := .initrd
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
COMMONOBJS := start.o misc.o common.o
CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
targets := $(CHRPOBJS) dummy.o
CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
ifdef CONFIG_SMP
END := .smp
endif
ifdef CONFIG_PPC64BRIDGE
END += .64
endif
$(images)/ramdisk.image.gz:
@echo ' MISSING $@'
@echo ' RAM disk image must be provided separately'
@/bin/false
quiet_cmd_genimage = GEN $@
cmd_genimage = $(OBJCOPY) -R .comment \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data $< $@
targets += image.o
$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
$(call if_changed,genimage)
# Place the ramdisk in the initrd image.
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)
targets += crt0.o
$(obj)/crt0.o: $(common)/crt0.S FORCE
$(call if_changed_dep,as_o_S)
quiet_cmd_gen-chrp = CHRP $@
cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
$(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
$(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
$(srctree)/$(boot)/ld.script
$(call cmd,gen-chrp)
$(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
$(srctree)/$(boot)/ld.script
$(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)
# The targets used on the make command-line
PHONY += zImage zImage.initrd
zImage: $(images)/zImage.chrp \
$(images)/zImage.chrp-rs6k
@echo ' kernel: $@ is ready ($<)'
zImage.initrd: $(images)/zImage.initrd.chrp \
$(images)/zImage.initrd.chrp-rs6k
@echo ' kernel: $@ is ready ($<)'
TFTPIMAGE := /tftpboot/zImage
PHONY += znetboot znetboot.initrd
znetboot: $(images)/zImage.chrp
cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
@echo ' kernel: $@ is ready ($<)'
znetboot.initrd:$(images)/zImage.initrd.chrp
cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
@echo ' kernel: $@ is ready ($<)'