source: trunk/tools/parse-config @ 8192

Letzte Änderung dieser Datei seit 8192 war 8137, erstellt von kriegaex vor 4 Jahren

A little trick to make the error message less cryptic if command line argument
for parse-config is a non-existent file. Now it looks like this:

$ tools/parse-config ConfigXXX.in
# INCLUDE_BEGIN ConfigXXX.in
Cannot open include file ConfigXXX.in in tools/parse-config
No such file or directory at tools/parse-config line 22.
  • Eigenschaft svn:executable auf * gesetzt
Dateigröße: 1.2 KB
Zeile 
1#!/usr/bin/perl
2# Consolidate a hierarchy of kconfig menu config files (Config.in) into one file
3# Record list of files for make
4
5use strict;
6use warnings;
7
8# Macro name for file list
9my $deps_name = 'deps_config_cache';
10# File name for file list
11my $deps_file = 'include/config/cache.conf.cmd';
12# Temporary file name for file list
13my $deps_file_tmp = '.tmpcache.conf.cmd';
14
15my $fh_deps;
16
17sub expand {
18  my $file = shift;
19  my $parent_file = shift;
20  print "# INCLUDE_BEGIN $file\n";
21
22  open(my $fh, '<', $file) or die "Cannot open include file $file in $parent_file\n$!";
23  print $fh_deps " \\\n\t$file";
24  while (<$fh>) {
25    if (/^\s*source\s+(.+)$/) {
26      # For each kconfig "source" statement, recursively read sub-file
27      expand($1, $file);
28    } else {
29      # Print all other lines normally
30      print;
31    }
32  }
33  close($fh) or die $!;
34
35  # Avoid kconfig "prompt redefined" warning on missing LF at EOF
36  print "\n";
37  print "# INCLUDE_END $file\n";
38}
39
40open ($fh_deps, '>', $deps_file_tmp) or die $!;
41print $fh_deps "$deps_name :=";
42expand($_, $0) for @ARGV;
43print $fh_deps "\n\n\$($deps_name): ;\n";
44close ($fh_deps) or die $!;
45rename ($deps_file_tmp, $deps_file) or die $!;
Hinweis: Hilfe zum Repository-Browser finden Sie in TracBrowser.