From b1355998c859cf4a1531b1035ca0ccb4a9e97409 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 13 Apr 2021 09:04:40 +0200 Subject: prepare for switch to config.h instead of CFLAGS defines --- script/conf2h.awk | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 script/conf2h.awk (limited to 'script/conf2h.awk') diff --git a/script/conf2h.awk b/script/conf2h.awk new file mode 100644 index 0000000..818beea --- /dev/null +++ b/script/conf2h.awk @@ -0,0 +1,35 @@ +#! /usr/bin/gawk -f +# +# Copyright 2021 AG Eingebettete Softwaresysteme, Universität Osnabrück +# +# SPDX-License-Identicier: CC0-1.0 + +BEGIN { + print "// config.h generated from " ARGV[1] "\n" \ + "#ifndef CONFIG_H\n" \ + "#define CONFIG_H" +} + +/^CONFIG_.*?_INSTANCES=/ { next } + +/^#/ { sub(/^#/,"//") } + +/^CONFIG_.*?=/ { + if (/=n$/) { + sub(/^/,"// "); + } else { + sub(/^/,"#define ") + if (/=y$/) { + sub(/=.*$/,"") + } else if (/=".*"$/) { + sub(/="/, " ") + sub(/"$/, "") + } else { + sub(/=/," ") + } + } +} + +{ print } + +END { print "#endif" } -- cgit v1.2.3