Deleted Added
sdiff udiff text old ( 5385:658926ff82ed ) new ( 5396:0347e9a6d2c2 )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 51 unchanged lines hidden (view full) ---

60# 'm5' directory (or use -u or -C to tell scons where to find this
61# file), you can use 'scons -h' to print all the M5-specific build
62# options as well.
63#
64###################################################
65
66import sys
67import os
68
69from os.path import isdir, isfile, join as joinpath
70
71import SCons
72
73# Check for recent-enough Python and SCons versions. If your system's
74# default installation of Python is not recent enough, you can use a
75# non-default installation of the Python interpreter by either (1)
76# rearranging your PATH so that scons finds the non-default 'python'
77# first or (2) explicitly invoking an alternative interpreter on the
78# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
79EnsurePythonVersion(2,4)
80
81# Import subprocess after we check the version since it doesn't exist in
82# Python < 2.4.
83import subprocess
84
85# Ironically, SCons 0.96 dies if you give EnsureSconsVersion a
86# 3-element version number.
87min_scons_version = (0,96,91)
88try:
89 EnsureSConsVersion(*min_scons_version)
90except:
91 print "Error checking current SCons version."
92 print "SCons", ".".join(map(str,min_scons_version)), "or greater required."
93 Exit(2)
94
95
96# The absolute path to the current directory (where this file lives).
97ROOT = Dir('.').abspath
98
99# Path to the M5 source tree.
100SRCDIR = joinpath(ROOT, 'src')
101
102# tell python where to find m5 python code
103sys.path.append(joinpath(ROOT, 'src/python'))

--- 38 unchanged lines hidden (view full) ---

142
143# helper function: find last occurrence of element in list
144def rfind(l, elt, offs = -1):
145 for i in range(len(l)+offs, 0, -1):
146 if l[i] == elt:
147 return i
148 raise ValueError, "element not found"
149
150# helper function: compare dotted version numbers.
151# E.g., compare_version('1.3.25', '1.4.1')
152# returns -1, 0, 1 if v1 is <, ==, > v2
153def compare_versions(v1, v2):
154 # Convert dotted strings to lists
155 v1 = map(int, v1.split('.'))
156 v2 = map(int, v2.split('.'))
157 # Compare corresponding elements of lists
158 for n1,n2 in zip(v1, v2):
159 if n1 < n2: return -1
160 if n1 > n2: return 1
161 # all corresponding values are equal... see if one has extra values
162 if len(v1) < len(v2): return -1
163 if len(v1) > len(v2): return 1
164 return 0
165
166# Each target must have 'build' in the interior of the path; the
167# directory below this will determine the build parameters. For
168# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
169# recognize that ALPHA_SE specifies the configuration because it
170# follow 'build' in the bulid path.
171
172# Generate absolute paths to targets so we can see where the build dir is
173if COMMAND_LINE_TARGETS:

--- 639 unchanged lines hidden ---