Test PSA compliance: Build only the crypto target

Use CMake's -t option to build only the crypto target. Parameterize the
crypto target to have the right name depending on whether this is Mbed
TLS or PSA Crypto.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/tests/scripts/test_psa_compliance.py b/tests/scripts/test_psa_compliance.py
index 8102a88..4ba98dc 100755
--- a/tests/scripts/test_psa_compliance.py
+++ b/tests/scripts/test_psa_compliance.py
@@ -62,10 +62,15 @@
     in_psa_crypto_repo = build_tree.looks_like_psa_crypto_root(root_dir)
 
     if in_psa_crypto_repo:
-        crypto_lib_filename = \
-            library_build_dir + '/core/libpsacrypto.a'
+        crypto_name = 'psacrypto'
+        library_subdir = 'core'
     else:
-        crypto_lib_filename = library_build_dir + '/library/libmbedcrypto.a'
+        crypto_name = 'mbedcrypto'
+        library_subdir = 'library'
+
+    crypto_lib_filename = (library_build_dir + '/' +
+                           library_subdir + '/' +
+                           'lib' + crypto_name + '.a')
 
     if not os.path.exists(crypto_lib_filename):
         #pylint: disable=bad-continuation
@@ -74,7 +79,8 @@
                      '-GUnix Makefiles',
                      '-B', library_build_dir
         ])
-        subprocess.check_call(['cmake', '--build', library_build_dir])
+        subprocess.check_call(['cmake', '--build', library_build_dir,
+                               '-t', crypto_name])
 
     psa_arch_tests_dir = 'psa-arch-tests'
     os.makedirs(psa_arch_tests_dir, exist_ok=True)