SConscript revision 5274:7888bf966443
11689SN/A# -*- mode:python -*- 22326SN/A 31689SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan 41689SN/A# All rights reserved. 51689SN/A# 61689SN/A# Redistribution and use in source and binary forms, with or without 71689SN/A# modification, are permitted provided that the following conditions are 81689SN/A# met: redistributions of source code must retain the above copyright 91689SN/A# notice, this list of conditions and the following disclaimer; 101689SN/A# redistributions in binary form must reproduce the above copyright 111689SN/A# notice, this list of conditions and the following disclaimer in the 121689SN/A# documentation and/or other materials provided with the distribution; 131689SN/A# neither the name of the copyright holders nor the names of its 141689SN/A# contributors may be used to endorse or promote products derived from 151689SN/A# this software without specific prior written permission. 161689SN/A# 171689SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 181689SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 191689SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 201689SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 211689SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 221689SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 231689SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 241689SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 251689SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 261689SN/A# (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. 282665Ssaidi@eecs.umich.edu# 291689SN/A# Authors: Nathan Binkert 301689SN/A 312292SN/Aimport os, subprocess 322292SN/A 331060SN/AImport('env') 341060SN/A 351061SN/Aelf_files = [] 361060SN/Adef ElfFile(filename): 371061SN/A elf_files.append(File(filename)) 381060SN/A 391062SN/AElfFile('elf_begin.c') 401060SN/AElfFile('elf_cntl.c') 411061SN/AElfFile('elf_data.c') 422326SN/AElfFile('elf_end.c') 432669Sktlim@umich.eduElfFile('elf_fill.c') 441710SN/AElfFile('elf_flag.c') 451060SN/AElfFile('elf_getarhdr.c') 462292SN/AElfFile('elf_getarsym.c') 472292SN/AElfFile('elf_getbase.c') 482292SN/AElfFile('elf_getident.c') 491060SN/AElfFile('elf_hash.c') 501689SN/AElfFile('elf_kind.c') 511689SN/AElfFile('elf_memory.c') 521689SN/AElfFile('elf_next.c') 531689SN/AElfFile('elf_phnum.c') 541060SN/AElfFile('elf_rand.c') 551060SN/AElfFile('elf_rawfile.c') 561060SN/AElfFile('elf_scn.c') 572292SN/AElfFile('elf_shnum.c') 582292SN/AElfFile('elf_shstrndx.c') 592292SN/AElfFile('elf_strptr.c') 602292SN/AElfFile('elf_update.c') 612292SN/AElfFile('elf_version.c') 622292SN/AElfFile('gelf_checksum.c') 632292SN/AElfFile('gelf_dyn.c') 642292SN/AElfFile('gelf_ehdr.c') 651060SN/AElfFile('gelf_fsize.c') 661061SN/AElfFile('gelf_getclass.c') 671060SN/AElfFile('gelf_phdr.c') 681060SN/AElfFile('gelf_rel.c') 691060SN/AElfFile('gelf_rela.c') 701060SN/AElfFile('gelf_shdr.c') 712733Sktlim@umich.eduElfFile('gelf_sym.c') 721061SN/AElfFile('gelf_symshndx.c') 731060SN/AElfFile('gelf_xlate.c') 741060SN/AElfFile('libelf.c') 752292SN/AElfFile('libelf_align.c') 761061SN/AElfFile('libelf_allocate.c') 771061SN/AElfFile('libelf_ar.c') 781061SN/AElfFile('libelf_checksum.c') 791060SN/AElfFile('libelf_data.c') 802292SN/AElfFile('libelf_ehdr.c') 811061SN/AElfFile('libelf_extended.c') 821060SN/AElfFile('libelf_phdr.c') 832733Sktlim@umich.eduElfFile('libelf_shdr.c') 842292SN/AElfFile('libelf_xlate.c') 852292SN/A 862292SN/AElfFile('libelf_convert.c') 872292SN/AElfFile('libelf_fsize.c') 882292SN/AElfFile('libelf_msize.c') 892292SN/A 902292SN/Am4env = Environment(ENV=os.environ) 912292SN/A 922292SN/Aif env.get('CC'): 932292SN/A m4env['CC'] = env['CC'] 942292SN/Aif env.get('CXX'): 952292SN/A m4env['CXX'] = env['CXX'] 962292SN/A 972348SN/Aif env.get('OSX64bit'): 982348SN/A m4env.Append(CFLAGS='-arch x86_64') 992348SN/A m4env.Append(LINKFLAGS='-arch x86_64') 1002326SN/A 1012326SN/A# If we have gm4 use it 1022292SN/Aif m4env.Detect('gm4'): 1032292SN/A m4env['M4'] = 'gm4' 1042292SN/A 1052292SN/A# Check that m4 is available 1062292SN/Aimport SCons.Tool.m4 1072292SN/Aif not SCons.Tool.m4.exists(m4env): 1082292SN/A print "Error: Can't find version of M4 macro processor. " + \ 1092326SN/A "Please install M4 and try again." 1101060SN/A Exit(1) 1111060SN/A 1122292SN/Am4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 1134329Sktlim@umich.edum4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 1141061SN/Am4env.M4(target=File('libelf_convert.c'), 1152292SN/A source=[File('elf_types.m4'), File('libelf_convert.m4')]) 1162292SN/Am4env.M4(target=File('libelf_fsize.c'), 1171061SN/A source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 1182292SN/Am4env.M4(target=File('libelf_msize.c'), 1192292SN/A source=[File('elf_types.m4'), File('libelf_msize.m4')]) 1201060SN/Am4env.Library('elf', elf_files) 1212292SN/A 1221062SN/Aenv.Append(CPPPATH=Dir('.')) 1231062SN/Aenv.Append(LIBS=['elf']) 1242348SN/Aenv.Append(LIBPATH=[Dir('.')]) 1252307SN/A 1261060SN/A