lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #!/bin/sh -e |
| 2 | |
| 3 | # Turn .config into a header file |
| 4 | |
| 5 | if [ -z "$1" ] ; then |
| 6 | echo "Usage: conf-header.sh <.config>" |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | cat <<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} |
| 18 | EOF |
| 19 | |
| 20 | exec \ |
| 21 | sed \ |
| 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 |