SConscript revision 6226
12567SN/A# -*- mode:python -*- 27650SAli.Saidi@ARM.com 37650SAli.Saidi@ARM.com# Copyright (c) 2004-2005 The Regents of The University of Michigan 47650SAli.Saidi@ARM.com# All rights reserved. 57650SAli.Saidi@ARM.com# 67650SAli.Saidi@ARM.com# Redistribution and use in source and binary forms, with or without 77650SAli.Saidi@ARM.com# modification, are permitted provided that the following conditions are 87650SAli.Saidi@ARM.com# met: redistributions of source code must retain the above copyright 97650SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer; 107650SAli.Saidi@ARM.com# redistributions in binary form must reproduce the above copyright 117650SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer in the 127650SAli.Saidi@ARM.com# documentation and/or other materials provided with the distribution; 137650SAli.Saidi@ARM.com# neither the name of the copyright holders nor the names of its 142567SN/A# contributors may be used to endorse or promote products derived from 152567SN/A# this software without specific prior written permission. 162567SN/A# 172567SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182567SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192567SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202567SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212567SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222567SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232567SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242567SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252567SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262567SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272567SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282567SN/A# 292567SN/A# Authors: Nathan Binkert 302567SN/A 312567SN/Aimport os, subprocess 322567SN/A 332567SN/AImport('main') 342567SN/A 352567SN/Aelf_files = [] 362567SN/Adef ElfFile(filename): 372567SN/A elf_files.append(File(filename)) 382567SN/A 392665SN/AElfFile('elf_begin.c') 402665SN/AElfFile('elf_cntl.c') 412567SN/AElfFile('elf_data.c') 422567SN/AElfFile('elf_end.c') 436757SAli.Saidi@ARM.comElfFile('elf_fill.c') 446757SAli.Saidi@ARM.comElfFile('elf_flag.c') 452567SN/AElfFile('elf_getarhdr.c') 462567SN/AElfFile('elf_getarsym.c') 472567SN/AElfFile('elf_getbase.c') 482567SN/AElfFile('elf_getident.c') 498229Snate@binkert.orgElfFile('elf_hash.c') 506757SAli.Saidi@ARM.comElfFile('elf_kind.c') 512567SN/AElfFile('elf_memory.c') 522567SN/AElfFile('elf_next.c') 532567SN/AElfFile('elf_phnum.c') 546757SAli.Saidi@ARM.comElfFile('elf_rand.c') 552567SN/AElfFile('elf_rawfile.c') 568285SPrakash.Ramrakhyani@arm.comElfFile('elf_scn.c') 577650SAli.Saidi@ARM.comElfFile('elf_shnum.c') 587650SAli.Saidi@ARM.comElfFile('elf_shstrndx.c') 597650SAli.Saidi@ARM.comElfFile('elf_strptr.c') 607650SAli.Saidi@ARM.comElfFile('elf_update.c') 617650SAli.Saidi@ARM.comElfFile('elf_version.c') 627650SAli.Saidi@ARM.comElfFile('gelf_checksum.c') 638286SAli.Saidi@ARM.comElfFile('gelf_dyn.c') 648286SAli.Saidi@ARM.comElfFile('gelf_ehdr.c') 658286SAli.Saidi@ARM.comElfFile('gelf_fsize.c') 668286SAli.Saidi@ARM.comElfFile('gelf_getclass.c') 678286SAli.Saidi@ARM.comElfFile('gelf_phdr.c') 682567SN/AElfFile('gelf_rel.c') 696757SAli.Saidi@ARM.comElfFile('gelf_rela.c') 708286SAli.Saidi@ARM.comElfFile('gelf_shdr.c') 718286SAli.Saidi@ARM.comElfFile('gelf_sym.c') 728286SAli.Saidi@ARM.comElfFile('gelf_symshndx.c') 738286SAli.Saidi@ARM.comElfFile('gelf_xlate.c') 748286SAli.Saidi@ARM.comElfFile('libelf.c') 758286SAli.Saidi@ARM.comElfFile('libelf_align.c') 766757SAli.Saidi@ARM.comElfFile('libelf_allocate.c') 776757SAli.Saidi@ARM.comElfFile('libelf_ar.c') 788286SAli.Saidi@ARM.comElfFile('libelf_checksum.c') 798706Sandreas.hansson@arm.comElfFile('libelf_data.c') 808706Sandreas.hansson@arm.comElfFile('libelf_ehdr.c') 818706Sandreas.hansson@arm.comElfFile('libelf_extended.c') 828706Sandreas.hansson@arm.comElfFile('libelf_phdr.c') 838286SAli.Saidi@ARM.comElfFile('libelf_shdr.c') 848527SAli.Saidi@ARM.comElfFile('libelf_xlate.c') 858527SAli.Saidi@ARM.com 868527SAli.Saidi@ARM.comElfFile('libelf_convert.c') 878527SAli.Saidi@ARM.comElfFile('libelf_fsize.c') 888527SAli.Saidi@ARM.comElfFile('libelf_msize.c') 898527SAli.Saidi@ARM.com 908527SAli.Saidi@ARM.comm4env = main.Clone() 918527SAli.Saidi@ARM.comif m4env['GCC']: 928527SAli.Saidi@ARM.com major,minor,dot = [ int(x) for x in m4env['CXXVERSION'].split('.')] 933553SN/A if major >= 4: 943553SN/A m4env.Append(CCFLAGS=['-Wno-pointer-sign']) 957693SAli.Saidi@ARM.comm4env.Append(CCFLAGS=['-Wno-implicit']) 967693SAli.Saidi@ARM.comdel m4env['CPPPATH'] 977693SAli.Saidi@ARM.com 987720Sgblack@eecs.umich.edu# If we have gm4 use it 993553SN/Aif m4env.Detect('gm4'): 1003553SN/A m4env['M4'] = 'gm4' 1019050Schander.sudanthi@arm.com 1029050Schander.sudanthi@arm.com# Check that m4 is available 1039050Schander.sudanthi@arm.comimport SCons.Tool.m4 1042567SN/Aif not SCons.Tool.m4.exists(m4env): 1052567SN/A print "Error: Can't find version of M4 macro processor. " + \ 1062567SN/A "Please install M4 and try again." 1072567SN/A Exit(1) 108 109m4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 110m4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 111m4env.M4(target=File('libelf_convert.c'), 112 source=[File('elf_types.m4'), File('libelf_convert.m4')]) 113m4env.M4(target=File('libelf_fsize.c'), 114 source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 115m4env.M4(target=File('libelf_msize.c'), 116 source=[File('elf_types.m4'), File('libelf_msize.m4')]) 117 118# Build libelf as a static library with PIC code so it can be linked 119# into either m5 or the library 120m4env.Library('elf', [m4env.SharedObject(f) for f in elf_files]) 121 122main.Prepend(CPPPATH=Dir('.')) 123main.Append(LIBS=['elf']) 124main.Prepend(LIBPATH=[Dir('.')]) 125 126