1#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Include once
18ifneq ($(vts_run_on_host_mk_included),true)
19vts_run_on_host_mk_included := true
20
21ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
22LINKER = linker64
23else
24LINKER = linker
25endif
26
27ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
28# gtest needs ANDROID_DATA/local/tmp for death test output.
29# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
30# VTS itself should always work relative to ANDROID_DATA or ANDROID_ROOT.
31vts-prepare-run-on-host: $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT)/etc/hosts $(TARGET_OUT_EXECUTABLES)/sh
32	if [ ! -d /system ]; then \
33	  echo "Attempting to create /system"; \
34	  sudo mkdir -p -m 0777 /system; \
35	fi
36	echo "Attempting to create $(TARGET_OUT_DATA)/local/tmp if not exists"
37	mkdir -p $(TARGET_OUT_DATA)/local/tmp
38	ln -fs `realpath $(TARGET_OUT)/bin` /system/
39	ln -fs `realpath $(TARGET_OUT)/etc` /system/
40	ln -fs `realpath $(TARGET_OUT)/lib` /system/
41	if [ -d "$(TARGET_OUT)/lib64" ]; then \
42	  ln -fs `realpath $(TARGET_OUT)/lib64` /system/; \
43	fi
44endif
45endif