History

kbuild: rebuild .vmlinux.export.o when its prerequisite is updated

When include/linux/export-internal.h is updated, .vmlinux.export.o must be rebuilt, but it does not happen because its rule is hidden behind scripts/link-vmlinux.sh. Move it out of the shell script, so that Make can see the dependency between vmlinux and .vmlinux.export.o. Move the vmlinux rule to scripts/Makefile.vmlinux.

Masahiro Yamada committed 4 years ago

Commit 5d4aeff1 parent 7a342e63 files · +25 −19Browse files

Showing the changes to scripts/Makefile.vmlinux (1 of 3 files). Show all

Unified · Split

scripts/Makefile.vmlinux+20−1
@@ -1,18 +1,37 @@
1# SPDX-License-Identifier: GPL-2.0-only1# SPDX-License-Identifier: GPL-2.0-only
2 2
3PHONY := __default
4__default: vmlinux
5
3include include/config/auto.conf6include include/config/auto.conf
4include $(srctree)/scripts/Kbuild.include7include $(srctree)/scripts/Kbuild.include
5 8
6# for c_flags9# for c_flags
7include $(srctree)/scripts/Makefile.lib10include $(srctree)/scripts/Makefile.lib
8 11
12targets :=
13
9quiet_cmd_cc_o_c = CC $@14quiet_cmd_cc_o_c = CC $@
10 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<15 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
11 16
12%.o: %.c FORCE17%.o: %.c FORCE
13 $(call if_changed_dep,cc_o_c)18 $(call if_changed_dep,cc_o_c)
14 19
15targets := $(MAKECMDGOALS)20ifdef CONFIG_MODULES
21targets += .vmlinux.export.o
22vmlinux: .vmlinux.export.o
23endif
24
25ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
26
27# Final link of vmlinux with optional arch pass after final link
28cmd_link_vmlinux = \
29 $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \
30 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
31
32targets += vmlinux
33vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
34 +$(call if_changed_dep,link_vmlinux)
16 35
17# Add FORCE to the prequisites of a target to force it to be always rebuilt.36# Add FORCE to the prequisites of a target to force it to be always rebuilt.
18# ---------------------------------------------------------------------------37# ---------------------------------------------------------------------------