Massive refactoring of external header files.

This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD \
                vboot_reference \
                chromeos-cryptohome \
                chromeos-installer \
                chromeos-u-boot \
                peach-u-boot \
                depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
diff --git a/Makefile b/Makefile
index 9467779..d1708ef 100644
--- a/Makefile
+++ b/Makefile
@@ -160,6 +160,9 @@
 # Create / use dependency files
 CFLAGS += -MMD -MF $@.d
 
+# These are required to access large disks and files on 32-bit systems.
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+
 # Code coverage
 ifneq (${COV},)
   COV_FLAGS = -O0 --coverage
@@ -659,8 +662,9 @@
 hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main
 
 ${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
-	-Ihost/include\
-	-Ihost/arch/${ARCH}/include
+	-Ihost/include \
+	-Ihost/arch/${ARCH}/include \
+	-Ihost/lib/include
 
 # TODO: better way to make .a than duplicating this recipe each time?
 ${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS}
@@ -687,6 +691,8 @@
 .PHONY: cgpt
 cgpt: ${CGPT}
 
+${CGPT_OBJS}: INCLUDES += -Ihost/include
+
 ${CGPT}: LDFLAGS += -static
 ${CGPT}: LDLIBS += -luuid
 
@@ -704,7 +710,10 @@
 # Utilities
 
 # These have their own headers too.
-${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
+${BUILD}/utility/%: INCLUDES += \
+	-Ihost/include \
+	-Ihost/lib/include \
+	-Iutility/include
 
 # Utilities for auto-update toolkits must be statically linked.
 ${UTIL_BINS_STATIC}: LDFLAGS += -static
@@ -855,7 +864,7 @@
 
 # Allow multiple definitions, so tests can mock functions from other libraries
 ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
-${BUILD}/tests/%: INCLUDES += -Ihost/include
+${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include
 ${BUILD}/tests/%: LDLIBS += -lrt -luuid
 ${BUILD}/tests/%: LIBS += ${TESTLIB}