Merge "Fix openmp tests."
diff --git a/ndk/builds.py b/ndk/builds.py
index b68afae..02d315c 100644
--- a/ndk/builds.py
+++ b/ndk/builds.py
@@ -22,6 +22,7 @@
 from enum import auto, Enum, unique
 import ntpath
 import os
+from pathlib import Path
 import shutil
 import stat
 import subprocess
@@ -298,6 +299,15 @@
 
         return install_subdirs[0]
 
+    @property
+    def intermediate_out_dir(self) -> Path:
+        """Path for intermediate outputs of this module."""
+        base_path = Path(self.out_dir) / self.host.value / self.name
+        if self.split_build_by_arch:
+            return base_path / self.build_arch
+        else:
+            return base_path
+
     def __str__(self) -> str:
         if self.split_build_by_arch and self.build_arch is not None:
             return f'{self.name} [{self.build_arch}]'
diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py
index 57cd53a..7d98208 100755
--- a/ndk/checkbuild.py
+++ b/ndk/checkbuild.py
@@ -576,6 +576,43 @@
         ]
 
 
+class Make(ndk.builds.Module):
+    name = 'make'
+    path = 'prebuilt/{host}'
+    notice_group = ndk.builds.NoticeGroup.TOOLCHAIN
+
+    make_src: Path = ndk.paths.ANDROID_DIR / 'toolchain/make'
+    _make_builder: Optional[AutoconfBuilder] = None
+
+    @property
+    def notices(self) -> List[str]:
+        return [str(self.make_src / 'COPYING')]
+
+    @property
+    def make_builder(self) -> AutoconfBuilder:
+        """Returns the lazily initialized make builder for this module."""
+        if self._make_builder is None:
+            self._make_builder = AutoconfBuilder(
+                self.make_src / 'configure',
+                self.intermediate_out_dir,
+                self.host,
+                use_clang=True)
+        return self._make_builder
+
+    def build(self) -> None:
+        print('Building make...')
+        self.make_builder.build([
+            "--disable-nls",
+            "--disable-rpath",
+        ])
+
+    def install(self) -> None:
+        install_dir = self.get_install_path()
+        copy_tree(
+            str(self.make_builder.install_directory),
+            str(install_dir))
+
+
 class HostTools(ndk.builds.Module):
     name = 'host-tools'
     path = 'prebuilt/{host}'
@@ -589,45 +626,17 @@
         ndk.paths.android_path('toolchain/yasm/GNU_LGPL-2.0'),
     ]
 
-    make_src = ndk.paths.ANDROID_DIR / 'toolchain/make'
-    _make_builder: Optional[AutoconfBuilder] = None
-
     @property
     def notices(self) -> List[str]:
         return [
             ndk.paths.android_path('toolchain/python/Python-2.7.5/LICENSE'),
-            str(self.make_src / 'COPYING'),
             ndk.paths.ndk_path('sources/host-tools/toolbox/NOTICE'),
         ] + self.yasm_notices
 
-    @property
-    def intermediate_out_dir(self) -> Path:
-        """Path for intermediate outputs of this module."""
-        return Path(self.out_dir) / self.host.value
-
-    @property
-    def make_builder(self) -> AutoconfBuilder:
-        """Returns the lazily initialized make builder for this module."""
-        if self._make_builder is None:
-            self._make_builder = AutoconfBuilder(
-                self.make_src / 'configure',
-                self.intermediate_out_dir / 'make', self.host,
-                use_clang=True)
-        return self._make_builder
-
-    def build_make(self) -> None:
-        self.make_builder.build([
-            "--disable-nls",
-            "--disable-rpath",
-        ])
-
     def build(self) -> None:
         build_args = ndk.builds.common_build_args(self.out_dir, self.dist_dir,
                                                   self.host)
 
-        print('Building make...')
-        self.build_make()
-
         if self.host.is_windows:
             print('Building toolbox...')
             ndk.builds.invoke_external_build(
@@ -670,10 +679,6 @@
             shutil.copy2(
                 ndk.paths.ndk_path(f), os.path.join(install_dir, 'bin'))
 
-        copy_tree(
-            str(self.make_builder.install_directory),
-            str(install_dir))
-
 
 def install_exe(out_dir: str, install_dir: str, name: str,
                 host: ndk.hosts.Host) -> None:
@@ -1117,11 +1122,6 @@
         ]
 
     @property
-    def intermediate_out_dir(self) -> Path:
-        """Path for intermediate outputs of this module."""
-        return Path(self.out_dir) / self.host.value / 'gdb'
-
-    @property
     def expat_builder(self) -> ndk.autoconf.AutoconfBuilder:
         """Returns the lazily initialized expat builder for this module."""
         if self._expat_builder is None:
@@ -2648,6 +2648,7 @@
     Libcxx(),
     Libcxxabi(),
     Lit(),
+    Make(),
     Meta(),
     NativeAppGlue(),
     NdkBuild(),