| 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | |
| 3 | include include/config/auto.conf |
| 4 | include $(srctree)/scripts/Kbuild.include |
| 5 | |
| 6 | # for c_flags |
| 7 | include $(srctree)/scripts/Makefile.lib |
| 8 | |
| 9 | quiet_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 | |
| 15 | targets := $(MAKECMDGOALS) |
| 16 | |
| 17 | # Add FORCE to the prequisites of a target to force it to be always rebuilt. |
| 18 | # --------------------------------------------------------------------------- |
| 19 | |
| 20 | PHONY += FORCE |
| 21 | FORCE: |
| 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 | |
| 28 | existing-targets := $(wildcard $(sort $(targets))) |
| 29 | |
| 30 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
| 31 | |
| 32 | .PHONY: $(PHONY) |