blob: 8044f8c06f4aeee6bd4ee9bcf2c4f38d331ec68f [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/sh -e
2
3# Turn .config into a header file
4
5if [ -z "$1" ] ; then
6 echo "Usage: conf-header.sh <.config>"
7 exit 1
8fi
9
10cat <<EOF
11#if !defined _FEATURES_H && !defined __need_uClibc_config_h
12# error Never include <bits/uClibc_config.h> directly; use <features.h> instead
13#endif
14
15#define __UCLIBC_MAJOR__ ${MAJOR_VERSION}
16#define __UCLIBC_MINOR__ ${MINOR_VERSION}
17#define __UCLIBC_SUBLEVEL__ ${SUBLEVEL}
18EOF
19
20exec \
21sed \
22 -e '/^#$/d' \
23 -e '/^[^#]/s:^\([^=]*\)=\(.*\):#define __\1__ \2:' \
24 -e '/^#define /s: y$: 1:' \
25 -e '/^# .* is not set$/s:^# \(.*\) is not set$:#undef __\1__:' \
26 -e 's:^# \(.*\)$:/* \1 */:' \
27 $1