-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";
-}
-