Blame view
arch/arm/tools/gen-mach-types
2.03 KB
1da177e4c
|
1 2 |
#!/bin/awk # |
66206536f
|
3 |
# Awk script to generate include/generated/mach-types.h |
1da177e4c
|
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# BEGIN { nr = 0 } /^#/ { next } /^[ ]*$/ { next } NF == 4 { machine_is[nr] = "machine_is_"$1; config[nr] = "CONFIG_"$2; mach_type[nr] = "MACH_TYPE_"$3; num[nr] = $4; nr++ } NF == 3 { machine_is[nr] = "machine_is_"$1; config[nr] = "CONFIG_"$2; mach_type[nr] = "MACH_TYPE_"$3; num[nr] = ""; nr++ } END { printf("/* "); printf(" * This was automagically generated from %s! ", FILENAME); printf(" * Do NOT edit "); printf(" */ "); printf("#ifndef __ASM_ARM_MACH_TYPE_H "); printf("#define __ASM_ARM_MACH_TYPE_H "); |
1da177e4c
|
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
printf("#ifndef __ASSEMBLY__ "); printf("/* The type of machine we're running on */ "); printf("extern unsigned int __machine_arch_type; "); printf("#endif "); printf("/* see arch/arm/kernel/arch.c for a description of these */ "); for (i = 0; i < nr; i++) if (num[i] ~ /..*/) printf("#define %-30s %d ", mach_type[i], num[i]); printf(" "); for (i = 0; i < nr; i++) if (num[i] ~ /..*/) { printf("#ifdef %s ", config[i]); printf("# ifdef machine_arch_type "); printf("# undef machine_arch_type "); printf("# define machine_arch_type\t__machine_arch_type "); printf("# else "); printf("# define machine_arch_type\t%s ", mach_type[i]); printf("# endif "); printf("# define %s()\t(machine_arch_type == %s) ", machine_is[i], mach_type[i]); printf("#else "); printf("# define %s()\t(0) ", machine_is[i]); printf("#endif "); } printf("/* * These have not yet been registered */ "); for (i = 0; i < nr; i++) if (num[i] !~ /..*/) printf("/* #define %-30s <<not registered>> */ ", mach_type[i]); for (i = 0; i < nr; i++) if (num[i] !~ /..*/) { printf("#define %s()\t(0) ", machine_is[i]); } printf(" #ifndef machine_arch_type "); printf("#define machine_arch_type\t__machine_arch_type "); printf("#endif "); printf("#endif "); } |