SConscript revision 5765:fdfd6e4aad66
1955SN/A# -*- mode:python -*- 2955SN/A 31762SN/A# Copyright (c) 2004-2005 The Regents of The University of Michigan 4955SN/A# All rights reserved. 5955SN/A# 6955SN/A# Redistribution and use in source and binary forms, with or without 7955SN/A# modification, are permitted provided that the following conditions are 8955SN/A# met: redistributions of source code must retain the above copyright 9955SN/A# notice, this list of conditions and the following disclaimer; 10955SN/A# redistributions in binary form must reproduce the above copyright 11955SN/A# notice, this list of conditions and the following disclaimer in the 12955SN/A# documentation and/or other materials provided with the distribution; 13955SN/A# neither the name of the copyright holders nor the names of its 14955SN/A# contributors may be used to endorse or promote products derived from 15955SN/A# this software without specific prior written permission. 16955SN/A# 17955SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18955SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19955SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20955SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21955SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22955SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23955SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24955SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25955SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26955SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27955SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu# 292665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 30955SN/A 31955SN/Aimport os, subprocess 32955SN/A 33955SN/AImport('env') 34955SN/A 352632Sstever@eecs.umich.eduelf_files = [] 362632Sstever@eecs.umich.edudef ElfFile(filename): 372632Sstever@eecs.umich.edu elf_files.append(File(filename)) 382632Sstever@eecs.umich.edu 39955SN/AElfFile('elf_begin.c') 402632Sstever@eecs.umich.eduElfFile('elf_cntl.c') 412632Sstever@eecs.umich.eduElfFile('elf_data.c') 422761Sstever@eecs.umich.eduElfFile('elf_end.c') 432632Sstever@eecs.umich.eduElfFile('elf_fill.c') 442632Sstever@eecs.umich.eduElfFile('elf_flag.c') 452632Sstever@eecs.umich.eduElfFile('elf_getarhdr.c') 462761Sstever@eecs.umich.eduElfFile('elf_getarsym.c') 472761Sstever@eecs.umich.eduElfFile('elf_getbase.c') 482761Sstever@eecs.umich.eduElfFile('elf_getident.c') 492632Sstever@eecs.umich.eduElfFile('elf_hash.c') 502632Sstever@eecs.umich.eduElfFile('elf_kind.c') 512761Sstever@eecs.umich.eduElfFile('elf_memory.c') 522761Sstever@eecs.umich.eduElfFile('elf_next.c') 532761Sstever@eecs.umich.eduElfFile('elf_phnum.c') 542761Sstever@eecs.umich.eduElfFile('elf_rand.c') 552761Sstever@eecs.umich.eduElfFile('elf_rawfile.c') 562632Sstever@eecs.umich.eduElfFile('elf_scn.c') 572632Sstever@eecs.umich.eduElfFile('elf_shnum.c') 582632Sstever@eecs.umich.eduElfFile('elf_shstrndx.c') 592632Sstever@eecs.umich.eduElfFile('elf_strptr.c') 602632Sstever@eecs.umich.eduElfFile('elf_update.c') 612632Sstever@eecs.umich.eduElfFile('elf_version.c') 622632Sstever@eecs.umich.eduElfFile('gelf_checksum.c') 63955SN/AElfFile('gelf_dyn.c') 64955SN/AElfFile('gelf_ehdr.c') 65955SN/AElfFile('gelf_fsize.c') 66955SN/AElfFile('gelf_getclass.c') 67955SN/AElfFile('gelf_phdr.c') 68955SN/AElfFile('gelf_rel.c') 69955SN/AElfFile('gelf_rela.c') 702656Sstever@eecs.umich.eduElfFile('gelf_shdr.c') 712656Sstever@eecs.umich.eduElfFile('gelf_sym.c') 722656Sstever@eecs.umich.eduElfFile('gelf_symshndx.c') 732656Sstever@eecs.umich.eduElfFile('gelf_xlate.c') 742656Sstever@eecs.umich.eduElfFile('libelf.c') 752656Sstever@eecs.umich.eduElfFile('libelf_align.c') 762656Sstever@eecs.umich.eduElfFile('libelf_allocate.c') 772653Sstever@eecs.umich.eduElfFile('libelf_ar.c') 782653Sstever@eecs.umich.eduElfFile('libelf_checksum.c') 792653Sstever@eecs.umich.eduElfFile('libelf_data.c') 802653Sstever@eecs.umich.eduElfFile('libelf_ehdr.c') 812653Sstever@eecs.umich.eduElfFile('libelf_extended.c') 822653Sstever@eecs.umich.eduElfFile('libelf_phdr.c') 832653Sstever@eecs.umich.eduElfFile('libelf_shdr.c') 842653Sstever@eecs.umich.eduElfFile('libelf_xlate.c') 852653Sstever@eecs.umich.edu 862653Sstever@eecs.umich.eduElfFile('libelf_convert.c') 872653Sstever@eecs.umich.eduElfFile('libelf_fsize.c') 881852SN/AElfFile('libelf_msize.c') 89955SN/A 90955SN/Am4env = env.Copy() 91955SN/Aif env['GCC']: 922632Sstever@eecs.umich.edu major,minor,dot = [ int(x) for x in env['CXXVERSION'].split('.')] 932632Sstever@eecs.umich.edu if major >= 4: 94955SN/A m4env.Append(CCFLAGS=['-Wno-pointer-sign']) 951533SN/Am4env.Append(CCFLAGS=['-Wno-implicit']) 962632Sstever@eecs.umich.edudel m4env['CPPPATH'] 971533SN/A 98955SN/A# If we have gm4 use it 99955SN/Aif m4env.Detect('gm4'): 1002632Sstever@eecs.umich.edu m4env['M4'] = 'gm4' 1012632Sstever@eecs.umich.edu 102955SN/A# Check that m4 is available 103955SN/Aimport SCons.Tool.m4 104955SN/Aif not SCons.Tool.m4.exists(m4env): 105955SN/A print "Error: Can't find version of M4 macro processor. " + \ 1062632Sstever@eecs.umich.edu "Please install M4 and try again." 107955SN/A Exit(1) 1082632Sstever@eecs.umich.edu 109955SN/Am4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 110955SN/Am4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 1112632Sstever@eecs.umich.edum4env.M4(target=File('libelf_convert.c'), 1122632Sstever@eecs.umich.edu source=[File('elf_types.m4'), File('libelf_convert.m4')]) 1132632Sstever@eecs.umich.edum4env.M4(target=File('libelf_fsize.c'), 1142632Sstever@eecs.umich.edu source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 1152632Sstever@eecs.umich.edum4env.M4(target=File('libelf_msize.c'), 1162632Sstever@eecs.umich.edu source=[File('elf_types.m4'), File('libelf_msize.m4')]) 1172632Sstever@eecs.umich.edu 1182632Sstever@eecs.umich.edu# Build libelf as a static library with PIC code so it can be linked 1192632Sstever@eecs.umich.edu# into either m5 or the library 1202632Sstever@eecs.umich.edum4env.Library('elf', [m4env.SharedObject(f) for f in elf_files]) 1212632Sstever@eecs.umich.edu 1223053Sstever@eecs.umich.eduenv.Append(CPPPATH=Dir('.')) 1233053Sstever@eecs.umich.eduenv.Append(LIBS=['elf']) 1243053Sstever@eecs.umich.eduenv.Append(LIBPATH=[Dir('.')]) 1253053Sstever@eecs.umich.edu 1263053Sstever@eecs.umich.edu