diff options
author | Felix Fietkau <nbd@openwrt.org> | 2006-11-11 23:11:02 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2006-11-11 23:11:02 +0000 |
commit | cf4e7af392186e57f213053a898c62cd9400b692 (patch) | |
tree | 1f8a2d1023ef2469dbd0e2040599b3c69807cf92 /scripts/gen_target_mk.pl | |
parent | 312802199b7cc09dde5ed867745f4c1baa3c5204 (diff) | |
download | mtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.zip mtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.tar.gz mtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.tar.bz2 |
make target/linux/* directories self-contained, use the selected kernel version for the toolchain, autogenerate menuconfig and makefile code for target selection
SVN-Revision: 5498
Diffstat (limited to 'scripts/gen_target_mk.pl')
-rwxr-xr-x | scripts/gen_target_mk.pl | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/gen_target_mk.pl b/scripts/gen_target_mk.pl new file mode 100755 index 0000000..52f2a5c --- /dev/null +++ b/scripts/gen_target_mk.pl @@ -0,0 +1,65 @@ +#!/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 (<>) { + chomp; + /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do { + $target = { + id => $1, + board => $2, + kernel => $3 + }; + push @target, $target; + }; + /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1; + /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1; + /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1; + /^Target-Features:\s*(.+)\s*$/ and do { + my $f = []; + $target->{features} = $f; + @$f = split /\s+/, $1; + }; + /^Target-Description:/ and do { + my $desc; + while (<>) { + last if /^@@/; + $desc .= $_; + } + $target->{desc} = $desc; + }; + /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1; + /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1; + /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1; +} + +@target = sort { + $a->{id} cmp $b->{id} +} @target; + +foreach $target (@target) { + my $conf = uc $target->{kernel}.'_'.$target->{board}; + $conf =~ tr/\.-/__/; + print <<EOF +ifeq (\$(CONFIG_LINUX_$conf),y) + define Target + KERNEL:=$target->{kernel} + BOARD:=$target->{board} + LINUX_VERSION:=$target->{version} + LINUX_RELEASE:=$target->{release} + LINUX_KARCH:=$target->{karch} + endef +endif + +EOF +} +print "\$(eval \$(call Target))\n"; |