kbuild: Use targets := to tell kbuild about additional targets
authorSam Ravnborg <sam@mars.ravnborg.org>
Sun, 9 Mar 2003 23:47:49 +0000 (00:47 +0100)
committerSam Ravnborg <sam@mars.ravnborg.org>
Sun, 9 Mar 2003 23:47:49 +0000 (00:47 +0100)
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

20 files changed:
arch/alpha/boot/Makefile
arch/arm/boot/Makefile
arch/arm/boot/compressed/Makefile
arch/i386/boot/Makefile
arch/i386/boot/compressed/Makefile
arch/ia64/boot/Makefile
arch/ppc/boot/images/Makefile
arch/ppc64/boot/Makefile
arch/s390/boot/Makefile
arch/s390x/boot/Makefile
arch/sparc/boot/Makefile
arch/sparc64/boot/Makefile
arch/um/sys-i386/util/Makefile
arch/um/util/Makefile
arch/x86_64/boot/Makefile
arch/x86_64/boot/compressed/Makefile
scripts/Makefile
scripts/Makefile.clean
scripts/Makefile.lib
usr/Makefile

index 0529f42..26fd071 100644 (file)
@@ -9,7 +9,7 @@
 #
 
 host-progs     := tools/mkbb tools/objstrip
-EXTRA_TARGETS  := vmlinux.gz vmlinux \
+targets                := vmlinux.gz vmlinux \
                   vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
                   bootloader bootpheader 
 OBJSTRIP       := $(obj)/tools/objstrip
index ec798c2..c0a0c7e 100644 (file)
@@ -69,7 +69,7 @@ endif
 
 export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
 
-EXTRA_TARGETS := Image zImage bootpImage
+targets := Image zImage bootpImage
 
 $(obj)/Image: vmlinux FORCE
        $(call if_changed,objcopy)
@@ -106,5 +106,4 @@ zinstall: $(obj)/zImage
        $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) \
        $(obj)/zImage System.map "$(INSTALL_PATH)"
 
-clean-files := $(addprefix $(obj)/,Image zImage bootpImage)
 subdir-            := bootp compressed
index d021ee4..f8ed95c 100644 (file)
@@ -65,8 +65,8 @@ endif
 
 SEDFLAGS       = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
 
-EXTRA_TARGETS := vmlinux vmlinux.lds piggy piggy.gz\
-                 piggy.o font.o head.o $(OBJS)
+targets       := vmlinux vmlinux.lds piggy piggy.gz piggy.o \
+                 font.o head.o $(OBJS)
 EXTRA_CFLAGS  := $(CFLAGS_BOOT) -fpic
 EXTRA_AFLAGS  := -traditional
 
@@ -95,7 +95,5 @@ $(obj)/font.o: $(FONTC)
 $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config
        @sed "$(SEDFLAGS)" < $< > $@
 
-clean-files := $(addprefix $(obj)/,vmlinux piggy* vmlinux.lds)
-
 $(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
 
index b7be8ed..a4cd096 100644 (file)
@@ -25,9 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 
 #RAMDISK := -DRAMDISK=512
 
-EXTRA_TARGETS  := vmlinux.bin bootsect bootsect.o \
-                  setup setup.o zImage bzImage
-
+targets                := vmlinux.bin bootsect bootsect.o setup setup.o \
+                  zImage bzImage
 subdir-        := compressed
 
 host-progs     := tools/build
index eee828a..258ea95 100644 (file)
@@ -4,7 +4,7 @@
 # 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
 
 LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
index 10978d8..a724c45 100644 (file)
@@ -8,16 +8,14 @@
 # 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_GENERIC) += bootloader
-EXTRA_TARGETS += $(sort $(targets-y))
+targets := vmlinux.bin vmlinux.gz $(targets-y)
 
 quiet_cmd_cptotop = LN      $@
       cmd_cptotop = ln -f $< $@
 
-vmlinux.gz: $(obj)/vmlinux.gz $(targets-y)
+vmlinux.gz: $(obj)/vmlinux.gz $(addprefix $(obj)/,$(targets-y))
        $(call cmd,cptotop)
        @echo '  Kernel: $@ is ready'
 
index e64447c..0b75247 100644 (file)
@@ -2,9 +2,8 @@
 # This dir holds all of the images for PPC machines.
 # Tom Rini     January 2001
 
-EXTRA_TARGETS  := vmlinux.gz
-
-GZIP_FLAGS = -v9f
+targets                := vmlinux.gz
+GZIP_FLAGS     := -v9f
 
 $(obj)/vmlinux.gz: vmlinux
        $(OBJCOPY) -O binary $< $(@:.gz=)
index 8024fa7..48d942e 100644 (file)
@@ -59,12 +59,12 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
 gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
 
 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 src-sec, $(required) $(initrd))) \
                           $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
-                          vmlinux.sm vmlinux.initrd vmlinux.sminitrd \
-                          sysmap.o initrd.o
+                          vmlinux.sm vmlinux.initrd vmlinux.sminitrd
+EXTRA_TARGETS          := sysmap.o initrd.o
 
 quiet_cmd_sysmap = SYSMAP   $@
       cmd_sysmap = $(obj)/addSystemMap System.map $< $@
index 44b4d73..b2fd41c 100644 (file)
@@ -2,8 +2,8 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-EXTRA_TARGETS := image listing
-EXTRA_AFLAGS  := -traditional
+targets                := image listing
+EXTRA_AFLAGS   := -traditional
 quiet_cmd_listing = OBJDUMP $@
       cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
                               --disassemble-zeroes --reloc vmlinux > $@
index 1c6c9d3..bd9ca0c 100644 (file)
@@ -2,8 +2,8 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-EXTRA_TARGETS := image listing
-EXTRA_AFLAGS  := -traditional
+targets                := image listing
+EXTRA_AFLAGS   := -traditional
 
 quiet_cmd_listing = OBJDUMP $@
       cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
index 7efc654..50a4670 100644 (file)
@@ -8,7 +8,7 @@ ROOT_IMG        := /usr/src/root.img
 ELFTOAOUT      := elftoaout
 
 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 $@
       cmd_elftoaout    = $(ELFTOAOUT) $(obj)/image -o $@
index 51dcc7d..b948bb9 100644 (file)
@@ -7,8 +7,8 @@
 ROOT_IMG       := /usr/src/root.img
 ELFTOAOUT      := elftoaout
 
-host-progs    := piggyback
-EXTRA_TARGETS := tftpboot.img vmlinux.aout
+host-progs     := piggyback
+targets                := tftpboot.img vmlinux.aout
 
 quiet_cmd_elftoaout = ELT2AOUT $@
       cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@
index 442e041..48a2109 100644 (file)
@@ -1,6 +1,7 @@
-EXTRA_TARGETS  := mk_sc mk_thread mk_thread_kern.o
 
 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
 
@@ -11,6 +12,6 @@ $(obj)/mk_thread_user.o : $(src)/mk_thread_user.c
        $(CC) $(USER_CFLAGS) -c -o $@ $<
 
 clean :
-       $(RM) -f $(EXTRA_TARGETS)
+       $(RM) -f $(build-targets)
 
 archmrproper : clean
index a595641..4c91c1e 100644 (file)
@@ -1,4 +1,6 @@
-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
        $(CC) -o $@ $^
@@ -16,6 +18,6 @@ $(obj)/mk_constants_kern.o : $(src)/mk_constants_kern.c
        $(CC) $(CFLAGS) -c $< -o $@
 
 clean:
-       $(RM) $(EXTRA_TARGETS)
+       $(RM) $(build-targets)
 
 archmrproper:
index aca2279..9b17ea9 100644 (file)
@@ -25,8 +25,8 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 
 #RAMDISK := -DRAMDISK=512
 
-EXTRA_TARGETS  := vmlinux.bin bootsect bootsect.o \
-                  setup setup.o bzImage
+targets                := vmlinux.bin bootsect bootsect.o \
+                  setup setup.o bzImage mtools.conf
 
 EXTRA_CFLAGS := -m32
 
index 13287c5..759956d 100644 (file)
@@ -6,7 +6,7 @@
 # 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
 
 # cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with
index 3b00318..cf1ba16 100644 (file)
@@ -32,4 +32,4 @@ quiet_cmd_elfconfig = MKELF   $@
 $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
        $(call if_changed,elfconfig)
 
-targets += $(obj)/elfconfig.h
+targets += elfconfig.h
index b88e5e4..38079ba 100644 (file)
@@ -29,6 +29,7 @@ subdir-ymn      := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
 # Add subdir path
 
 EXTRA_TARGETS  := $(addprefix $(obj)/,$(EXTRA_TARGETS))
+targets                := $(addprefix $(obj)/,$(targets))
 clean-files    := $(addprefix $(obj)/,$(clean-files))
 host-progs     := $(addprefix $(obj)/,$(host-progs))
 subdir-ymn     := $(addprefix $(obj)/,$(subdir-ymn))
index 6877b8b..4570f73 100644 (file)
@@ -86,6 +86,7 @@ host-cshobjs  := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
 
 EXTRA_TARGETS  := $(addprefix $(obj)/,$(EXTRA_TARGETS))
 build-targets  := $(addprefix $(obj)/,$(build-targets))
+targets                := $(addprefix $(obj)/,$(targets))
 obj-y          := $(addprefix $(obj)/,$(obj-y))
 obj-m          := $(addprefix $(obj)/,$(obj-m))
 subdir-obj-y   := $(addprefix $(obj)/,$(subdir-obj-y))
index f50927e..58a915e 100644 (file)
@@ -25,10 +25,10 @@ quiet_cmd_cpio = CPIO    $@
 $(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE
        $(call if_changed,cpio)
 
-targets += $(obj)/initramfs_data.cpio
+targets += initramfs_data.cpio
 
 $(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE
        $(call if_changed,gzip)
 
-targets += $(obj)/initramfs_data.cpio.gz
+targets += initramfs_data.cpio.gz