<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# 
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

use strict;

my @target;
my $target;

while (&lt;&gt;) {
	chomp;
	/^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do {
		$target = {
			id =&gt; $1,
			board =&gt; $2,
			kernel =&gt; $3
		};
		push @target, $target;
	};
	/^Target-Name:\s*(.+)\s*$/ and $target-&gt;{name} = $1;
	/^Target-Path:\s*(.+)\s*$/ and $target-&gt;{path} = $1;
	/^Target-Arch:\s*(.+)\s*$/ and $target-&gt;{arch} = $1;
	/^Target-Features:\s*(.+)\s*$/ and do {
		my $f = [];
		$target-&gt;{features} = $f;
		@$f = split /\s+/, $1;
	};
	/^Target-Description:/ and do {
		my $desc;
		while (&lt;&gt;) {
			last if /^@@/;
			$desc .= $_;
		}
		$target-&gt;{desc} = $desc;
	};
	/^Linux-Version:\s*(.+)\s*$/ and $target-&gt;{version} = $1;
	/^Linux-Release:\s*(.+)\s*$/ and $target-&gt;{release} = $1;
	/^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target-&gt;{karch} = $1;
}

@target = sort {
	$a-&gt;{id} cmp $b-&gt;{id}
} @target;

foreach $target (@target) {
	my $conf = uc $target-&gt;{kernel}.'_'.$target-&gt;{board};
	$conf =~ tr/\.-/__/;
	print &lt;&lt;EOF
ifeq (\$(CONFIG_LINUX_$conf),y)
  define Target
    KERNEL:=$target-&gt;{kernel}
    BOARD:=$target-&gt;{board}
    LINUX_VERSION:=$target-&gt;{version}
    LINUX_RELEASE:=$target-&gt;{release}
    LINUX_KARCH:=$target-&gt;{karch}
  endef
endif

EOF
}
print "\$(eval \$(call Target))\n";
</pre></body></html>