SConscript revision 5397
16157Snate@binkert.org# -*- mode:python -*- 26157Snate@binkert.org 36157Snate@binkert.org# Copyright (c) 2004-2005 The Regents of The University of Michigan 46157Snate@binkert.org# All rights reserved. 56157Snate@binkert.org# 66157Snate@binkert.org# Redistribution and use in source and binary forms, with or without 76157Snate@binkert.org# modification, are permitted provided that the following conditions are 86157Snate@binkert.org# met: redistributions of source code must retain the above copyright 96157Snate@binkert.org# notice, this list of conditions and the following disclaimer; 106157Snate@binkert.org# redistributions in binary form must reproduce the above copyright 116157Snate@binkert.org# notice, this list of conditions and the following disclaimer in the 126157Snate@binkert.org# documentation and/or other materials provided with the distribution; 136157Snate@binkert.org# neither the name of the copyright holders nor the names of its 146157Snate@binkert.org# contributors may be used to endorse or promote products derived from 156157Snate@binkert.org# this software without specific prior written permission. 166157Snate@binkert.org# 176157Snate@binkert.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 186157Snate@binkert.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 196157Snate@binkert.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 206157Snate@binkert.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 216157Snate@binkert.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 226157Snate@binkert.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 236157Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 246157Snate@binkert.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 256157Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 266157Snate@binkert.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 276157Snate@binkert.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 286157Snate@binkert.org# 296157Snate@binkert.org# Authors: Nathan Binkert 306157Snate@binkert.org 316157Snate@binkert.orgimport os, subprocess 328453Snate@binkert.org 336157Snate@binkert.orgImport('env') 346157Snate@binkert.org 356657Snate@binkert.orgelf_files = [] 366157Snate@binkert.orgdef ElfFile(filename): 378453Snate@binkert.org elf_files.append(File(filename)) 388453Snate@binkert.org 396157Snate@binkert.orgElfFile('elf_begin.c') 406157Snate@binkert.orgElfFile('elf_cntl.c') 418492Snilay@cs.wisc.eduElfFile('elf_data.c') 426168Snate@binkert.orgElfFile('elf_end.c') 436168Snate@binkert.orgElfFile('elf_fill.c') 449219Spower.jg@gmail.comElfFile('elf_flag.c') 456157Snate@binkert.orgElfFile('elf_getarhdr.c') 466657Snate@binkert.orgElfFile('elf_getarsym.c') 476657Snate@binkert.orgElfFile('elf_getbase.c') 486657Snate@binkert.orgElfFile('elf_getident.c') 496657Snate@binkert.orgElfFile('elf_hash.c') 506657Snate@binkert.orgElfFile('elf_kind.c') 516657Snate@binkert.orgElfFile('elf_memory.c') 526657Snate@binkert.orgElfFile('elf_next.c') 536657Snate@binkert.orgElfFile('elf_phnum.c') 546657Snate@binkert.orgElfFile('elf_rand.c') 556657Snate@binkert.orgElfFile('elf_rawfile.c') 566157Snate@binkert.orgElfFile('elf_scn.c') 576157Snate@binkert.orgElfFile('elf_shnum.c') 586157Snate@binkert.orgElfFile('elf_shstrndx.c') 596157Snate@binkert.orgElfFile('elf_strptr.c') 609219Spower.jg@gmail.comElfFile('elf_update.c') 618453Snate@binkert.orgElfFile('elf_version.c') 628453Snate@binkert.orgElfFile('gelf_checksum.c') 638453Snate@binkert.orgElfFile('gelf_dyn.c') 646657Snate@binkert.orgElfFile('gelf_ehdr.c') 656657Snate@binkert.orgElfFile('gelf_fsize.c') 668454Snate@binkert.orgElfFile('gelf_getclass.c') 678454Snate@binkert.orgElfFile('gelf_phdr.c') 688454Snate@binkert.orgElfFile('gelf_rel.c') 699219Spower.jg@gmail.comElfFile('gelf_rela.c') 708453Snate@binkert.orgElfFile('gelf_shdr.c') 719219Spower.jg@gmail.comElfFile('gelf_sym.c') 728881Smarc.orr@gmail.comElfFile('gelf_symshndx.c') 738453Snate@binkert.orgElfFile('gelf_xlate.c') 746657Snate@binkert.orgElfFile('libelf.c') 759219Spower.jg@gmail.comElfFile('libelf_align.c') 766657Snate@binkert.orgElfFile('libelf_allocate.c') 776657Snate@binkert.orgElfFile('libelf_ar.c') 786657Snate@binkert.orgElfFile('libelf_checksum.c') 798454Snate@binkert.orgElfFile('libelf_data.c') 808454Snate@binkert.orgElfFile('libelf_ehdr.c') 818454Snate@binkert.orgElfFile('libelf_extended.c') 829219Spower.jg@gmail.comElfFile('libelf_phdr.c') 838453Snate@binkert.orgElfFile('libelf_shdr.c') 849219Spower.jg@gmail.comElfFile('libelf_xlate.c') 858881Smarc.orr@gmail.com 868453Snate@binkert.orgElfFile('libelf_convert.c') 876157Snate@binkert.orgElfFile('libelf_fsize.c') 888453Snate@binkert.orgElfFile('libelf_msize.c') 898453Snate@binkert.org 906157Snate@binkert.orgm4env = env.Copy() 916157Snate@binkert.orgdel m4env['CCFLAGS'] 929219Spower.jg@gmail.comdel m4env['CPPPATH'] 939219Spower.jg@gmail.com 949219Spower.jg@gmail.com# If we have gm4 use it 959219Spower.jg@gmail.comif m4env.Detect('gm4'): 969219Spower.jg@gmail.com m4env['M4'] = 'gm4' 979219Spower.jg@gmail.com 989219Spower.jg@gmail.com# Check that m4 is available 999219Spower.jg@gmail.comimport SCons.Tool.m4 1009219Spower.jg@gmail.comif not SCons.Tool.m4.exists(m4env): 1018454Snate@binkert.org print "Error: Can't find version of M4 macro processor. " + \ 1026157Snate@binkert.org "Please install M4 and try again." 1036657Snate@binkert.org Exit(1) 1048454Snate@binkert.org 1056657Snate@binkert.orgm4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path) 1066157Snate@binkert.orgm4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET' 1076877Ssteve.reinhardt@amd.comm4env.M4(target=File('libelf_convert.c'), 1086877Ssteve.reinhardt@amd.com source=[File('elf_types.m4'), File('libelf_convert.m4')]) 1096877Ssteve.reinhardt@amd.comm4env.M4(target=File('libelf_fsize.c'), 1106877Ssteve.reinhardt@amd.com source=[File('elf_types.m4'), File('libelf_fsize.m4')]) 1116877Ssteve.reinhardt@amd.comm4env.M4(target=File('libelf_msize.c'), 1126877Ssteve.reinhardt@amd.com source=[File('elf_types.m4'), File('libelf_msize.m4')]) 1136877Ssteve.reinhardt@amd.comm4env.Library('elf', elf_files) 114 115env.Append(CPPPATH=Dir('.')) 116env.Append(LIBS=['elf']) 117env.Append(LIBPATH=[Dir('.')]) 118 119