Makefiles: Rename top-level Makefiles from .inc to .mk

The .inc suffix is confusing to various tools as it's not specific to
Makefiles. This means that editors don't recognize the files, and don't
open them with highlighting and any other specific editor functionality.

This issue is also seen in the release notes generation script where
Makefiles get renamed before running cloc.

The rest of the Makefiles will be renamed in following commits.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: Idaf69c6871d0bc1ee5e2e53157b8631c55eb3db9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80063
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/Makefile b/Makefile
index b521f04..4a87d2f 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@
 SYMLINK_LIST = $(call rwildcard,site-local/,symlink.txt)
 
 
-# directory containing the toplevel Makefile.inc
+# Directory containing the toplevel Makefile.mk
 TOPLEVEL := .
 
 CONFIG_SHELL := sh
@@ -102,7 +102,7 @@
 
 # This include must come _before_ the pattern rules below!
 # Order _does_ matter for pattern rules.
-include $(srck)/Makefile.inc
+include $(srck)/Makefile.mk
 
 # The cases where we don't need fully populated $(obj) lists:
 # 1. when no .config exists
@@ -153,11 +153,12 @@
 HOSTCC ?= $(if $(shell type gcc 2>/dev/null),gcc,cc)
 HOSTCXX ?= g++
 
-include $(TOPLEVEL)/Makefile.inc
-include $(TOPLEVEL)/payloads/Makefile.inc
-include $(TOPLEVEL)/util/testing/Makefile.inc
+include $(TOPLEVEL)/Makefile.mk
+include $(TOPLEVEL)/payloads/Makefile.mk
+include $(TOPLEVEL)/util/testing/Makefile.mk
+-include $(TOPLEVEL)/site-local/Makefile.mk
 -include $(TOPLEVEL)/site-local/Makefile.inc
-include $(TOPLEVEL)/tests/Makefile.inc
+include $(TOPLEVEL)/tests/Makefile.mk
 printall real-all:
 	@echo "Error: Trying to build, but NOCOMPILE is set." >&2
 	@echo "  Please file a bug with the following information:"
@@ -198,7 +199,7 @@
 export LANG LC_ALL TZ SOURCE_DATE_EPOCH
 
 ifneq ($(UNIT_TEST),1)
-include toolchain.inc
+include toolchain.mk
 endif
 
 strip_quotes = $(strip $(subst ",,$(subst \",,$(1))))
@@ -276,7 +277,7 @@
 	$(subst .$(1),,\
 	$(filter %.ads %.adb,$(2)))))))))
 
-# Clean -y variables, include Makefile.inc
+# Clean -y variables, include Makefile.mk & Makefile.inc
 # Add paths to files in X-y to X-srcs
 # Add subdirs-y to subdirs
 includemakefiles= \
@@ -295,10 +296,13 @@
 
 # For each path in $(subdirs) call includemakefiles
 # Repeat until subdirs is empty
+# TODO: Remove Makefile.inc support
 evaluate_subdirs= \
 	$(eval cursubdirs:=$(subdirs)) \
 	$(eval subdirs:=) \
 	$(foreach dir,$(cursubdirs), \
+		$(eval $(call includemakefiles,$(dir)/Makefile.mk))) \
+	$(foreach dir,$(cursubdirs), \
 		$(eval $(call includemakefiles,$(dir)/Makefile.inc))) \
 	$(if $(subdirs),$(eval $(call evaluate_subdirs)))
 
@@ -306,11 +310,11 @@
 subdirs:=$(TOPLEVEL)
 postinclude-hooks :=
 
-# Don't iterate through Makefile.incs under src/ when building tests
+# Don't iterate through Makefiles under src/ when building tests
 ifneq ($(UNIT_TEST),1)
 $(eval $(call evaluate_subdirs))
 else
-include $(TOPLEVEL)/tests/Makefile.inc
+include $(TOPLEVEL)/tests/Makefile.mk
 endif
 
 ifeq ($(FAILBUILD),1)