conf-header.sh 623 B

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