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