Introduce an `include` directory for header files

Move all header files to the new `include` directory.
Adapt include directives and build systems to the new directory.

Change-Id: Iaddd6bbfa0624b166d422f665877f096983bf4cf
Signed-off-by: Felix Singer <felix.singer@secunet.com>
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/58622
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72322
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
diff --git a/Makefile b/Makefile
index d1d88a4..1140b8c 100644
--- a/Makefile
+++ b/Makefile
@@ -252,6 +252,8 @@
 HAS_SERIAL          := $(strip $(if $(filter $(TARGET_OS), DOS libpayload), no, yes))
 EXEC_SUFFIX         := $(strip $(if $(filter $(TARGET_OS), DOS MinGW), .exe))
 
+override CFLAGS += -Iinclude
+
 ifeq ($(TARGET_OS), NetBSD)
 # Needs special `pciutils/pci.h` for older NetBSD packages
 override CPPFLAGS += $(shell [ -f /usr/pkg/include/pciutils/pci.h ] && echo -DPCIUTILS_PCI_H)
@@ -960,11 +962,11 @@
 	$(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
 	$(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
 
-libinstall: libflashrom.a libflashrom.h
+libinstall: libflashrom.a include/libflashrom.h
 	mkdir -p $(DESTDIR)$(PREFIX)/lib
 	$(INSTALL) -m 0644 libflashrom.a $(DESTDIR)$(PREFIX)/lib
 	mkdir -p $(DESTDIR)$(PREFIX)/include
-	$(INSTALL) -m 0644 libflashrom.h $(DESTDIR)$(PREFIX)/include
+	$(INSTALL) -m 0644 include/libflashrom.h $(DESTDIR)$(PREFIX)/include
 
 versioninfo:
 #	Generate versioninfo.inc containing metadata that would not be available in exported sources otherwise.
diff --git a/chipdrivers.h b/include/chipdrivers.h
similarity index 100%
rename from chipdrivers.h
rename to include/chipdrivers.h
diff --git a/coreboot_tables.h b/include/coreboot_tables.h
similarity index 100%
rename from coreboot_tables.h
rename to include/coreboot_tables.h
diff --git a/custom_baud.h b/include/custom_baud.h
similarity index 100%
rename from custom_baud.h
rename to include/custom_baud.h
diff --git a/edi.h b/include/edi.h
similarity index 100%
rename from edi.h
rename to include/edi.h
diff --git a/ene.h b/include/ene.h
similarity index 100%
rename from ene.h
rename to include/ene.h
diff --git a/flash.h b/include/flash.h
similarity index 100%
rename from flash.h
rename to include/flash.h
diff --git a/flashchips.h b/include/flashchips.h
similarity index 100%
rename from flashchips.h
rename to include/flashchips.h
diff --git a/fmap.h b/include/fmap.h
similarity index 100%
rename from fmap.h
rename to include/fmap.h
diff --git a/hwaccess_physmap.h b/include/hwaccess_physmap.h
similarity index 100%
rename from hwaccess_physmap.h
rename to include/hwaccess_physmap.h
diff --git a/hwaccess_x86_io.h b/include/hwaccess_x86_io.h
similarity index 100%
rename from hwaccess_x86_io.h
rename to include/hwaccess_x86_io.h
diff --git a/hwaccess_x86_msr.h b/include/hwaccess_x86_msr.h
similarity index 100%
rename from hwaccess_x86_msr.h
rename to include/hwaccess_x86_msr.h
diff --git a/ich_descriptors.h b/include/ich_descriptors.h
similarity index 100%
rename from ich_descriptors.h
rename to include/ich_descriptors.h
diff --git a/layout.h b/include/layout.h
similarity index 100%
rename from layout.h
rename to include/layout.h
diff --git a/libflashrom.h b/include/libflashrom.h
similarity index 100%
rename from libflashrom.h
rename to include/libflashrom.h
diff --git a/platform.h b/include/platform.h
similarity index 100%
rename from platform.h
rename to include/platform.h
diff --git a/platform/pci.h b/include/platform/pci.h
similarity index 100%
rename from platform/pci.h
rename to include/platform/pci.h
diff --git a/programmer.h b/include/programmer.h
similarity index 100%
rename from programmer.h
rename to include/programmer.h
diff --git a/spi.h b/include/spi.h
similarity index 100%
rename from spi.h
rename to include/spi.h
diff --git a/writeprotect.h b/include/writeprotect.h
similarity index 100%
rename from writeprotect.h
rename to include/writeprotect.h
diff --git a/meson.build b/meson.build
index be61892..1e571f5 100644
--- a/meson.build
+++ b/meson.build
@@ -358,10 +358,12 @@
 mandir = join_paths(prefix, get_option('mandir'))
 
 install_headers([
-    'libflashrom.h',
+    'include/libflashrom.h',
   ],
 )
 
+include_dir = include_directories('include')
+
 # core modules needed by both the library and the CLI
 srcs += '82802ab.c'
 srcs += 'at45db.c'
@@ -401,6 +403,7 @@
   sources : [
     srcs,
   ],
+  include_directories : include_dir,
   soversion : lt_current,
   version : lt_version,
   dependencies : [
@@ -444,7 +447,7 @@
 
 flashrom_dep = declare_dependency(
   link_with : flashrom,
-  include_directories : include_directories('.'),
+  include_directories : include_dir,
   dependencies : deps
 )
 
@@ -471,6 +474,7 @@
     'cli_output.c',
     'flashrom.c',
   ],
+  include_directories : include_dir,
   dependencies : [
     deps,
   ],
diff --git a/platform/endian_big.c b/platform/endian_big.c
index 5d65500..6541a83 100644
--- a/platform/endian_big.c
+++ b/platform/endian_big.c
@@ -15,7 +15,7 @@
  * GNU General Public License for more details.
  */
 
-#include "../platform.h"
+#include "platform.h"
 
 /* convert cpu native endian to little endian */
 ___return_swapped(cpu_to_le, 8)
diff --git a/platform/endian_little.c b/platform/endian_little.c
index b7c0068..aeb9d57 100644
--- a/platform/endian_little.c
+++ b/platform/endian_little.c
@@ -15,7 +15,7 @@
  * GNU General Public License for more details.
  */
 
-#include "../platform.h"
+#include "platform.h"
 
 /* convert cpu native endian to little endian */
 ___return_same(cpu_to_le, 8)
diff --git a/platform/memaccess.c b/platform/memaccess.c
index 44ef410..8368121 100644
--- a/platform/memaccess.c
+++ b/platform/memaccess.c
@@ -15,7 +15,7 @@
  * GNU General Public License for more details.
  */
 
-#include "../platform.h"
+#include "platform.h"
 
 /*
  * macro to return endian aware read function
diff --git a/util/ich_descriptors_tool/Makefile b/util/ich_descriptors_tool/Makefile
index ea80dc6..0b8a210 100644
--- a/util/ich_descriptors_tool/Makefile
+++ b/util/ich_descriptors_tool/Makefile
@@ -21,6 +21,7 @@
 # If the user has specified custom CFLAGS, all CFLAGS settings below will be
 # completely ignored by gnumake.
 CFLAGS ?= -Os -Wall -Wshadow
+CFLAGS += -I$(SHAREDSRCDIR)/include
 
 # Auto determine HOST_OS and TARGET_OS if they are not set as argument
 HOST_OS ?= $(shell uname)
diff --git a/util/ich_descriptors_tool/meson.build b/util/ich_descriptors_tool/meson.build
index b5bf09e..19097ee 100644
--- a/util/ich_descriptors_tool/meson.build
+++ b/util/ich_descriptors_tool/meson.build
@@ -7,7 +7,7 @@
   dependencies : [
     deps,
   ],
-  include_directories : include_directories('../..'),
+  include_directories : include_dir,
   c_args : [
     '-DICH_DESCRIPTORS_FROM_DUMP_ONLY',
   ],