Skip to content

Commit 7fe859e

Browse files
masahir0yRich Felker
authored andcommitted
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 <[email protected]> Tested-by: John Paul Adrian Glaubitz <[email protected]> Signed-off-by: Rich Felker <[email protected]>
1 parent 7b6ef6e commit 7fe859e

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

arch/sh/boot/compressed/.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
ashiftrt.S
3-
ashldi3.c
4-
ashlsi3.S
5-
ashrsi3.S
6-
lshrsi3.S
72
vmlinux.bin.*

arch/sh/boot/compressed/Makefile

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
# create a compressed vmlinux image from the original vmlinux
66
#
77

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
10+
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
1217

13-
OBJECTS = $(obj)/head_32.o $(obj)/misc.o $(obj)/cache.o
18+
targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
19+
vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS)
1420

1521
GCOV_PROFILE := n
1622

@@ -33,21 +39,9 @@ ccflags-remove-$(CONFIG_MCOUNT) += -pg
3339
LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
3440
-T $(obj)/../../kernel/vmlinux.lds
3541

36-
#
37-
# Pull in the necessary libgcc bits from the in-kernel implementation.
38-
#
39-
lib1funcs-y := ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S
40-
lib1funcs-obj := \
41-
$(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
42-
43-
lib1funcs-dir := $(srctree)/arch/$(SRCARCH)/lib
44-
45-
KBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING
46-
47-
$(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
48-
$(call cmd,shipped)
42+
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
4943

50-
$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
44+
$(obj)/vmlinux: $(addprefix $(obj)/, $(OBJECTS)) FORCE
5145
$(call if_changed,ld)
5246

5347
$(obj)/vmlinux.bin: vmlinux FORCE

arch/sh/boot/compressed/ashiftrt.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#include "../../lib/ashiftrt.S"

arch/sh/boot/compressed/ashldi3.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
#include "../../lib/ashldi3.c"

arch/sh/boot/compressed/ashlsi3.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#include "../../lib/ashlsi3.S"

arch/sh/boot/compressed/ashrsi3.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#include "../../lib/ashrsi3.S"

arch/sh/boot/compressed/lshrsi3.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
#include "../../lib/lshrsi3.S"

0 commit comments

Comments
 (0)