Annotation of uae/src/od-amiga/scc, revision 1.1.1.1

1.1       root        1: #!/bin/perl
                      2: #
                      3: # This is a small perl script that emulates gcc with the
                      4: # SAS/C compiler. It is mainly created to compile UAE
                      5: # with SAS/C to test 68060 optimisations.
                      6: #
                      7: # (c) 1997 by Samuel Devulder.
                      8: #
                      9: 
                     10: # dir used so that links are properly handled by SAS/C
                     11: $LNDIR = "scc-idir";
                     12: 
                     13: # replace all filenames that actually are links
                     14: for($i=0;$i<=$#ARGV;++$i) {
                     15:     $_ = $ARGV[$i];
                     16:     if(/\/[^\/]+$/ && -l $`) {
                     17:         $_=readlink($`).$&;
                     18:     }
                     19:     $ARGV[$i] = $_;
                     20: }
                     21: 
                     22: # create link-dir so that SAS/C can handle header files stored
                     23: # in linked directories.
                     24: if(! -d $LNDIR) {
                     25:      mkdir($LNDIR,0777);
                     26:      while(<*>) {
                     27:          next if ! -l $_;
                     28:          $linkname = $_;
                     29:          $realname = readlink($_); $realname =~ s/[.][.]//g;
                     30:          if(-d $linkname) {
                     31:              mkdir("$LNDIR/$linkname",0777);
                     32:              while(<$linkname/*.h>) {
                     33:                 open(OUT,">$LNDIR/$_");
                     34:                 s/^.*\///;
                     35:                 print OUT "#include \"$realname/$_\"\n";
                     36:                 close OUT;
                     37:              }
                     38:          } else {
                     39:             open(OUT,">$LNDIR/$linkname");
                     40:             print OUT "#include \"$realname\"\n";
                     41:             close OUT;
                     42:          }
                     43:      }
                     44: }
                     45: 
                     46: # build general command-line
                     47: $_ = " @ARGV";
                     48: 
                     49: # if preprocess, then use gnu/cpp since pponly in SAS/C
                     50: # does not signal missing .h files.
                     51: if(/\s+-E/) {
                     52:          exit system("cpp -DAMIGA -nostdinc -I\/include -D__SASC$_");
                     53: }
                     54: 
                     55: # fast but not perfect unix-to-amiga path translation 
                     56: s/[.][.]//g;
                     57: s/[.][\/]//g;
                     58: 
                     59: # if no destination, then assume a.out
                     60: $_ .= " -o a.out" if !/\s-[cEo]/;
                     61: 
                     62: # command-line modification
                     63: s/\s+-I\s*/ IDIR=/g;                # process include dirs
                     64: s/\s+-o/ OBJNAME/g;                 # process output file
                     65: s/\s+-g/ DBG FF/g;                  # process debug 
                     66: s/\s+-lm/ MATH=STD/g;               # math library
                     67: s/\s+-l\s*(\w+)/ LIB=LIB:$1.lib/g;  # other librarys
                     68: s/\s+-D\s*/ DEF=/g;                 # preprocessor defines
                     69: s/\s+-traditional-cpp//g;           # 
                     70: s/\s+-m(\w+)/ CPU=$1/g;          # specific cpu code generation
                     71: s/\s+-O./ OPT OPTSCHED OPTTIME/g;   # optimize ?
                     72: 
                     73: # use NOLINK (-c was found) or LINK TO ?
                     74: !s/\s+-E/ PPONLY/g && !s/\s+-c/ NOLINK/g && s/OBJNAME/LINK TO/;
                     75: 
                     76: # build amigaos command-line with extra defs
                     77: $_ = "sc IDIR=$LNDIR$_ DEF=AMIGA DEF=_OFF_T DATA=FAR CODE=FAR PARAM=B NOSTKCHK NOICON NOVERBOSE IGN=64,84,85,93,100,181,306,315,316 BATCH";
                     78: 
                     79: # if -d is present, display the executed command-line
                     80: s/\s+-d//g && print STDERR "=> $_\n";
                     81: 
                     82: # call SAS/C
                     83: $res = system("$_")/256;
                     84: 
                     85: # Link failed, say something so that configure script can
                     86: # see it.
                     87: if($res == 3) {print STDERR "link failed\n";$res=21;}
                     88: 
                     89: exit $res;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.