openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

bcm2c_linux.pl (803B)


      1 # 
      2 #
      3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 # 
      5 # Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 #
      7 # bcm2c - compile config.bcm into static code
      8 
      9 $|=1;
     10 open (BCMFILE, $ARGV[0]) || die " bcm2c: could not open .bcm file[$ARGV[0]]\n";
     11 
     12 print <<'EOT';
     13 /*
     14  * This file is automatically generated by bcm2c_linux.pl.  DO NOT EDIT!
     15  */
     16 #include <sal/appl/config.h>
     17 EOT
     18 $n_vars = 0;
     19 printf("void\nsal_config_init_defaults(void)\n{\n");
     20         printf("\t(void)sal_config_set\(\"os\", \"unix\"\)\;\n");
     21 while (<BCMFILE>) { 
     22     next if /#/;
     23     ($attr,$val) = split(/=/);
     24     chop $val;
     25     if(($attr ne "") && ($val ne "")){
     26 	printf("\tsal_config_set(\"$attr\",\"$val\");\n");
     27 	$n_vars++;
     28     }
     29 }
     30 print "}\n";