3 # include/asm-sh/machtype.h header generation script for SuperH
5 # Copyright (C) 2003 Paul Mundt
7 # This is pretty much a quick and dirty hack based off of the awk
8 # script written by rmk that ARM uses to achieve the same sort of
11 # Unfortunately this script has a dependance on bash/sed/cut/tr,
12 # though they should be prevalent enough for this dependancy not
13 # to matter overly much.
15 # As a note for anyone attempting to manually invoke this script,
16 # it expects to be run straight out of the arch/sh/tools/ directory
17 # as it doesn't look at TOPDIR to figure out where asm-sh is
20 # See the note at the top of the generated header for additional
23 # Released under the terms of the GNU GPL v2.0.
26 [ $# -ne 1 ] && echo "Usage: $0 <mach defs>" && exit 1
30 * Automagically generated, don't touch.
32 #ifndef __ASM_SH_MACHTYPES_H
33 #define __ASM_SH_MACHTYPES_H
35 #include <linux/config.h>
38 * We'll use the following MACH_xxx defs for placeholders for the time
39 * being .. these will all go away once sh_machtype is assigned per-board.
41 * For now we leave things the way they are for backwards compatibility.
53 for entry in `cat $1 | sed -e 's/\#.*$//g;/^$/d' | tr '\t' ' ' | tr -s ' '`; do
54 board=`echo $entry | cut -f1 -d' '`
56 printf "#ifdef CONFIG_`echo $entry | cut -f2 -d' '`\n" >> tmp.h
57 printf " #define MACH_$board\t\t1\n#else\n #define MACH_$board\t\t0\n#endif\n" >> tmp.h
58 printf "#define mach_is_`echo $board | tr '[A-Z]' '[a-z]'`()\t\t\t(MACH_$board)\n" >> tmp2.h
61 printf "\n/* Machtype checks */\n" >> tmp.h
62 cat tmp2.h >> tmp.h && rm -f tmp2.h
66 #endif /* __ASM_SH_MACHTYPES_H */