1#!/usr/bin/env bash -
2#******************************************************************************
3#  * @attention
4#  *
5#  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
6#  * All rights reserved.</center></h2>
7#  *
8#  * This software component is licensed by ST under BSD 3-Clause license,
9#  * the "License"; You may not use this file except in compliance with the
10#  * License. You may obtain a copy of the License at:
11#  *                        opensource.org/licenses/BSD-3-Clause
12#  *
13#  ******************************************************************************
14# arg1 is the build directory
15# arg2 is the file to preprocess
16# arg3 is output file beeing preprocessed
17# arg4 is optional, it fixes compiler full path if present
18
19function preprocess
20(
21local compiler=armclang
22if [ $# -eq 4 ]; then
23    compiler=$4
24fi
25
26$compiler --target=arm-arm-none-eabi -march=armv8-m.main -E -P -xc -I$1 $2 -o $3
27)
28