SConscript revision 8687
12086SN/A# -*- mode:python -*- 22086SN/A 32086SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan 42086SN/A# All rights reserved. 52086SN/A# 62086SN/A# Redistribution and use in source and binary forms, with or without 72086SN/A# modification, are permitted provided that the following conditions are 82086SN/A# met: redistributions of source code must retain the above copyright 92086SN/A# notice, this list of conditions and the following disclaimer; 102086SN/A# redistributions in binary form must reproduce the above copyright 112086SN/A# notice, this list of conditions and the following disclaimer in the 122086SN/A# documentation and/or other materials provided with the distribution; 132086SN/A# neither the name of the copyright holders nor the names of its 142086SN/A# contributors may be used to endorse or promote products derived from 152086SN/A# this software without specific prior written permission. 162086SN/A# 172086SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182086SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192086SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202086SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212086SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222086SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232086SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242086SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252086SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262086SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272086SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 292665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 302665Ssaidi@eecs.umich.edu 312086SN/Aimport os, subprocess 324202Sbinkertn@umich.edu 332086SN/AImport('main') 344202Sbinkertn@umich.edu 354202Sbinkertn@umich.eduelf_files = [] 364202Sbinkertn@umich.edudef ElfFile(filename): 376313Sgblack@eecs.umich.edu elf_files.append(File(filename)) 386365Sgblack@eecs.umich.edu 394997Sgblack@eecs.umich.eduElfFile('elf_begin.c') 404202Sbinkertn@umich.eduElfFile('elf_cntl.c') 414997Sgblack@eecs.umich.eduElfFile('elf_data.c') 424826Ssaidi@eecs.umich.eduElfFile('elf_end.c') 432086SN/AElfFile('elf_errmsg.c') 446365Sgblack@eecs.umich.eduElfFile('elf_errno.c') 456365Sgblack@eecs.umich.eduElfFile('elf_fill.c') 464997Sgblack@eecs.umich.eduElfFile('elf_flag.c') 475800Snate@binkert.orgElfFile('elf_getarhdr.c') 485938Sgblack@eecs.umich.eduElfFile('elf_getarsym.c') 494997Sgblack@eecs.umich.eduElfFile('elf_getbase.c') 504202Sbinkertn@umich.eduElfFile('elf_getident.c') 514486Sbinkertn@umich.eduElfFile('elf_hash.c') 525647Sgblack@eecs.umich.eduElfFile('elf_kind.c') 534486Sbinkertn@umich.eduElfFile('elf_memory.c') 545647Sgblack@eecs.umich.eduElfFile('elf_next.c') 554202Sbinkertn@umich.eduElfFile('elf_phnum.c') 564202Sbinkertn@umich.eduElfFile('elf_rand.c') 574202Sbinkertn@umich.eduElfFile('elf_rawfile.c') 584202Sbinkertn@umich.eduElfFile('elf_scn.c') 594202Sbinkertn@umich.eduElfFile('elf_shnum.c') 604202Sbinkertn@umich.eduElfFile('elf_shstrndx.c') 612086SN/AElfFile('elf_strptr.c') 624202Sbinkertn@umich.eduElfFile('elf_update.c') 634202Sbinkertn@umich.eduElfFile('elf_version.c') 644202Sbinkertn@umich.eduElfFile('gelf_checksum.c') 652086SN/AElfFile('gelf_dyn.c') 664202Sbinkertn@umich.eduElfFile('gelf_ehdr.c') 674202Sbinkertn@umich.eduElfFile('gelf_fsize.c') 682086SN/AElfFile('gelf_getclass.c') 694202Sbinkertn@umich.eduElfFile('gelf_phdr.c') 704202Sbinkertn@umich.eduElfFile('gelf_rel.c') 714202Sbinkertn@umich.eduElfFile('gelf_rela.c') 724202Sbinkertn@umich.eduElfFile('gelf_shdr.c') 734202Sbinkertn@umich.eduElfFile('gelf_sym.c') 744202Sbinkertn@umich.eduElfFile('gelf_symshndx.c') 75ElfFile('gelf_xlate.c') 76ElfFile('libelf.c') 77ElfFile('libelf_align.c') 78ElfFile('libelf_allocate.c') 79ElfFile('libelf_ar.c') 80ElfFile('libelf_checksum.c') 81ElfFile('libelf_data.c') 82ElfFile('libelf_ehdr.c') 83ElfFile('libelf_extended.c') 84ElfFile('libelf_phdr.c') 85ElfFile('libelf_shdr.c') 86ElfFile('libelf_xlate.c') 87 88ElfFile('libelf_convert.c') 89ElfFile('libelf_fsize.c') 90ElfFile('libelf_msize.c') 91 92m4env = main.Clone() 93if m4env['GCC']: 94 major,minor,dot = [int(x) for x in m4env['GCC_VERSION'].split('.')] 95 if major >= 4: 96 m4env.Append(CCFLAGS=['-Wno-pointer-sign']) 97m4env.Append(CCFLAGS=['-Wno-implicit']) 98del m4env['CPPPATH'] 99 100# If we have gm4 use it 101if m4env.Detect('gm4'): 102 m4env['M4'] = 'gm4' 103 104# Check that m4 is available 105import SCons.Tool.m4 106if not SCons.Tool.m4.exists(m4env): 107 print "Error: Can't find version of M4 macro processor. " + \ 108 "Please install M4 and try again." 109 Exit(1) 110 111m4env.Append(M4FLAGS=['-DSRCDIR=%s' % Dir('.').path]) 112m4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 113m4env.M4(target=File('libelf_convert.c'), 114 source=[File('elf_types.m4'), File('libelf_convert.m4')]) 115m4env.M4(target=File('libelf_fsize.c'), 116 source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 117m4env.M4(target=File('libelf_msize.c'), 118 source=[File('elf_types.m4'), File('libelf_msize.m4')]) 119 120# Build libelf as a static library with PIC code so it can be linked 121# into either m5 or the library 122m4env.Library('elf', [m4env.SharedObject(f) for f in elf_files]) 123 124main.Prepend(CPPPATH=Dir('.')) 125main.Append(LIBS=['elf']) 126main.Prepend(LIBPATH=[Dir('.')]) 127 128