SConscript revision 4661
14202Sbinkertn@umich.edu# -*- mode:python -*-
24202Sbinkertn@umich.edu
34202Sbinkertn@umich.edu# Copyright (c) 2004-2005 The Regents of The University of Michigan
44202Sbinkertn@umich.edu# All rights reserved.
54202Sbinkertn@umich.edu#
64202Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without
74202Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are
84202Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright
94202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer;
104202Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright
114202Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the
124202Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution;
134202Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its
144202Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from
154202Sbinkertn@umich.edu# this software without specific prior written permission.
164202Sbinkertn@umich.edu#
174202Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
184202Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
194202Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
204202Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
214202Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
224202Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
234202Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
244202Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
254202Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264202Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
274202Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284202Sbinkertn@umich.edu#
294202Sbinkertn@umich.edu# Authors: Nathan Binkert
304202Sbinkertn@umich.edu
314202Sbinkertn@umich.eduimport os, subprocess
324202Sbinkertn@umich.edu
334486Sbinkertn@umich.eduImport('env')
344486Sbinkertn@umich.edu
358981Sandreas.hansson@arm.comelf_files = []
366165Ssanchezd@stanford.edudef ElfFile(filename):
376168Snate@binkert.org    elf_files.append(File(filename))
384202Sbinkertn@umich.edu    
394202Sbinkertn@umich.eduElfFile('elf_begin.c')
408981Sandreas.hansson@arm.comElfFile('elf_cntl.c')
414202Sbinkertn@umich.eduElfFile('elf_data.c')
428761Sgblack@eecs.umich.eduElfFile('elf_end.c')
434202Sbinkertn@umich.eduElfFile('elf_fill.c')
444202Sbinkertn@umich.eduElfFile('elf_flag.c')
458914Sandreas.hansson@arm.comElfFile('elf_getarhdr.c')
464202Sbinkertn@umich.eduElfFile('elf_getarsym.c')
478853Sandreas.hansson@arm.comElfFile('elf_getbase.c')
488799Sgblack@eecs.umich.eduElfFile('elf_getident.c')
498799Sgblack@eecs.umich.eduElfFile('elf_hash.c')
506168Snate@binkert.orgElfFile('elf_kind.c')
517768SAli.Saidi@ARM.comElfFile('elf_memory.c')
528931Sandreas.hansson@arm.comElfFile('elf_next.c')
538931Sandreas.hansson@arm.comElfFile('elf_phnum.c')
548931Sandreas.hansson@arm.comElfFile('elf_rand.c')
558931Sandreas.hansson@arm.comElfFile('elf_rawfile.c')
568763Sgblack@eecs.umich.eduElfFile('elf_scn.c')
577768SAli.Saidi@ARM.comElfFile('elf_shnum.c')
587768SAli.Saidi@ARM.comElfFile('elf_shstrndx.c')
598335Snate@binkert.orgElfFile('elf_strptr.c')
608335Snate@binkert.orgElfFile('elf_update.c')
618335Snate@binkert.orgElfFile('elf_version.c')
628981Sandreas.hansson@arm.comElfFile('gelf_checksum.c')
638335Snate@binkert.orgElfFile('gelf_dyn.c')
648335Snate@binkert.orgElfFile('gelf_ehdr.c')
658335Snate@binkert.orgElfFile('gelf_fsize.c')
668914Sandreas.hansson@arm.comElfFile('gelf_getclass.c')
677780Snilay@cs.wisc.eduElfFile('gelf_phdr.c')
688335Snate@binkert.orgElfFile('gelf_rel.c')
698335Snate@binkert.orgElfFile('gelf_rela.c')
708683Snilay@cs.wisc.eduElfFile('gelf_shdr.c')
718335Snate@binkert.orgElfFile('gelf_sym.c')
728335Snate@binkert.orgElfFile('gelf_symshndx.c')
738335Snate@binkert.orgElfFile('gelf_xlate.c')
748335Snate@binkert.orgElfFile('libelf.c')
758335Snate@binkert.orgElfFile('libelf_align.c')
768335Snate@binkert.orgElfFile('libelf_allocate.c')
778615Snilay@cs.wisc.eduElfFile('libelf_ar.c')
788335Snate@binkert.orgElfFile('libelf_checksum.c')
798687Snilay@cs.wisc.eduElfFile('libelf_data.c')
808335Snate@binkert.orgElfFile('libelf_ehdr.c')
817780Snilay@cs.wisc.eduElfFile('libelf_extended.c')
827780Snilay@cs.wisc.eduElfFile('libelf_phdr.c')
838687Snilay@cs.wisc.eduElfFile('libelf_shdr.c')
848683Snilay@cs.wisc.eduElfFile('libelf_xlate.c')
85
86ElfFile('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