SConscript revision 4494:b7c909b5a5e9
1955SN/A# -*- mode:python -*-
2955SN/A
310841Sandreas.sandberg@arm.com# Copyright (c) 2004-2005 The Regents of The University of Michigan
49812Sandreas.hansson@arm.com# All rights reserved.
59812Sandreas.hansson@arm.com#
69812Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
79812Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
89812Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
99812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
109812Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
119812Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
129812Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
139812Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
149812Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
157816Ssteve.reinhardt@amd.com# this software without specific prior written permission.
165871Snate@binkert.org#
171762SN/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.
28955SN/A#
29955SN/A# Authors: Nathan Binkert
30955SN/A
31955SN/Aimport os, subprocess
32955SN/A
33955SN/AImport('env')
34955SN/A
35955SN/Aelf_files = []
36955SN/Adef ElfFile(filename):
37955SN/A    elf_files.append(File(filename))
38955SN/A    
39955SN/AElfFile('elf_begin.c')
40955SN/AElfFile('elf_cntl.c')
41955SN/AElfFile('elf_data.c')
422665Ssaidi@eecs.umich.eduElfFile('elf_end.c')
432665Ssaidi@eecs.umich.eduElfFile('elf_fill.c')
445863Snate@binkert.orgElfFile('elf_flag.c')
45955SN/AElfFile('elf_getarhdr.c')
46955SN/AElfFile('elf_getarsym.c')
47955SN/AElfFile('elf_getbase.c')
48955SN/AElfFile('elf_getident.c')
49955SN/AElfFile('elf_hash.c')
508878Ssteve.reinhardt@amd.comElfFile('elf_kind.c')
512632Sstever@eecs.umich.eduElfFile('elf_memory.c')
528878Ssteve.reinhardt@amd.comElfFile('elf_next.c')
532632Sstever@eecs.umich.eduElfFile('elf_phnum.c')
54955SN/AElfFile('elf_rand.c')
558878Ssteve.reinhardt@amd.comElfFile('elf_rawfile.c')
562632Sstever@eecs.umich.eduElfFile('elf_scn.c')
572761Sstever@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')
612761Sstever@eecs.umich.eduElfFile('elf_version.c')
622761Sstever@eecs.umich.eduElfFile('gelf_checksum.c')
632761Sstever@eecs.umich.eduElfFile('gelf_dyn.c')
648878Ssteve.reinhardt@amd.comElfFile('gelf_ehdr.c')
658878Ssteve.reinhardt@amd.comElfFile('gelf_fsize.c')
662761Sstever@eecs.umich.eduElfFile('gelf_getclass.c')
672761Sstever@eecs.umich.eduElfFile('gelf_phdr.c')
682761Sstever@eecs.umich.eduElfFile('gelf_rel.c')
692761Sstever@eecs.umich.eduElfFile('gelf_rela.c')
702761Sstever@eecs.umich.eduElfFile('gelf_shdr.c')
718878Ssteve.reinhardt@amd.comElfFile('gelf_sym.c')
728878Ssteve.reinhardt@amd.comElfFile('gelf_symshndx.c')
732632Sstever@eecs.umich.eduElfFile('gelf_xlate.c')
742632Sstever@eecs.umich.eduElfFile('libelf.c')
758878Ssteve.reinhardt@amd.comElfFile('libelf_align.c')
768878Ssteve.reinhardt@amd.comElfFile('libelf_allocate.c')
772632Sstever@eecs.umich.eduElfFile('libelf_ar.c')
78955SN/AElfFile('libelf_checksum.c')
79955SN/AElfFile('libelf_data.c')
80955SN/AElfFile('libelf_ehdr.c')
815863Snate@binkert.orgElfFile('libelf_extended.c')
825863Snate@binkert.orgElfFile('libelf_phdr.c')
835863Snate@binkert.orgElfFile('libelf_shdr.c')
845863Snate@binkert.orgElfFile('libelf_xlate.c')
855863Snate@binkert.org
865863Snate@binkert.orgElfFile('libelf_convert.c')
875863Snate@binkert.orgElfFile('libelf_fsize.c')
885863Snate@binkert.orgElfFile('libelf_msize.c')
895863Snate@binkert.org
905863Snate@binkert.orgm4env = Environment(ENV=os.environ)
915863Snate@binkert.orgif env.get('CC'):
928878Ssteve.reinhardt@amd.com    m4env['CC'] = env['CC']
935863Snate@binkert.orgif env.get('CXX'):
945863Snate@binkert.org    m4env['CXX'] = env['CXX']
955863Snate@binkert.org# If we have gm4 use it
969812Sandreas.hansson@arm.comif subprocess.Popen("gm4 --version", shell=True, stdout=subprocess.PIPE, 
979812Sandreas.hansson@arm.com                     stderr=subprocess.STDOUT, close_fds=True).communicate()[0].find('GNU') >= 0:
985863Snate@binkert.org    m4env['M4'] = 'gm4'
999812Sandreas.hansson@arm.com
1005863Snate@binkert.orgm4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path)
1015863Snate@binkert.orgm4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET'
1025863Snate@binkert.orgm4env.M4(target=File('libelf_convert.c'),
1039812Sandreas.hansson@arm.com         source=[File('elf_types.m4'), File('libelf_convert.m4')])
1049812Sandreas.hansson@arm.comm4env.M4(target=File('libelf_fsize.c'),
1055863Snate@binkert.org         source=[File('elf_types.m4'), File('libelf_fsize.m4')])
1065863Snate@binkert.orgm4env.M4(target=File('libelf_msize.c'),
1078878Ssteve.reinhardt@amd.com         source=[File('elf_types.m4'), File('libelf_msize.m4')])
1085863Snate@binkert.orgm4env.Library('elf', elf_files)
1095863Snate@binkert.org
1105863Snate@binkert.orgenv.Append(CPPPATH=Dir('.'))
1116654Snate@binkert.orgenv.Append(LIBS=['elf'])
11210196SCurtis.Dunham@arm.comenv.Append(LIBPATH=[Dir('.')])
113955SN/A
1145396Ssaidi@eecs.umich.edu