Commit 4c6ca181 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add perl script for handling GCC makefile dependencies

Detail:
  Build/GCCDepend,102 - Script for handling the makefile dependencies generated by GCC4. It converts them to a format which AMU can understand.
Admin:
  Required in order to build the GCC-based tools once they're updated to GCC4


Version 1.63. Tagged as 'Library-1_63'
parent 5a7d354e
#!/usr/bin/env perl
#
# Copyright (c) 2013, RISC OS Open Ltd
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of RISC OS Open Ltd nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Process GCC's -MD output into something which AMU will understand
# Usage:
# GCCDepend <rule target>
my $target=shift @ARGV;
open(IN, "<!!Depend");
open(OUT, ">!Depend");
while(<IN>) {
chomp;
my @files = split;
for (@files) {
if ((substr($_,-1) ne ":") # Ignore the very first entry that specifies the target file
&& ($_ ne "\\") # Ignore continuation character
) {
my @folders = split(/\//); # Split on unix seperator
# Process the folder list to remove ..'s where possible
# Also convert any .'s in folder names to /'s
my @folders2;
for (@folders) {
if($_ eq "..") {
if(($#folders2 > 0) && ($folders[$#folders] ne "^")) {
$#folders2--;
} else {
push @folders2, "^";
}
} else {
s/\./\//g;
push @folders2, $_;
}
}
@folders = @folders2;
$folders[$#folders] = join('.',reverse(split(/\//,$folders[$#folders]))); # Convert file name to RISC OS format
$_ = join('.',@folders); # Construct RISC OS path
s/^[@.]+//; # Get rid of any leading @. or .
s/\/\$\$/.\$/; # Fix up any $'s
print OUT $target . ":\t" . $_ . "\n";
}
}
}
close(IN);
close(OUT);
unlink("!!Depend");
/* (1.62)
/* (1.63)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.62
#define Module_MajorVersion_CMHG 1.63
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Jul 2013
#define Module_Date_CMHG 29 Jul 2013
#define Module_MajorVersion "1.62"
#define Module_Version 162
#define Module_MajorVersion "1.63"
#define Module_Version 163
#define Module_MinorVersion ""
#define Module_Date "15 Jul 2013"
#define Module_Date "29 Jul 2013"
#define Module_ApplicationDate "15-Jul-13"
#define Module_ApplicationDate "29-Jul-13"
#define Module_ComponentName "Library"
#define Module_ComponentPath "mixed/RiscOS/Library"
#define Module_FullVersion "1.62"
#define Module_HelpVersion "1.62 (15 Jul 2013)"
#define Module_LibraryVersionInfo "1:62"
#define Module_FullVersion "1.63"
#define Module_HelpVersion "1.63 (29 Jul 2013)"
#define Module_LibraryVersionInfo "1:63"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment