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