Commit 0be6a9a0 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: Use targets := to tell kbuild about additional targets

EXTRA_TARGETS served several purposes before:
1) List targets to be build (built-in only)
2) Inform kbuild of targets within the makefile

Mixing the above are causing confusion, so for now on
targets :=
is used to inform kbuild about targets in a Makefile - that it otherwise
did not know about.

kbuild uses the "targets :=" information to:
a) read the dependency file .target.cmd
b) delete the target file during make clean
parent 19611479
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# #
host-progs := tools/mkbb tools/objstrip host-progs := tools/mkbb tools/objstrip
EXTRA_TARGETS := vmlinux.gz vmlinux \ targets := vmlinux.gz vmlinux \
vmlinux.nh tools/lxboot tools/bootlx tools/bootph \ vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
bootloader bootpheader bootloader bootpheader
OBJSTRIP := $(obj)/tools/objstrip OBJSTRIP := $(obj)/tools/objstrip
......
...@@ -69,7 +69,7 @@ endif ...@@ -69,7 +69,7 @@ endif
export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
EXTRA_TARGETS := Image zImage bootpImage targets := Image zImage bootpImage
$(obj)/Image: vmlinux FORCE $(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
...@@ -106,5 +106,4 @@ zinstall: $(obj)/zImage ...@@ -106,5 +106,4 @@ zinstall: $(obj)/zImage
$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \ $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \
$(obj)/zImage System.map "$(INSTALL_PATH)" $(obj)/zImage System.map "$(INSTALL_PATH)"
clean-files := $(addprefix $(obj)/,Image zImage bootpImage)
subdir- := bootp compressed subdir- := bootp compressed
...@@ -65,8 +65,8 @@ endif ...@@ -65,8 +65,8 @@ endif
SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
EXTRA_TARGETS := vmlinux vmlinux.lds piggy piggy.gz\ targets := vmlinux vmlinux.lds piggy piggy.gz piggy.o \
piggy.o font.o head.o $(OBJS) font.o head.o $(OBJS)
EXTRA_CFLAGS := $(CFLAGS_BOOT) -fpic EXTRA_CFLAGS := $(CFLAGS_BOOT) -fpic
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
...@@ -95,7 +95,5 @@ $(obj)/font.o: $(FONTC) ...@@ -95,7 +95,5 @@ $(obj)/font.o: $(FONTC)
$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config
@sed "$(SEDFLAGS)" < $< > $@ @sed "$(SEDFLAGS)" < $< > $@
clean-files := $(addprefix $(obj)/,vmlinux piggy* vmlinux.lds)
$(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c $(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
...@@ -25,9 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA ...@@ -25,9 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512 #RAMDISK := -DRAMDISK=512
EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \ targets := vmlinux.bin bootsect bootsect.o setup setup.o \
setup setup.o zImage bzImage zImage bzImage
subdir- := compressed subdir- := compressed
host-progs := tools/build host-progs := tools/build
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# create a compressed vmlinux image from the original vmlinux # create a compressed vmlinux image from the original vmlinux
# #
EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
......
...@@ -8,16 +8,14 @@ ...@@ -8,16 +8,14 @@
# Copyright (C) 1998 by David Mosberger-Tang <davidm@hpl.hp.com> # Copyright (C) 1998 by David Mosberger-Tang <davidm@hpl.hp.com>
# #
EXTRA_TARGETS := vmlinux.bin vmlinux.gz
targets-$(CONFIG_IA64_HP_SIM) += bootloader targets-$(CONFIG_IA64_HP_SIM) += bootloader
targets-$(CONFIG_IA64_GENERIC) += bootloader targets-$(CONFIG_IA64_GENERIC) += bootloader
EXTRA_TARGETS += $(sort $(targets-y)) targets := vmlinux.bin vmlinux.gz $(targets-y)
quiet_cmd_cptotop = LN $@ quiet_cmd_cptotop = LN $@
cmd_cptotop = ln -f $< $@ cmd_cptotop = ln -f $< $@
vmlinux.gz: $(obj)/vmlinux.gz $(targets-y) vmlinux.gz: $(obj)/vmlinux.gz $(addprefix $(obj)/,$(targets-y))
$(call cmd,cptotop) $(call cmd,cptotop)
@echo ' Kernel: $@ is ready' @echo ' Kernel: $@ is ready'
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
# This dir holds all of the images for PPC machines. # This dir holds all of the images for PPC machines.
# Tom Rini January 2001 # Tom Rini January 2001
EXTRA_TARGETS := vmlinux.gz targets := vmlinux.gz
GZIP_FLAGS := -v9f
GZIP_FLAGS = -v9f
$(obj)/vmlinux.gz: vmlinux $(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) -O binary $< $(@:.gz=) $(OBJCOPY) -O binary $< $(@:.gz=)
......
...@@ -59,12 +59,12 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) ...@@ -59,12 +59,12 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
host-progs := piggy addnote addSystemMap addRamDisk host-progs := piggy addnote addSystemMap addRamDisk
EXTRA_TARGETS += zImage zImage.initrd imagesize.c \ targets += zImage zImage.initrd imagesize.c \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
vmlinux.sm vmlinux.initrd vmlinux.sminitrd \ vmlinux.sm vmlinux.initrd vmlinux.sminitrd
sysmap.o initrd.o EXTRA_TARGETS := sysmap.o initrd.o
quiet_cmd_sysmap = SYSMAP $@ quiet_cmd_sysmap = SYSMAP $@
cmd_sysmap = $(obj)/addSystemMap System.map $< $@ cmd_sysmap = $(obj)/addSystemMap System.map $< $@
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux s390-specific parts of the memory manager. # Makefile for the linux s390-specific parts of the memory manager.
# #
EXTRA_TARGETS := image listing targets := image listing
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
quiet_cmd_listing = OBJDUMP $@ quiet_cmd_listing = OBJDUMP $@
cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \ cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux s390-specific parts of the memory manager. # Makefile for the linux s390-specific parts of the memory manager.
# #
EXTRA_TARGETS := image listing targets := image listing
EXTRA_AFLAGS := -traditional EXTRA_AFLAGS := -traditional
quiet_cmd_listing = OBJDUMP $@ quiet_cmd_listing = OBJDUMP $@
......
...@@ -8,7 +8,7 @@ ROOT_IMG := /usr/src/root.img ...@@ -8,7 +8,7 @@ ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout ELFTOAOUT := elftoaout
host-progs := piggyback btfixupprep host-progs := piggyback btfixupprep
EXTRA_TARGETS := tftpboot.img btfix.o btfix.s image targets := tftpboot.img btfix.o btfix.s image
quiet_cmd_elftoaout = ELFTOAOUT $@ quiet_cmd_elftoaout = ELFTOAOUT $@
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
......
...@@ -8,7 +8,7 @@ ROOT_IMG := /usr/src/root.img ...@@ -8,7 +8,7 @@ ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout ELFTOAOUT := elftoaout
host-progs := piggyback host-progs := piggyback
EXTRA_TARGETS := tftpboot.img vmlinux.aout targets := tftpboot.img vmlinux.aout
quiet_cmd_elftoaout = ELT2AOUT $@ quiet_cmd_elftoaout = ELT2AOUT $@
cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@ cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@
......
EXTRA_TARGETS := mk_sc mk_thread mk_thread_kern.o
host-progs := mk_sc host-progs := mk_sc
build-targets := $(host-progs) mk_thread
targets := mk_thread_kern.o mk_thread_user.o
mk_sc-objs := mk_sc.o mk_sc-objs := mk_sc.o
...@@ -11,6 +12,6 @@ $(obj)/mk_thread_user.o : $(src)/mk_thread_user.c ...@@ -11,6 +12,6 @@ $(obj)/mk_thread_user.o : $(src)/mk_thread_user.c
$(CC) $(USER_CFLAGS) -c -o $@ $< $(CC) $(USER_CFLAGS) -c -o $@ $<
clean : clean :
$(RM) -f $(EXTRA_TARGETS) $(RM) -f $(build-targets)
archmrproper : clean archmrproper : clean
EXTRA_TARGETS := mk_task mk_constants build-targets := mk_task mk_constants
targets := mk_task_user.o mk_task_kern.o \
mk_constants_user.o mk_constants_kern.o
$(obj)/mk_task: $(obj)/mk_task_user.o $(obj)/mk_task_kern.o $(obj)/mk_task: $(obj)/mk_task_user.o $(obj)/mk_task_kern.o
$(CC) -o $@ $^ $(CC) -o $@ $^
...@@ -16,6 +18,6 @@ $(obj)/mk_constants_kern.o : $(src)/mk_constants_kern.c ...@@ -16,6 +18,6 @@ $(obj)/mk_constants_kern.o : $(src)/mk_constants_kern.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
clean: clean:
$(RM) $(EXTRA_TARGETS) $(RM) $(build-targets)
archmrproper: archmrproper:
...@@ -25,8 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA ...@@ -25,8 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
#RAMDISK := -DRAMDISK=512 #RAMDISK := -DRAMDISK=512
EXTRA_TARGETS := vmlinux.bin bootsect bootsect.o \ targets := vmlinux.bin bootsect bootsect.o \
setup setup.o bzImage setup setup.o bzImage mtools.conf
EXTRA_CFLAGS := -m32 EXTRA_CFLAGS := -m32
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# Note all the files here are compiled/linked as 32bit executables. # Note all the files here are compiled/linked as 32bit executables.
# #
EXTRA_TARGETS := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
EXTRA_AFLAGS := -traditional -m32 EXTRA_AFLAGS := -traditional -m32
# cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with # cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
......
...@@ -32,4 +32,4 @@ quiet_cmd_elfconfig = MKELF $@ ...@@ -32,4 +32,4 @@ quiet_cmd_elfconfig = MKELF $@
$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
$(call if_changed,elfconfig) $(call if_changed,elfconfig)
targets += $(obj)/elfconfig.h targets += elfconfig.h
...@@ -29,6 +29,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) ...@@ -29,6 +29,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# Add subdir path # Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
targets := $(addprefix $(obj)/,$(targets))
clean-files := $(addprefix $(obj)/,$(clean-files)) clean-files := $(addprefix $(obj)/,$(clean-files))
host-progs := $(addprefix $(obj)/,$(host-progs)) host-progs := $(addprefix $(obj)/,$(host-progs))
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
......
...@@ -86,6 +86,7 @@ host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) ...@@ -86,6 +86,7 @@ host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
build-targets := $(addprefix $(obj)/,$(build-targets)) build-targets := $(addprefix $(obj)/,$(build-targets))
targets := $(addprefix $(obj)/,$(targets))
obj-y := $(addprefix $(obj)/,$(obj-y)) obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m)) obj-m := $(addprefix $(obj)/,$(obj-m))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
......
...@@ -25,10 +25,10 @@ quiet_cmd_cpio = CPIO $@ ...@@ -25,10 +25,10 @@ quiet_cmd_cpio = CPIO $@
$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE $(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE
$(call if_changed,cpio) $(call if_changed,cpio)
targets += $(obj)/initramfs_data.cpio targets += initramfs_data.cpio
$(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE $(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE
$(call if_changed,gzip) $(call if_changed,gzip)
targets += $(obj)/initramfs_data.cpio.gz targets += initramfs_data.cpio.gz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment