MIPS: Refactor arch/mips/boot/Makefile
authorSam Ravnborg <sam@ravnborg.org>
Sun, 30 May 2010 14:27:33 +0000 (16:27 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 5 Aug 2010 12:25:57 +0000 (13:25 +0100)
- remove stuff that is not needed
  VMLINUX assignment, all: rule
- use hostprogs-y for the host program
- use kbuild rules for the three targets - to beautify output
- drop clean-files - it is no longer needed
- simplify arch/mips/Makefile when calling targets in boot/Makefile

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
To: linux-mips <linux-mips@linux-mips.org>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/1303/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Makefile
arch/mips/boot/Makefile

index 50f780aa8323db4153b128937774e61a39d3c2c5..93ce1cefcdf84dfc0154fdb881f99c38e7468911 100644 (file)
@@ -266,7 +266,6 @@ vmlinux.32: vmlinux
 vmlinux.64: vmlinux
        $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
 
-makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
 makezboot =$(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
           VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $(1)
 
@@ -284,14 +283,8 @@ vmlinuz.ecoff: vmlinux
 vmlinuz.srec: vmlinux
        +@$(call makezboot,$@)
 
-vmlinux.bin: $(vmlinux-32)
-       +@$(call makeboot,$@)
-
-vmlinux.ecoff: $(vmlinux-32)
-       +@$(call makeboot,$@)
-
-vmlinux.srec: $(vmlinux-32)
-       +@$(call makeboot,$@)
+vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
+       $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
 
 CLEAN_FILES += vmlinux.ecoff \
               vmlinux.srec
index e39a08edcaaa02b02790944cc5d64cd199e3a23b..85bcb5adc7cb16531a4ea93d41a101a83ee786ba 100644 (file)
 # Some DECstations need all possible sections of an ECOFF executable
 #
 ifdef CONFIG_MACH_DECSTATION
-  E2EFLAGS = -a
-else
-  E2EFLAGS =
+  e2eflag := -a
 endif
 
 #
 # Drop some uninteresting sections in the kernel.
 # This is only relevant for ELF kernels but doesn't hurt a.out
 #
-drop-sections  = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
-strip-flags    = $(addprefix --remove-section=,$(drop-sections))
-
-VMLINUX = vmlinux
-
-all: vmlinux.ecoff vmlinux.srec
-
-vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
-       $(obj)/elf2ecoff $(VMLINUX) $(obj)/vmlinux.ecoff $(E2EFLAGS)
-
-$(obj)/elf2ecoff: $(obj)/elf2ecoff.c
-       $(HOSTCC) -o $@ $^
-
-vmlinux.bin: $(VMLINUX)
-       $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $(obj)/vmlinux.bin
-
-vmlinux.srec: $(VMLINUX)
-       $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec
-
-clean-files += elf2ecoff \
-              vmlinux.bin \
-              vmlinux.ecoff \
-              vmlinux.srec
+drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
+strip-flags   := $(addprefix --remove-section=,$(drop-sections))
+
+hostprogs-y := elf2ecoff
+
+targets := vmlinux.ecoff
+quiet_cmd_ecoff = ECOFF   $@
+      cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag)
+$(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE
+       $(call if_changed,ecoff)
+
+targets += vmlinux.bin
+quiet_cmd_bin = OBJCOPY $@
+      cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
+$(obj)/vmlinux.bin: $(VMLINUX) FORCE
+       $(call if_changed,bin)
+
+targets += vmlinux.srec
+quiet_cmd_srec = OBJCOPY $@
+      cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
+$(obj)/vmlinux.srec: $(VMLINUX) FORCE
+       $(call if_changed,srec)