SConscript revision 4776
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 322086SN/A 332086SN/AImport('env') 342086SN/A 352086SN/Aelf_files = [] 362086SN/Adef ElfFile(filename): 372086SN/A elf_files.append(File(filename)) 382086SN/A 392086SN/AElfFile('elf_begin.c') 402086SN/AElfFile('elf_cntl.c') 412086SN/AElfFile('elf_data.c') 422086SN/AElfFile('elf_end.c') 432086SN/AElfFile('elf_fill.c') 442086SN/AElfFile('elf_flag.c') 452086SN/AElfFile('elf_getarhdr.c') 462152SN/AElfFile('elf_getarsym.c') 472152SN/AElfFile('elf_getbase.c') 482972Sgblack@eecs.umich.eduElfFile('elf_getident.c') 492972Sgblack@eecs.umich.eduElfFile('elf_hash.c') 502972Sgblack@eecs.umich.eduElfFile('elf_kind.c') 512972Sgblack@eecs.umich.eduElfFile('elf_memory.c') 522086SN/AElfFile('elf_next.c') 532086SN/AElfFile('elf_phnum.c') 542086SN/AElfFile('elf_rand.c') 552152SN/AElfFile('elf_rawfile.c') 562972Sgblack@eecs.umich.eduElfFile('elf_scn.c') 572652Ssaidi@eecs.umich.eduElfFile('elf_shnum.c') 582086SN/AElfFile('elf_shstrndx.c') 592086SN/AElfFile('elf_strptr.c') 602086SN/AElfFile('elf_update.c') 612152SN/AElfFile('elf_version.c') 622579SN/AElfFile('gelf_checksum.c') 632458SN/AElfFile('gelf_dyn.c') 642972Sgblack@eecs.umich.eduElfFile('gelf_ehdr.c') 652972Sgblack@eecs.umich.eduElfFile('gelf_fsize.c') 662600SN/AElfFile('gelf_getclass.c') 672086SN/AElfFile('gelf_phdr.c') 682086SN/AElfFile('gelf_rel.c') 692152SN/AElfFile('gelf_rela.c') 702086SN/AElfFile('gelf_shdr.c') 712086SN/AElfFile('gelf_sym.c') 722152SN/AElfFile('gelf_symshndx.c') 732086SN/AElfFile('gelf_xlate.c') 742152SN/AElfFile('libelf.c') 752086SN/AElfFile('libelf_align.c') 762152SN/AElfFile('libelf_allocate.c') 772152SN/AElfFile('libelf_ar.c') 782152SN/AElfFile('libelf_checksum.c') 792152SN/AElfFile('libelf_data.c') 802152SN/AElfFile('libelf_ehdr.c') 812152SN/AElfFile('libelf_extended.c') 822152SN/AElfFile('libelf_phdr.c') 832152SN/AElfFile('libelf_shdr.c') 842152SN/AElfFile('libelf_xlate.c') 852086SN/A 862086SN/AElfFile('libelf_convert.c') 87ElfFile('libelf_fsize.c') 88ElfFile('libelf_msize.c') 89 90m4env = Environment(ENV=os.environ) 91if env.get('CC'): 92 m4env['CC'] = env['CC'] 93if env.get('CXX'): 94 m4env['CXX'] = env['CXX'] 95 96# If we have gm4 use it 97if m4env.Detect('gm4'): 98 m4env['M4'] = 'gm4' 99 100# Check that m4 is available 101import SCons.Tool.m4 102if not SCons.Tool.m4.exists(m4env): 103 print "Error: Can't find version of M4 macro processor. " + \ 104 "Please install M4 and try again." 105 Exit(1) 106 107m4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 108m4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 109m4env.M4(target=File('libelf_convert.c'), 110 source=[File('elf_types.m4'), File('libelf_convert.m4')]) 111m4env.M4(target=File('libelf_fsize.c'), 112 source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 113m4env.M4(target=File('libelf_msize.c'), 114 source=[File('elf_types.m4'), File('libelf_msize.m4')]) 115m4env.Library('elf', elf_files) 116 117env.Append(CPPPATH=Dir('.')) 118env.Append(LIBS=['elf']) 119env.Append(LIBPATH=[Dir('.')]) 120 121