1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/genconfigheader/genconfigheader.sh
Marian Buschsieweke 906e2c3234
build system: document riotbuid.h
This adds a `riotbuild-prefix.h` that is added to the `riotbuild.h`
and processed by Doxygen. It solves two problems:

1. The pre-defined macros where previously fully undocumented, but
   may be useful to real world applications
2. It provides a place where backward compatibility aliases can be
   added with a deprecation notice
2024-09-28 18:32:49 +02:00

49 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (C) 2016 Eistec AB
#
# This file is subject to the terms and conditions of the GNU Lesser General
# Public License v2.1. See the file LICENSE in the top level directory for more
# details.
#
# Usage: $0 [CFLAGS]...
#
# Extract all macros from CFLAGS and generate a header file format"
#
# exit on any errors below this line
set -e
echo "/* DO NOT edit this file, your changes will be overwritten and won't take any effect! */"
echo "/* Generated from CFLAGS: $@ */"
cat "$(dirname "$0")/riotbuild-prefix.h.in"
[ -n "${LTOFLAGS}" ] && echo "/* LTOFLAGS=${LTOFLAGS} */"
for arg in "$@"; do
case ${arg} in
-D*)
# Strip leading -D
d=${arg#-D}
if [ -z "${d##*=*}" ]; then
# key=value pairs
key=${d%%=*}
value=${d#*=}
echo "#define $key $value"
else
# simple #define
echo "#define $d 1"
fi
;;
-U*)
# Strip leading -U
d=${arg#-U}
echo "#undef $d"
;;
*)
continue
;;
esac
done