Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: boot: avoid unneeded rebuilds under arch/sh/boot/compressed/

Even if none of source code is updated, the following are every time
rebuilt:

CC arch/sh/boot/compressed/cache.o
SHIPPED arch/sh/boot/compressed/ashiftrt.S
AS arch/sh/boot/compressed/ashiftrt.o
SHIPPED arch/sh/boot/compressed/ashldi3.c
CC arch/sh/boot/compressed/ashldi3.o
SHIPPED arch/sh/boot/compressed/ashrsi3.S
AS arch/sh/boot/compressed/ashrsi3.o
SHIPPED arch/sh/boot/compressed/ashlsi3.S
AS arch/sh/boot/compressed/ashlsi3.o
SHIPPED arch/sh/boot/compressed/lshrsi3.S
AS arch/sh/boot/compressed/lshrsi3.o
LD arch/sh/boot/compressed/vmlinux
OBJCOPY arch/sh/boot/zImage

Add build artifacts to 'targets' as needed.

I turned the library files to check-in files. It is simpler than
copying from arch/sh/lib/ at build-time.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Rich Felker <dalias@libc.org>

authored by

Masahiro Yamada and committed by
Rich Felker
7fe859ee 7b6ef6e5

+23 -24
-5
arch/sh/boot/compressed/.gitignore
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - ashiftrt.S 3 - ashldi3.c 4 - ashlsi3.S 5 - ashrsi3.S 6 - lshrsi3.S 7 2 vmlinux.bin.*
+13 -19
arch/sh/boot/compressed/Makefile
··· 5 5 # create a compressed vmlinux image from the original vmlinux 6 6 # 7 7 8 - targets := vmlinux vmlinux.bin vmlinux.bin.gz \ 9 - vmlinux.bin.bz2 vmlinux.bin.lzma \ 10 - vmlinux.bin.xz vmlinux.bin.lzo \ 11 - head_32.o misc.o piggy.o 8 + OBJECTS := head_32.o misc.o cache.o piggy.o \ 9 + ashiftrt.o ashldi3.o ashrsi3.o ashlsi3.o lshrsi3.o 12 10 13 - OBJECTS = $(obj)/head_32.o $(obj)/misc.o $(obj)/cache.o 11 + # These were previously generated files. When you are building the kernel 12 + # with O=, make sure to remove the stale files in the output tree. Otherwise, 13 + # the build system wrongly compiles the stale ones. 14 + ifdef building_out_of_srctree 15 + $(shell rm -f $(addprefix $(obj)/, ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S)) 16 + endif 17 + 18 + targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ 19 + vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS) 14 20 15 21 GCOV_PROFILE := n 16 22 ··· 39 33 LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \ 40 34 -T $(obj)/../../kernel/vmlinux.lds 41 35 42 - # 43 - # Pull in the necessary libgcc bits from the in-kernel implementation. 44 - # 45 - lib1funcs-y := ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S 46 - lib1funcs-obj := \ 47 - $(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y)))) 36 + KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 48 37 49 - lib1funcs-dir := $(srctree)/arch/$(SRCARCH)/lib 50 - 51 - KBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING 52 - 53 - $(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE 54 - $(call cmd,shipped) 55 - 56 - $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE 38 + $(obj)/vmlinux: $(addprefix $(obj)/, $(OBJECTS)) FORCE 57 39 $(call if_changed,ld) 58 40 59 41 $(obj)/vmlinux.bin: vmlinux FORCE
+2
arch/sh/boot/compressed/ashiftrt.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #include "../../lib/ashiftrt.S"
+2
arch/sh/boot/compressed/ashldi3.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include "../../lib/ashldi3.c"
+2
arch/sh/boot/compressed/ashlsi3.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #include "../../lib/ashlsi3.S"
+2
arch/sh/boot/compressed/ashrsi3.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #include "../../lib/ashrsi3.S"
+2
arch/sh/boot/compressed/lshrsi3.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #include "../../lib/lshrsi3.S"