SConscript revision 5132
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 314202Sbinkertn@umich.eduimport os, subprocess 322155SN/A 339850Sandreas.hansson@arm.comImport('env') 349850Sandreas.hansson@arm.com 359850Sandreas.hansson@arm.comelf_files = [] 367768SAli.Saidi@ARM.comdef ElfFile(filename): 377768SAli.Saidi@ARM.com elf_files.append(File(filename)) 3810695SAli.Saidi@ARM.com 3910695SAli.Saidi@ARM.comElfFile('elf_begin.c') 4010695SAli.Saidi@ARM.comElfFile('elf_cntl.c') 4110695SAli.Saidi@ARM.comElfFile('elf_data.c') 4210695SAli.Saidi@ARM.comElfFile('elf_end.c') 438887Sgeoffrey.blake@arm.comElfFile('elf_fill.c') 442766Sktlim@umich.eduElfFile('elf_flag.c') 454486Sbinkertn@umich.eduElfFile('elf_getarhdr.c') 4610663SAli.Saidi@ARM.comElfFile('elf_getarsym.c') 474486Sbinkertn@umich.eduElfFile('elf_getbase.c') 488739Sgblack@eecs.umich.eduElfFile('elf_getident.c') 4910259SAndrew.Bardsley@arm.comElfFile('elf_hash.c') 504486Sbinkertn@umich.eduElfFile('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') 5510319SAndreas.Sandberg@ARM.comElfFile('elf_rawfile.c') 564202Sbinkertn@umich.eduElfFile('elf_scn.c') 574776Sgblack@eecs.umich.eduElfFile('elf_shnum.c') 588739Sgblack@eecs.umich.eduElfFile('elf_shstrndx.c') 596365Sgblack@eecs.umich.eduElfFile('elf_strptr.c') 604202Sbinkertn@umich.eduElfFile('elf_update.c') 618777Sgblack@eecs.umich.eduElfFile('elf_version.c') 624202Sbinkertn@umich.eduElfFile('gelf_checksum.c') 639913Ssteve.reinhardt@amd.comElfFile('gelf_dyn.c') 644202Sbinkertn@umich.eduElfFile('gelf_ehdr.c') 654202Sbinkertn@umich.eduElfFile('gelf_fsize.c') 665217Ssaidi@eecs.umich.eduElfFile('gelf_getclass.c') 674202Sbinkertn@umich.eduElfFile('gelf_phdr.c') 6810259SAndrew.Bardsley@arm.comElfFile('gelf_rel.c') 692155SN/AElfFile('gelf_rela.c') 708887Sgeoffrey.blake@arm.comElfFile('gelf_shdr.c') 7110201SAndrew.Bardsley@arm.comElfFile('gelf_sym.c') 728887Sgeoffrey.blake@arm.comElfFile('gelf_symshndx.c') 739340SAndreas.Sandberg@arm.comElfFile('gelf_xlate.c') 748887Sgeoffrey.blake@arm.comElfFile('libelf.c') 755192Ssaidi@eecs.umich.eduElfFile('libelf_align.c') 768335Snate@binkert.orgElfFile('libelf_allocate.c') 778335Snate@binkert.orgElfFile('libelf_ar.c') 788335Snate@binkert.orgElfFile('libelf_checksum.c') 798335Snate@binkert.orgElfFile('libelf_data.c') 808335Snate@binkert.orgElfFile('libelf_ehdr.c') 819534SAndreas.Sandberg@ARM.comElfFile('libelf_extended.c') 829534SAndreas.Sandberg@ARM.comElfFile('libelf_phdr.c') 839534SAndreas.Sandberg@ARM.comElfFile('libelf_shdr.c') 848335Snate@binkert.orgElfFile('libelf_xlate.c') 859534SAndreas.Sandberg@ARM.com 869534SAndreas.Sandberg@ARM.comElfFile('libelf_convert.c') 878335Snate@binkert.orgElfFile('libelf_fsize.c') 889534SAndreas.Sandberg@ARM.comElfFile('libelf_msize.c') 899534SAndreas.Sandberg@ARM.com 909534SAndreas.Sandberg@ARM.comm4env = Environment(ENV=os.environ) 919534SAndreas.Sandberg@ARM.comif env.get('CC'): 929534SAndreas.Sandberg@ARM.com m4env['CC'] = env['CC'] 939534SAndreas.Sandberg@ARM.comif env.get('CXX'): 949534SAndreas.Sandberg@ARM.com m4env['CXX'] = env['CXX'] 959534SAndreas.Sandberg@ARM.com 969534SAndreas.Sandberg@ARM.com# If we have gm4 use it 9710383Smitch.hayenga@arm.comif m4env.Detect('gm4'): 988335Snate@binkert.org m4env['M4'] = 'gm4' 998335Snate@binkert.org 1008471SGiacomo.Gabrielli@arm.com# Check that m4 is available 1018335Snate@binkert.orgimport SCons.Tool.m4 1028335Snate@binkert.orgif not SCons.Tool.m4.exists(m4env): 10310529Smorr@cs.wisc.edu print "Error: Can't find version of M4 macro processor. " + \ 1045192Ssaidi@eecs.umich.edu "Please install M4 and try again." 1058232Snate@binkert.org Exit(1) 1068232Snate@binkert.org 10710664SAli.Saidi@ARM.comm4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 1088300Schander.sudanthi@arm.comm4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 10910383Smitch.hayenga@arm.comm4env.M4(target=File('libelf_convert.c'), 1105192Ssaidi@eecs.umich.edu source=[File('elf_types.m4'), File('libelf_convert.m4')]) 11111162Ssteve.reinhardt@amd.comm4env.M4(target=File('libelf_fsize.c'), 11211162Ssteve.reinhardt@amd.com source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 11311162Ssteve.reinhardt@amd.comm4env.M4(target=File('libelf_msize.c'), 11411162Ssteve.reinhardt@amd.com source=[File('elf_types.m4'), File('libelf_msize.m4')]) 1158300Schander.sudanthi@arm.comm4env.Library('elf', elf_files) 116 117env.Append(CPPPATH=Dir('.')) 118env.Append(LIBS=['elf']) 119env.Append(LIBPATH=[Dir('.')]) 120 121