xref: /arm-trusted-firmware/make_helpers/unix.mk (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu#
2*91f16700Schasinglulu# Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu#
4*91f16700Schasinglulu# SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu#
6*91f16700Schasinglulu
7*91f16700Schasinglulu# Trusted Firmware shell command definitions for a Unix style environment.
8*91f16700Schasinglulu
9*91f16700Schasingluluifndef UNIX_MK
10*91f16700Schasinglulu    UNIX_MK := $(lastword $(MAKEFILE_LIST))
11*91f16700Schasinglulu
12*91f16700Schasinglulu    ECHO_BLANK_LINE := echo
13*91f16700Schasinglulu    ECHO_QUIET := @\#
14*91f16700Schasinglulu
15*91f16700Schasinglulu    DIR_DELIM := /
16*91f16700Schasinglulu    PATH_SEP := :
17*91f16700Schasinglulu
18*91f16700Schasinglulu    # These defines provide Unix style equivalents of the shell commands
19*91f16700Schasinglulu    # required by the Trusted Firmware build environment.
20*91f16700Schasinglulu
21*91f16700Schasinglulu    # ${1} is the file to be copied.
22*91f16700Schasinglulu    # ${2} is the destination file name.
23*91f16700Schasinglulu    define SHELL_COPY
24*91f16700Schasinglulu	${Q}cp -f  "${1}"  "${2}"
25*91f16700Schasinglulu    endef
26*91f16700Schasinglulu
27*91f16700Schasinglulu    # ${1} is the directory to be copied.
28*91f16700Schasinglulu    # ${2} is the destination directory path.
29*91f16700Schasinglulu    define SHELL_COPY_TREE
30*91f16700Schasinglulu	${Q}cp -rf  "${1}"  "${2}"
31*91f16700Schasinglulu    endef
32*91f16700Schasinglulu
33*91f16700Schasinglulu    # ${1} is the file to be deleted.
34*91f16700Schasinglulu    define SHELL_DELETE
35*91f16700Schasinglulu	-${Q}rm -f  "${1}"
36*91f16700Schasinglulu    endef
37*91f16700Schasinglulu
38*91f16700Schasinglulu    # ${1} is a space delimited list of files to be deleted.
39*91f16700Schasinglulu    # Note that we do not quote ${1}, as multiple parameters may be passed.
40*91f16700Schasinglulu    define SHELL_DELETE_ALL
41*91f16700Schasinglulu	-${Q}rm -rf  ${1}
42*91f16700Schasinglulu    endef
43*91f16700Schasinglulu
44*91f16700Schasinglulu    # ${1} is the directory to be generated.
45*91f16700Schasinglulu    # ${2} is optional, and allows a prerequisite to be specified.
46*91f16700Schasinglulu    # Do nothing if $1 == $2, to ignore self dependencies.
47*91f16700Schasinglulu    define MAKE_PREREQ_DIR
48*91f16700Schasinglulu        ifneq (${1},${2})
49*91f16700Schasinglulu
50*91f16700Schasinglulu${1} : ${2}
51*91f16700Schasinglulu	${Q}mkdir -p  "${1}"
52*91f16700Schasinglulu
53*91f16700Schasinglulu        endif
54*91f16700Schasinglulu    endef
55*91f16700Schasinglulu
56*91f16700Schasinglulu    define SHELL_REMOVE_DIR
57*91f16700Schasinglulu	-${Q}rm -rf  "${1}"
58*91f16700Schasinglulu    endef
59*91f16700Schasinglulu
60*91f16700Schasingluluendif
61