Makefile: move determination test for OS to Makefile.d

Move the test code for OS detection in a extra directory to split it
from the main flashrom code.

flashrom-stable:
* Use `tail -n` to be standard compliant
* Fix some typos in comment

Change-Id: Id911f17f4100f242e1fde10d23a8459ddf38b369
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/58015
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72241
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/util/ich_descriptors_tool/Makefile b/util/ich_descriptors_tool/Makefile
index 42b950a..a84894e 100644
--- a/util/ich_descriptors_tool/Makefile
+++ b/util/ich_descriptors_tool/Makefile
@@ -4,6 +4,8 @@
 # This Makefile works standalone, but it is usually called from the main
 # Makefile in the flashrom directory.
 
+include ../../Makefile.include
+
 PROGRAM=ich_descriptors_tool
 EXTRAINCDIRS = ../../ .
 DEPPATH = .dep
@@ -28,8 +30,7 @@
 CC = gcc
 endif
 
-override TARGET_OS := $(shell $(CC) $(CPPFLAGS) -E $(SHAREDSRCDIR)/os.h | grep -v '^\#' | grep '"' | \
-			cut -f 2 -d'"')
+override TARGET_OS := $(call c_macro_test, ../../Makefile.d/os_test.h)
 
 ifeq ($(TARGET_OS), DOS)
 EXEC_SUFFIX := .exe