Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | #!/bin/awk |
| 2 | # |
| 3 | # Awk script to generate include/asm-sh/machtypes.h |
| 4 | # Heavily based on arch/arm/tools/gen-mach-types |
| 5 | # |
| 6 | BEGIN { nr = 0 } |
| 7 | /^#/ { next } |
| 8 | /^[ ]*$/ { next } |
| 9 | |
| 10 | NF == 2 { |
| 11 | mach[nr] = $1; |
| 12 | config[nr] = "CONFIG_"$2; |
| 13 | nr++; |
| 14 | } |
| 15 | |
| 16 | END { |
| 17 | printf("/*\n"); |
| 18 | printf(" * Automagically generated, don't touch.\n"); |
| 19 | printf(" */\n"); |
| 20 | printf("#ifndef __ASM_SH_MACHTYPES_H\n"); |
| 21 | printf("#define __ASM_SH_MACHTYPES_H\n"); |
| 22 | printf("\n"); |
| 23 | printf("#include <linux/config.h>\n"); |
| 24 | printf("\n"); |
| 25 | printf("/*\n"); |
| 26 | printf(" * We'll use the following MACH_xxx defs for placeholders for the time\n"); |
| 27 | printf(" * being .. these will all go away once sh_machtype is assigned per-board.\n"); |
| 28 | printf(" *\n"); |
| 29 | printf(" * For now we leave things the way they are for backwards compatibility.\n"); |
| 30 | printf(" */\n"); |
| 31 | printf("\n"); |
| 32 | printf("/* Mach types */\n"); |
| 33 | |
| 34 | for (i = 0; i < nr; i++) { |
| 35 | printf("#ifdef %s\n", config[i]); |
| 36 | printf(" #define MACH_%s\t\t1\n", mach[i]); |
| 37 | printf("#else\n"); |
| 38 | printf(" #define MACH_%s\t\t0\n", mach[i]); |
| 39 | printf("#endif\n"); |
| 40 | } |
| 41 | |
| 42 | printf("\n"); |
| 43 | printf("/* Machtype checks */\n"); |
| 44 | for (i = 0; i < nr; i++) |
| 45 | printf("#define mach_is_%s()\t\t\t(MACH_%s)\n", |
| 46 | tolower(mach[i]), mach[i]); |
| 47 | printf("\n"); |
| 48 | printf("#endif /* __ASM_SH_MACHTYPES_H */\n"); |
| 49 | } |