Wolfgang Denk | 81aa2eb | 2010-10-26 00:08:35 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Adapted from Linux kernel's "Kbuild": |
| 4 | # commit 1cdf25d704f7951d02a04064c97db547d6021872 |
| 5 | # Author: Christoph Lameter <clameter@sgi.com> |
| 6 | |
| 7 | mkdir -p $(dirname $2) |
| 8 | |
| 9 | # Default sed regexp - multiline due to syntax constraints |
| 10 | SED_CMD="/^->/{s:->#\(.*\):/* \1 */:; \ |
Wolfgang Denk | 5ddc3c4 | 2010-10-27 08:31:42 +0200 | [diff] [blame] | 11 | s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 (\2) /* \3 */:; \ |
| 12 | s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ |
Wolfgang Denk | 81aa2eb | 2010-10-26 00:08:35 +0200 | [diff] [blame] | 13 | s:->::; p;}" |
| 14 | |
| 15 | (set -e |
| 16 | echo "#ifndef __ASM_OFFSETS_H__" |
| 17 | echo "#define __ASM_OFFSETS_H__" |
| 18 | echo "/*" |
| 19 | echo " * DO NOT MODIFY." |
| 20 | echo " *" |
| 21 | echo " * This file was generated by $(basename $0)" |
| 22 | echo " *" |
| 23 | echo " */" |
| 24 | echo "" |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame^] | 25 | sed -ne "${SED_CMD}" $1 |
Wolfgang Denk | 81aa2eb | 2010-10-26 00:08:35 +0200 | [diff] [blame] | 26 | echo "" |
| 27 | echo "#endif" ) > $2 |