SConscript revision 4494
12207SN/A# -*- mode:python -*-
25254Sksewell@umich.edu
35254Sksewell@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan
42207SN/A# All rights reserved.
55254Sksewell@umich.edu#
65254Sksewell@umich.edu# Redistribution and use in source and binary forms, with or without
75254Sksewell@umich.edu# modification, are permitted provided that the following conditions are
85254Sksewell@umich.edu# met: redistributions of source code must retain the above copyright
95254Sksewell@umich.edu# notice, this list of conditions and the following disclaimer;
105254Sksewell@umich.edu# redistributions in binary form must reproduce the above copyright
115254Sksewell@umich.edu# notice, this list of conditions and the following disclaimer in the
125254Sksewell@umich.edu# documentation and/or other materials provided with the distribution;
135254Sksewell@umich.edu# neither the name of the copyright holders nor the names of its
145254Sksewell@umich.edu# contributors may be used to endorse or promote products derived from
152207SN/A# this software without specific prior written permission.
165254Sksewell@umich.edu#
175254Sksewell@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
185254Sksewell@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
195254Sksewell@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
205254Sksewell@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
215254Sksewell@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225254Sksewell@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235254Sksewell@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245254Sksewell@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255254Sksewell@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265254Sksewell@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272665Ssaidi@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285254Sksewell@umich.edu#
295254Sksewell@umich.edu# Authors: Nathan Binkert
305254Sksewell@umich.edu
312207SN/Aimport os, subprocess
322207SN/A
3311793Sbrandon.potter@amd.comImport('env')
3411793Sbrandon.potter@amd.com
352474SN/Aelf_files = []
368229Snate@binkert.orgdef ElfFile(filename):
372454SN/A    elf_files.append(File(filename))
3812334Sgabeblack@google.com    
392680Sktlim@umich.eduElfFile('elf_begin.c')
408232Snate@binkert.orgElfFile('elf_cntl.c')
416650Sksewell@umich.eduElfFile('elf_data.c')
4212431Sgabeblack@google.comElfFile('elf_end.c')
4311854Sbrandon.potter@amd.comElfFile('elf_fill.c')
446650Sksewell@umich.eduElfFile('elf_flag.c')
456650Sksewell@umich.eduElfFile('elf_getarhdr.c')
4611800Sbrandon.potter@amd.comElfFile('elf_getarsym.c')
472474SN/AElfFile('elf_getbase.c')
482207SN/AElfFile('elf_getident.c')
492447SN/AElfFile('elf_hash.c')
502474SN/AElfFile('elf_kind.c')
512447SN/AElfFile('elf_memory.c')
5212431Sgabeblack@google.comElfFile('elf_next.c')
5312448Sgabeblack@google.comElfFile('elf_phnum.c')
5412448Sgabeblack@google.comElfFile('elf_rand.c')
5512432Sgabeblack@google.comElfFile('elf_rawfile.c')
562474SN/AElfFile('elf_scn.c')
5712441Sgabeblack@google.comElfFile('elf_shnum.c')
582686Sksewell@umich.eduElfFile('elf_shstrndx.c')
592686Sksewell@umich.eduElfFile('elf_strptr.c')
6011905SBrandon.Potter@amd.comElfFile('elf_update.c')
6111905SBrandon.Potter@amd.comElfFile('elf_version.c')
6211905SBrandon.Potter@amd.comElfFile('gelf_checksum.c')
632474SN/AElfFile('gelf_dyn.c')
642474SN/AElfFile('gelf_ehdr.c')
6511905SBrandon.Potter@amd.comElfFile('gelf_fsize.c')
662474SN/AElfFile('gelf_getclass.c')
672686Sksewell@umich.eduElfFile('gelf_phdr.c')
6811905SBrandon.Potter@amd.comElfFile('gelf_rel.c')
6911905SBrandon.Potter@amd.comElfFile('gelf_rela.c')
7011905SBrandon.Potter@amd.comElfFile('gelf_shdr.c')
712686Sksewell@umich.eduElfFile('gelf_sym.c')
726811SMatt DeVuystElfFile('gelf_symshndx.c')
7311905SBrandon.Potter@amd.comElfFile('gelf_xlate.c')
7411905SBrandon.Potter@amd.comElfFile('libelf.c')
7511905SBrandon.Potter@amd.comElfFile('libelf_align.c')
7611905SBrandon.Potter@amd.comElfFile('libelf_allocate.c')
772474SN/AElfFile('libelf_ar.c')
782474SN/AElfFile('libelf_checksum.c')
792474SN/AElfFile('libelf_data.c')
8011851Sbrandon.potter@amd.comElfFile('libelf_ehdr.c')
812474SN/AElfFile('libelf_extended.c')
8211851Sbrandon.potter@amd.comElfFile('libelf_phdr.c')
836650Sksewell@umich.eduElfFile('libelf_shdr.c')
8410318Sandreas.hansson@arm.comElfFile('libelf_xlate.c')
852474SN/A
865958Sgblack@eecs.umich.eduElfFile('libelf_convert.c')
876811SMatt DeVuystElfFile('libelf_fsize.c')
886650Sksewell@umich.eduElfFile('libelf_msize.c')
8911851Sbrandon.potter@amd.com
906650Sksewell@umich.edum4env = Environment(ENV=os.environ)
916811SMatt DeVuystif env.get('CC'):
926811SMatt DeVuyst    m4env['CC'] = env['CC']
9311389Sbrandon.potter@amd.comif env.get('CXX'):
9411389Sbrandon.potter@amd.com    m4env['CXX'] = env['CXX']
9511389Sbrandon.potter@amd.com# If we have gm4 use it
966650Sksewell@umich.eduif subprocess.Popen("gm4 --version", shell=True, stdout=subprocess.PIPE, 
976650Sksewell@umich.edu                     stderr=subprocess.STDOUT, close_fds=True).communicate()[0].find('GNU') >= 0:
986650Sksewell@umich.edu    m4env['M4'] = 'gm4'
996811SMatt DeVuyst
1006811SMatt DeVuystm4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path)
1016811SMatt DeVuystm4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET'
1026811SMatt DeVuystm4env.M4(target=File('libelf_convert.c'),
1036811SMatt DeVuyst         source=[File('elf_types.m4'), File('libelf_convert.m4')])
1046811SMatt DeVuystm4env.M4(target=File('libelf_fsize.c'),
1056811SMatt DeVuyst         source=[File('elf_types.m4'), File('libelf_fsize.m4')])
10610318Sandreas.hansson@arm.comm4env.M4(target=File('libelf_msize.c'),
1076811SMatt DeVuyst         source=[File('elf_types.m4'), File('libelf_msize.m4')])
1086811SMatt DeVuystm4env.Library('elf', elf_files)
1096811SMatt DeVuyst
1106811SMatt DeVuystenv.Append(CPPPATH=Dir('.'))
1116811SMatt DeVuystenv.Append(LIBS=['elf'])
1126811SMatt DeVuystenv.Append(LIBPATH=[Dir('.')])
1136811SMatt DeVuyst
1146811SMatt DeVuyst