xref: /linux/scripts/Makefile.vmlinux (revision 7b4537199a4a8480b8c3ba37a2d44765ce76cd9b)
1*7b453719SMasahiro Yamada# SPDX-License-Identifier: GPL-2.0-only
2*7b453719SMasahiro Yamada
3*7b453719SMasahiro Yamadainclude include/config/auto.conf
4*7b453719SMasahiro Yamadainclude $(srctree)/scripts/Kbuild.include
5*7b453719SMasahiro Yamada
6*7b453719SMasahiro Yamada# for c_flags
7*7b453719SMasahiro Yamadainclude $(srctree)/scripts/Makefile.lib
8*7b453719SMasahiro Yamada
9*7b453719SMasahiro Yamadaquiet_cmd_cc_o_c = CC      $@
10*7b453719SMasahiro Yamada      cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
11*7b453719SMasahiro Yamada
12*7b453719SMasahiro Yamada%.o: %.c FORCE
13*7b453719SMasahiro Yamada	$(call if_changed_dep,cc_o_c)
14*7b453719SMasahiro Yamada
15*7b453719SMasahiro Yamadatargets := $(MAKECMDGOALS)
16*7b453719SMasahiro Yamada
17*7b453719SMasahiro Yamada# Add FORCE to the prequisites of a target to force it to be always rebuilt.
18*7b453719SMasahiro Yamada# ---------------------------------------------------------------------------
19*7b453719SMasahiro Yamada
20*7b453719SMasahiro YamadaPHONY += FORCE
21*7b453719SMasahiro YamadaFORCE:
22*7b453719SMasahiro Yamada
23*7b453719SMasahiro Yamada# Read all saved command lines and dependencies for the $(targets) we
24*7b453719SMasahiro Yamada# may be building above, using $(if_changed{,_dep}). As an
25*7b453719SMasahiro Yamada# optimization, we don't need to read them if the target does not
26*7b453719SMasahiro Yamada# exist, we will rebuild anyway in that case.
27*7b453719SMasahiro Yamada
28*7b453719SMasahiro Yamadaexisting-targets := $(wildcard $(sort $(targets)))
29*7b453719SMasahiro Yamada
30*7b453719SMasahiro Yamada-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
31*7b453719SMasahiro Yamada
32*7b453719SMasahiro Yamada.PHONY: $(PHONY)
33