UAPI: Partition the header include path sets and add uapi/ header directories
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / x86 / kernel / cpu / mkcapflags.pl
CommitLineData
1b6b7c9f 1#!/usr/bin/perl -w
7414aa41
PA
2#
3# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
4#
5
6($in, $out) = @ARGV;
7
8open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";
9open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
10
abbf1590
DH
11print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
12print OUT "#include <asm/cpufeature.h>\n";
13print OUT "#endif\n";
14print OUT "\n";
7414aa41
PA
15print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
16
55f6cb9d
PA
17%features = ();
18$err = 0;
19
7414aa41
PA
20while (defined($line = <IN>)) {
21 if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
22 $macro = $1;
55f6cb9d 23 $feature = "\L$2";
7414aa41
PA
24 $tail = $3;
25 if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
55f6cb9d 26 $feature = "\L$1";
7414aa41
PA
27 }
28
55f6cb9d
PA
29 next if ($feature eq '');
30
31 if ($features{$feature}++) {
32 print STDERR "$in: duplicate feature name: $feature\n";
33 $err++;
7414aa41 34 }
1b6b7c9f 35 printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature;
7414aa41
PA
36 }
37}
38print OUT "};\n";
39
40close(IN);
41close(OUT);
55f6cb9d
PA
42
43if ($err) {
44 unlink($out);
45 exit(1);
46}
47
48exit(0);