blob: 73dede82b86da25cba0abbcf86039490c21e90cc [file] [log] [blame]
Kevin O'Connor0fd99532012-02-20 09:33:23 -05001#!/bin/sh
Kevin O'Connor952974e2008-11-16 18:14:33 -05002# Extract definitions from an assembler file. This is based on code
3# from the Linux Kernel.
4INFILE=$1
5OUTFILE=$2
6cat > "$OUTFILE" <<EOF
7// This is an auto-generated file. DO NOT EDIT!
8// Generated with "$0 $@"
9#ifndef __ASM_OFFSETS_H
10#define __ASM_OFFSETS_H
11EOF
12sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \
13 s:^->\([^ ]*\) [\$\#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
14 s:->::; p;}" < "$INFILE" >> "$OUTFILE"
15cat >> "$OUTFILE" <<EOF
16#endif // asm-offsets.h
17EOF