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