my ($target, @target, $profile);
while (<>) {
chomp;
- /^Target:\s*((.+)-(\d+\.\d+))\s*$/ and do {
- my $conf = uc $3.'_'.$2;
- $conf =~ tr/\.-/__/;
+ /^Target:\s*(.+)\s*$/ and do {
+ my $conf = $1;
+ $conf =~ tr#/\.\-/#___#;
$target = {
id => $1,
conf => $conf,
- board => $2,
- kernel => $3,
profiles => []
};
push @target, $target;
};
+ /^Target-Board:\s*(.+)\s*$/ and $target->{board} = $1;
+ /^Target-Kernel:\s*(\d+\.\d+)\s*$/ and $target->{kernel} = $1;
/^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1;
/^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1;
/^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1;
return sort(@l);
}
-sub gen_target_mk() {
- my @target = parse_target_metadata();
-
- @target = sort {
- $a->{id} cmp $b->{id}
- } @target;
-
- foreach my $target (@target) {
- my ($profiles_def, $profiles_eval);
- my $conf = uc $target->{kernel}.'_'.$target->{board};
- $conf =~ tr/\.-/__/;
-
- foreach my $profile (@{$target->{profiles}}) {
- $profiles_def .= "
- define Profile/$conf\_$profile->{id}
- ID:=$profile->{id}
- NAME:=$profile->{name}
- PACKAGES:=".join(" ", merge_package_lists($target->{packages}, $profile->{packages}))."\n";
- $profile->{kconfig} and $profiles_def .= " KCONFIG:=1\n";
- $profiles_def .= " endef";
- $profiles_eval .= "
-\$(eval \$(call AddProfile,$conf\_$profile->{id}))"
- }
- print "
-ifeq (\$(CONFIG_LINUX_$conf),y)
- define Target
- KERNEL:=$target->{kernel}
- BOARD:=$target->{board}
- BOARDNAME:=$target->{name}
- LINUX_VERSION:=$target->{version}
- LINUX_RELEASE:=$target->{release}
- LINUX_KARCH:=$target->{karch}
- DEFAULT_PACKAGES:=".join(" ", @{$target->{packages}})."
- endef$profiles_def
-endif$profiles_eval
-
-"
- }
- print "\$(eval \$(call Target))\n";
-}
-
sub target_config_features(@) {
my $ret;
print <<EOF;
choice
prompt "Target System"
- default LINUX_2_4_BRCM
+ default TARGET_brcm_2_4
reset if !DEVEL
EOF
}
print <<EOF
-config LINUX_$target->{conf}
+config TARGET_$target->{conf}
bool "$target->{name}"
select $target->{arch}
select LINUX_$kernel
}
print <<EOF;
-if DEVEL
-
-config LINUX_2_6_ARM
- bool "UNSUPPORTED little-endian arm platform"
- depends BROKEN
- select LINUX_2_6
- select arm
-
-config LINUX_2_6_CRIS
- bool "UNSUPPORTED cris platform"
- depends BROKEN
- select LINUX_2_6
- select cris
-
-config LINUX_2_6_M68K
- bool "UNSUPPORTED m68k platform"
- depends BROKEN
- select LINUX_2_6
- select m68k
-
-config LINUX_2_6_SH3
- bool "UNSUPPORTED little-endian sh3 platform"
- depends BROKEN
- select LINUX_2_6
- select sh3
-
-config LINUX_2_6_SH3EB
- bool "UNSUPPORTED big-endian sh3 platform"
- depends BROKEN
- select LINUX_2_6
- select sh3eb
-
-config LINUX_2_6_SH4
- bool "UNSUPPORTED little-endian sh4 platform"
- depends BROKEN
- select LINUX_2_6
- select sh4
-
-config LINUX_2_6_SH4EB
- bool "UNSUPPORTED big-endian sh4 platform"
- depends BROKEN
- select LINUX_2_6
- select sh4eb
-
-config LINUX_2_6_SPARC
- bool "UNSUPPORTED sparc platform"
- depends BROKEN
- select LINUX_2_6
- select sparc
-
-endif
-
endchoice
+config TARGET_BOARD
+ string
+EOF
+ foreach my $target (@target) {
+ print "\t\tdefault \"".$target->{board}."\" if TARGET_".$target->{conf}."\n";
+ }
+ print <<EOF;
+
choice
prompt "Target Profile"
foreach my $profile (@$profiles) {
print <<EOF;
-config LINUX_$target->{conf}_$profile->{id}
+config TARGET_$target->{conf}_$profile->{id}
bool "$profile->{name}"
- depends LINUX_$target->{conf}
+ depends TARGET_$target->{conf}
$profile->{config}
EOF
$profile->{kconfig} and print "\tselect PROFILE_KCONFIG\n";
}
if ($config) {
print "package-$config += $pkg->{subdir}$pkg->{src}\n";
- $pkg->{prereq} and print "prereq-$config += $pkg->{src}\n";
+ $pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
}
my $hasdeps = 0;
undef $idx if $idx =~ /^(kernel)|(base-files)$/;
if ($idx) {
next if $dep{$pkg->{src}."->".$idx};
- $depline .= " $idx\-compile";
+ $depline .= " \$(curdir)/$idx/compile";
$dep{$pkg->{src}."->".$idx} = 1;
}
}
if ($depline) {
- $line .= $pkg->{subdir}."$pkg->{src}-compile: $depline\n";
+ $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/compile += $depline\n";
}
}
) > \$@
ifneq (\$(UCI_PRECONFIG)\$(CONFIG_UCI_PRECONFIG),)
- preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
+ package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
endif
EOF
}
sub parse_command() {
my $cmd = shift @ARGV;
for ($cmd) {
- /^target_mk$/ and return gen_target_mk();
/^target_config$/ and return gen_target_config();
/^package_mk$/ and return gen_package_mk();
/^package_config$/ and return gen_package_config();
}
print <<EOF
Available Commands:
- $0 target_mk [file] Target metadata in makefile format
$0 target_config [file] Target metadata in Kconfig format
$0 package_mk [file] Package metadata in makefile format
$0 package_config [file] Package metadata in Kconfig format