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
Gaëtan Harter cc63d2d21c
genconfigheader: use lazysponge for file management
Remove file management from `genconfigheader` script and use `lazysponge` in
Makefile.include.

Use --verbose option when in non QUIET building mode.
2018-08-20 11:34:55 +02:00

48 lines
989 B
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: $@ */"
[ -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