summaryrefslogtreecommitdiff
path: root/extra/scripts/conf-header.sh
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-03-17 02:45:59 +0000
committerRob Landley <rob@landley.net>2007-03-17 02:45:59 +0000
commit046781273ed3fe210aa6f22807622e955c225a8a (patch)
treed7cfa994883fd9bc7a564b537412ba118179c575 /extra/scripts/conf-header.sh
parent15c32ee1161e15f6b32f0e41700ebe68b065a601 (diff)
Have Makefile.in call conf-header.sh instead of having kconfig call it
via system(). Also move it to extra/scripts since it's a uClibc build script, not part of upstream kconfig. Adjust the "grabbing a new kconfig snapshot" procedure accordingly.
Diffstat (limited to 'extra/scripts/conf-header.sh')
-rwxr-xr-xextra/scripts/conf-header.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/extra/scripts/conf-header.sh b/extra/scripts/conf-header.sh
new file mode 100755
index 000000000..90dfa999a
--- /dev/null
+++ b/extra/scripts/conf-header.sh
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+# Turn .config into a header file
+
+if [ -z "$1" ] ; then
+ echo "Usage: conf-header.sh <.config>"
+ exit 1
+fi
+
+cat <<EOF
+#if !defined __FEATURES_H && !defined __need_uClibc_config_h
+# error Never include <bits/uClibc_config.h> directly; use <features.h> instead
+#endif
+
+#define __UCLIBC_MAJOR__ ${MAJOR_VERSION}
+#define __UCLIBC_MINOR__ ${MINOR_VERSION}
+#define __UCLIBC_SUBLEVEL__ ${SUBLEVEL}
+EOF
+
+exec \
+sed \
+ -e '/^#$/d' \
+ -e '/^[^#]/s:^\([^=]*\)=\(.*\):#define __\1__ \2:' \
+ -e '/^#define /s: y$: 1:' \
+ -e '/^# .* is not set$/s:^# \(.*\) is not set$:#undef __\1__:' \
+ -e 's:^# \(.*\)$:/* \1 */:' \
+ $1