2
0

gen_target_mk.pl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/perl
  2. #
  3. # Copyright (C) 2006 OpenWrt.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. use strict;
  9. my @target;
  10. my $target;
  11. while (<>) {
  12. chomp;
  13. /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do {
  14. $target = {
  15. id => $1,
  16. board => $2,
  17. kernel => $3
  18. };
  19. push @target, $target;
  20. };
  21. /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1;
  22. /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1;
  23. /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1;
  24. /^Target-Features:\s*(.+)\s*$/ and do {
  25. my $f = [];
  26. $target->{features} = $f;
  27. @$f = split /\s+/, $1;
  28. };
  29. /^Target-Description:/ and do {
  30. my $desc;
  31. while (<>) {
  32. last if /^@@/;
  33. $desc .= $_;
  34. }
  35. $target->{desc} = $desc;
  36. };
  37. /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
  38. /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
  39. /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
  40. }
  41. @target = sort {
  42. $a->{id} cmp $b->{id}
  43. } @target;
  44. foreach $target (@target) {
  45. my $conf = uc $target->{kernel}.'_'.$target->{board};
  46. $conf =~ tr/\.-/__/;
  47. print <<EOF
  48. ifeq (\$(CONFIG_LINUX_$conf),y)
  49. define Target
  50. KERNEL:=$target->{kernel}
  51. BOARD:=$target->{board}
  52. LINUX_VERSION:=$target->{version}
  53. LINUX_RELEASE:=$target->{release}
  54. LINUX_KARCH:=$target->{karch}
  55. endef
  56. endif
  57. EOF
  58. }
  59. print "\$(eval \$(call Target))\n";