Rework the way SCons recurses into subdirectories, making it

automatic.  The point is that now a subdirectory can be added
to the build process just by creating a SConscript file in it.
The process has two passes.  On the first pass, all subdirs
of the root of the tree are searched for SConsopts files.
These files contain any command line options that ought to be
added for a particular subdirectory.  On the second pass,
all subdirs of the src directory are searched for SConscript
files.  These files describe how to build any given subdirectory.
I have added a Source() function.  Any file (relative to the
directory in which the SConscript resides) passed to that
function is added to the build.  Clean up everything to take
advantage of Source().
function is added to the list of files to be built.

--HG--
extra : convert_revision : 103f6b490d2eb224436688c89cdc015211c4fd30
This commit is contained in:
Nathan Binkert
2007-03-10 23:00:54 -08:00
parent bf4dade64a
commit 1aef5c06a3
33 changed files with 1080 additions and 738 deletions

View File

@@ -30,54 +30,25 @@
# Steve Reinhardt
# Korey Sewell
import os
import sys
from os.path import isdir
Import('*')
# Import build environment variable from SConstruct.
Import('env')
if env['TARGET_ISA'] == 'mips':
Source('faults.cc')
Source('isa_traits.cc')
Source('utility.cc')
###################################################
#
# Define needed sources.
#
###################################################
if env['FULL_SYSTEM']:
#Insert Full-System Files Here
pass
else:
Source('process.cc')
# Base sources used by all configurations.
base_sources = Split('''
faults.cc
isa_traits.cc
utility.cc
''')
Source('linux/linux.cc')
Source('linux/process.cc')
# Full-system sources
full_system_sources = Split('''
#Insert Full-System Files Here
''')
# Syscall emulation (non-full-system) sources
syscall_emulation_sources = Split('''
linux/linux.cc
linux/process.cc
process.cc
''')
# Set up complete list of sources based on configuration.
sources = base_sources
if env['FULL_SYSTEM']:
sources += full_system_sources
else:
sources += syscall_emulation_sources
# Convert file names to SCons File objects. This takes care of the
# path relative to the top of the directory tree.
sources = [File(s) for s in sources]
# Add in files generated by the ISA description.
isa_desc_files = env.ISADesc('isa/main.isa')
# Only non-header files need to be compiled.
isa_desc_sources = [f for f in isa_desc_files if not f.path.endswith('.hh')]
sources += isa_desc_sources
Return('sources')
# Add in files generated by the ISA description.
isa_desc_files = env.ISADesc('isa/main.isa')
# Only non-header files need to be compiled.
for f in isa_desc_files:
if not f.path.endswith('.hh'):
Source(f)