SConscript revision 7506
14202Sbinkertn@umich.edu# -*- mode:python -*- 24202Sbinkertn@umich.edu 34202Sbinkertn@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan 44202Sbinkertn@umich.edu# All rights reserved. 54202Sbinkertn@umich.edu# 64202Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without 74202Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are 84202Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright 94202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer; 104202Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright 114202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the 124202Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution; 134202Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its 144202Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from 154202Sbinkertn@umich.edu# this software without specific prior written permission. 164202Sbinkertn@umich.edu# 174202Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 184202Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 194202Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 204202Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 214202Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 224202Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 234202Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244202Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254202Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264202Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 274202Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284202Sbinkertn@umich.edu# 294202Sbinkertn@umich.edu# Authors: Nathan Binkert 304202Sbinkertn@umich.edu 314202Sbinkertn@umich.eduimport os, subprocess 324202Sbinkertn@umich.edu 335628Sgblack@eecs.umich.eduImport('main') 349157Sandreas.hansson@arm.com 354486Sbinkertn@umich.eduelf_files = [] 369793Sakash.bagdia@arm.comdef ElfFile(filename): 379827Sakash.bagdia@arm.com elf_files.append(File(filename)) 389850Sandreas.hansson@arm.com 394486Sbinkertn@umich.eduElfFile('elf_begin.c') 408774Sgblack@eecs.umich.eduElfFile('elf_cntl.c') 414202Sbinkertn@umich.eduElfFile('elf_data.c') 424202Sbinkertn@umich.eduElfFile('elf_end.c') 434202Sbinkertn@umich.eduElfFile('elf_fill.c') 444202Sbinkertn@umich.eduElfFile('elf_flag.c') 459983Sstever@gmail.comElfFile('elf_getarhdr.c') 465522Snate@binkert.orgElfFile('elf_getarsym.c') 478233Snate@binkert.orgElfFile('elf_getbase.c') 484202Sbinkertn@umich.eduElfFile('elf_getident.c') 494202Sbinkertn@umich.eduElfFile('elf_hash.c') 509342SAndreas.Sandberg@arm.comElfFile('elf_kind.c') 514202Sbinkertn@umich.eduElfFile('elf_memory.c') 524202Sbinkertn@umich.eduElfFile('elf_next.c') 534202Sbinkertn@umich.eduElfFile('elf_phnum.c') 544202Sbinkertn@umich.eduElfFile('elf_rand.c') 559793Sakash.bagdia@arm.comElfFile('elf_rawfile.c') 569827Sakash.bagdia@arm.comElfFile('elf_scn.c') 579850Sandreas.hansson@arm.comElfFile('elf_shnum.c') 587768SAli.Saidi@ARM.comElfFile('elf_shstrndx.c') 599850Sandreas.hansson@arm.comElfFile('elf_strptr.c') 609850Sandreas.hansson@arm.comElfFile('elf_update.c') 618766Sgblack@eecs.umich.eduElfFile('elf_version.c') 627768SAli.Saidi@ARM.comElfFile('gelf_checksum.c') 638766Sgblack@eecs.umich.eduElfFile('gelf_dyn.c') 647768SAli.Saidi@ARM.comElfFile('gelf_ehdr.c') 659850Sandreas.hansson@arm.comElfFile('gelf_fsize.c') 665016Sgblack@eecs.umich.eduElfFile('gelf_getclass.c') 674486Sbinkertn@umich.eduElfFile('gelf_phdr.c') 688335Snate@binkert.orgElfFile('gelf_rel.c') 698335Snate@binkert.orgElfFile('gelf_rela.c') 709152Satgutier@umich.eduElfFile('gelf_shdr.c') 718335Snate@binkert.orgElfFile('gelf_sym.c') 728335Snate@binkert.orgElfFile('gelf_symshndx.c') 738335Snate@binkert.orgElfFile('gelf_xlate.c') 748335Snate@binkert.orgElfFile('libelf.c') 758335Snate@binkert.orgElfFile('libelf_align.c') 768335Snate@binkert.orgElfFile('libelf_allocate.c') 778335Snate@binkert.orgElfFile('libelf_ar.c') 789733Sandreas@sandberg.pp.seElfFile('libelf_checksum.c') 798335Snate@binkert.orgElfFile('libelf_data.c') 808335Snate@binkert.orgElfFile('libelf_ehdr.c') 818335Snate@binkert.orgElfFile('libelf_extended.c') 828335Snate@binkert.orgElfFile('libelf_phdr.c') 838335Snate@binkert.orgElfFile('libelf_shdr.c') 848335Snate@binkert.orgElfFile('libelf_xlate.c') 858335Snate@binkert.org 868335Snate@binkert.orgElfFile('libelf_convert.c') 879793Sakash.bagdia@arm.comElfFile('libelf_fsize.c') 889827Sakash.bagdia@arm.comElfFile('libelf_msize.c') 89 90m4env = main.Clone() 91if m4env['GCC']: 92 major,minor,dot = [ int(x) for x in m4env['CXXVERSION'].split('.')] 93 if major >= 4: 94 m4env.Append(CCFLAGS=['-Wno-pointer-sign']) 95m4env.Append(CCFLAGS=['-Wno-implicit']) 96del m4env['CPPPATH'] 97 98# If we have gm4 use it 99if m4env.Detect('gm4'): 100 m4env['M4'] = 'gm4' 101 102# Check that m4 is available 103import SCons.Tool.m4 104if not SCons.Tool.m4.exists(m4env): 105 print "Error: Can't find version of M4 macro processor. " + \ 106 "Please install M4 and try again." 107 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