SConscript revision 6168
12155SN/A# -*- mode:python -*- 22155SN/A 32155SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan 42155SN/A# All rights reserved. 52155SN/A# 62155SN/A# Redistribution and use in source and binary forms, with or without 72155SN/A# modification, are permitted provided that the following conditions are 82155SN/A# met: redistributions of source code must retain the above copyright 92155SN/A# notice, this list of conditions and the following disclaimer; 102155SN/A# redistributions in binary form must reproduce the above copyright 112155SN/A# notice, this list of conditions and the following disclaimer in the 122155SN/A# documentation and/or other materials provided with the distribution; 132155SN/A# neither the name of the copyright holders nor the names of its 142155SN/A# contributors may be used to endorse or promote products derived from 152155SN/A# this software without specific prior written permission. 162155SN/A# 172155SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182155SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192155SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202155SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212155SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222155SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232155SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242155SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252155SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262155SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272155SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 292665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 302155SN/A 312155SN/Aimport os, subprocess 322155SN/A 332155SN/AImport('main') 342155SN/A 352155SN/Aelf_files = [] 362155SN/Adef ElfFile(filename): 372178SN/A elf_files.append(File(filename)) 382178SN/A 392178SN/AElfFile('elf_begin.c') 402178SN/AElfFile('elf_cntl.c') 412178SN/AElfFile('elf_data.c') 422178SN/AElfFile('elf_end.c') 432178SN/AElfFile('elf_fill.c') 442178SN/AElfFile('elf_flag.c') 452178SN/AElfFile('elf_getarhdr.c') 462178SN/AElfFile('elf_getarsym.c') 472178SN/AElfFile('elf_getbase.c') 482178SN/AElfFile('elf_getident.c') 492155SN/AElfFile('elf_hash.c') 502178SN/AElfFile('elf_kind.c') 512155SN/AElfFile('elf_memory.c') 522155SN/AElfFile('elf_next.c') 532178SN/AElfFile('elf_phnum.c') 542155SN/AElfFile('elf_rand.c') 552155SN/AElfFile('elf_rawfile.c') 562623SN/AElfFile('elf_scn.c') 572623SN/AElfFile('elf_shnum.c') 582623SN/AElfFile('elf_shstrndx.c') 592623SN/AElfFile('elf_strptr.c') 602623SN/AElfFile('elf_update.c') 612155SN/AElfFile('elf_version.c') 622155SN/AElfFile('gelf_checksum.c') 632292SN/AElfFile('gelf_dyn.c') 642292SN/AElfFile('gelf_ehdr.c') 652292SN/AElfFile('gelf_fsize.c') 662292SN/AElfFile('gelf_getclass.c') 672292SN/AElfFile('gelf_phdr.c') 682292SN/AElfFile('gelf_rel.c') 692292SN/AElfFile('gelf_rela.c') 702292SN/AElfFile('gelf_shdr.c') 712178SN/AElfFile('gelf_sym.c') 722155SN/AElfFile('gelf_symshndx.c') 732155SN/AElfFile('gelf_xlate.c') 742155SN/AElfFile('libelf.c') 752155SN/AElfFile('libelf_align.c') 762155SN/AElfFile('libelf_allocate.c') 772155SN/AElfFile('libelf_ar.c') 782155SN/AElfFile('libelf_checksum.c') 792155SN/AElfFile('libelf_data.c') 802623SN/AElfFile('libelf_ehdr.c') 812155SN/AElfFile('libelf_extended.c') 822155SN/AElfFile('libelf_phdr.c') 832155SN/AElfFile('libelf_shdr.c') 842155SN/AElfFile('libelf_xlate.c') 852178SN/A 862178SN/AElfFile('libelf_convert.c') 872178SN/AElfFile('libelf_fsize.c') 882178SN/AElfFile('libelf_msize.c') 892178SN/A 902178SN/Am4env = main.Clone() 912178SN/Aif m4env['GCC']: 922178SN/A major,minor,dot = [ int(x) for x in m4env['CXXVERSION'].split('.')] 932178SN/A if major >= 4: 942178SN/A m4env.Append(CCFLAGS=['-Wno-pointer-sign']) 952733Sktlim@umich.edum4env.Append(CCFLAGS=['-Wno-implicit']) 962733Sktlim@umich.edudel m4env['CPPPATH'] 972733Sktlim@umich.edu 982733Sktlim@umich.edu# If we have gm4 use it 992178SN/Aif m4env.Detect('gm4'): 1002178SN/A m4env['M4'] = 'gm4' 1012178SN/A 1022178SN/A# Check that m4 is available 1032178SN/Aimport SCons.Tool.m4 1042178SN/Aif not SCons.Tool.m4.exists(m4env): 1052155SN/A print "Error: Can't find version of M4 macro processor. " + \ 1062155SN/A "Please install M4 and try again." 1072155SN/A Exit(1) 1082623SN/A 1092623SN/Am4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 1102623SN/Am4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 1112623SN/Am4env.M4(target=File('libelf_convert.c'), 1122623SN/A source=[File('elf_types.m4'), File('libelf_convert.m4')]) 1132623SN/Am4env.M4(target=File('libelf_fsize.c'), 1142623SN/A source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 1152623SN/Am4env.M4(target=File('libelf_msize.c'), 1162623SN/A source=[File('elf_types.m4'), File('libelf_msize.m4')]) 1172623SN/A 1182623SN/A# Build libelf as a static library with PIC code so it can be linked 1192155SN/A# into either m5 or the library 1202155SN/Am4env.Library('elf', [m4env.SharedObject(f) for f in elf_files]) 1212155SN/A 1222155SN/Amain.Prepend(CPPPATH=Dir('.')) 1232733Sktlim@umich.edumain.Append(LIBS=['elf']) 1242155SN/Amain.Prepend(LIBPATH=[Dir('.')]) 1252669Sktlim@umich.edu 1262155SN/A