[llvm-commits] [hlvm] r38083 - in /hlvm/trunk: ./ SConstruct hlvm/AST/SConscript hlvm/Base/SConscript hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript scons/check.py scons/environment.py scons/filterbuilders.py scons/hlvm.py scons/main.py test/SConscript tools/SConscript tools/hlvm-xml2xml/SConscript tools/hlvm/ tools/hlvm/SConscript tools/hlvm/hlvm.cpp
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:40 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:40 2007
New Revision: 38083
URL: http://llvm.org/viewvc/llvm-project?rev=38083&view=rev
Log:
scons changes:
1. implify the usage of the hlvm.Dirs
2. rename "main" as "hlvm"
3. Put headers in all the SConscript files
4. Add a shell for the HLVM virtual machine program as a way to test scons
Added:
hlvm/trunk/scons/hlvm.py
- copied, changed from r38081, hlvm/trunk/scons/main.py
hlvm/trunk/tools/hlvm/
hlvm/trunk/tools/hlvm/SConscript
hlvm/trunk/tools/hlvm/hlvm.cpp
Removed:
hlvm/trunk/scons/main.py
Modified:
hlvm/trunk/ (props changed)
hlvm/trunk/SConstruct
hlvm/trunk/hlvm/AST/SConscript
hlvm/trunk/hlvm/Base/SConscript
hlvm/trunk/hlvm/Reader/SConscript
hlvm/trunk/hlvm/Reader/XML/SConscript
hlvm/trunk/hlvm/SConscript
hlvm/trunk/hlvm/Writer/SConscript
hlvm/trunk/hlvm/Writer/XML/SConscript
hlvm/trunk/scons/check.py
hlvm/trunk/scons/environment.py
hlvm/trunk/scons/filterbuilders.py
hlvm/trunk/test/SConscript
hlvm/trunk/tools/SConscript
hlvm/trunk/tools/hlvm-xml2xml/SConscript
Propchange: hlvm/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 7 18:59:40 2007
@@ -1,3 +1,2 @@
build.*
-.sconsign.dblite
-options.cache
+.options_cache
Modified: hlvm/trunk/SConstruct
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/SConstruct?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/SConstruct (original)
+++ hlvm/trunk/SConstruct Sat Jul 7 18:59:40 2007
@@ -1,11 +1,26 @@
-# HLVM scons Software Construction Specification
-#
-
-# Set up scons
-from os import path
-from scons import main
-env = main.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS)
+#===-- Build Script For HLVM ----------------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from scons import hlvm
+env = hlvm.GetBuildEnvironment(COMMAND_LINE_TARGETS,ARGUMENTS)
Export('env')
-main.Dirs(env,['hlvm','tools','test'])
-if 'check' in COMMAND_LINE_TARGETS:
- main.GetCheck(env)
+hlvm.Dirs(env,['hlvm','tools','test'])
Modified: hlvm/trunk/hlvm/AST/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/SConscript (original)
+++ hlvm/trunk/hlvm/AST/SConscript Sat Jul 7 18:59:40 2007
@@ -1,3 +1,27 @@
-from scons import main
+#===-- Build Script For hlvm/AST ------------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
+from scons import hlvm
Import('env')
-env.Library('HLVMAST',main.GetAllCXXFiles(env))
+lib = env.Library('HLVMAST',hlvm.GetAllCXXFiles(env))
+hlvm.InstallLibrary(env,lib)
Modified: hlvm/trunk/hlvm/Base/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Base/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Base/SConscript (original)
+++ hlvm/trunk/hlvm/Base/SConscript Sat Jul 7 18:59:40 2007
@@ -1,3 +1,27 @@
+#===-- Build Script For hlvm/Base -----------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
Import('env')
-from scons import main
-env.Library('HLVMBase',main.GetAllCXXFiles(env))
+from scons import hlvm
+lib = env.Library('HLVMBase',hlvm.GetAllCXXFiles(env))
+hlvm.InstallLibrary(env,lib)
Modified: hlvm/trunk/hlvm/Reader/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Reader/SConscript (original)
+++ hlvm/trunk/hlvm/Reader/SConscript Sat Jul 7 18:59:40 2007
@@ -1,2 +1,25 @@
+#===-- Build Script For hlvm/Reader ---------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from scons import hlvm
Import('env')
-SConscript('XML/SConscript')
+hlvm.Dirs(env,['XML'])
Modified: hlvm/trunk/hlvm/Reader/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/SConscript (original)
+++ hlvm/trunk/hlvm/Reader/XML/SConscript Sat Jul 7 18:59:40 2007
@@ -1,7 +1,32 @@
+#===-- Build Script For hlvm/Reader/XML -----------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
Import('env')
-from scons import main
-main.GetRNGQuoteSource(env)
-main.GetRNGTokenizer(env)
+from scons import hlvm
+hlvm.GetRNGQuoteSource(env)
+hlvm.GetRNGTokenizer(env)
env.RNGQuoteSource('HLVM.rng.inc','HLVM.rng')
env.RNGTokenizer('HLVMTokenizer.cpp','HLVM.rng')
-env.Library('HLVMXMLReader',main.GetAllCXXFiles(env)+['HLVMTokenizer.cpp'])
+lib = env.Library('HLVMXMLReader',
+ hlvm.GetAllCXXFiles(env)+['HLVMTokenizer.cpp'])
+hlvm.InstallLibrary(env,lib)
Modified: hlvm/trunk/hlvm/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/SConscript (original)
+++ hlvm/trunk/hlvm/SConscript Sat Jul 7 18:59:40 2007
@@ -1,6 +1,26 @@
+#===-- Build Script For hlvm ----------------------------------*- Python -*-===#
#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
+from scons import hlvm
Import('env')
-env.SConscript('Base/SConscript')
-env.SConscript('AST/SConscript')
-env.SConscript('Reader/SConscript')
-env.SConscript('Writer/SConscript')
+hlvm.Dirs(env,['Base','AST','Reader','Writer'])
Modified: hlvm/trunk/hlvm/Writer/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Writer/SConscript (original)
+++ hlvm/trunk/hlvm/Writer/SConscript Sat Jul 7 18:59:40 2007
@@ -1,2 +1,25 @@
+#===-- Build Script For hlvm/Writer ---------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from scons import hlvm
Import('env')
-SConscript('XML/SConscript')
+hlvm.Dirs(env,['XML'])
Modified: hlvm/trunk/hlvm/Writer/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/XML/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Writer/XML/SConscript (original)
+++ hlvm/trunk/hlvm/Writer/XML/SConscript Sat Jul 7 18:59:40 2007
@@ -1,3 +1,26 @@
+#===-- Build Script For hlvm/Writer/XML -----------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from scons import hlvm
Import('env')
-from scons import main
-env.Library('HLVMXMLWriter',main.GetAllCXXFiles(env))
+lib = env.Library('HLVMXMLWriter',hlvm.GetAllCXXFiles(env))
+hlvm.InstallLibrary(env,lib)
Modified: hlvm/trunk/scons/check.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/check.py?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/scons/check.py (original)
+++ hlvm/trunk/scons/check.py Sat Jul 7 18:59:40 2007
@@ -1,5 +1,4 @@
from SCons.Environment import Environment as Environment
-from environment import ProvisionEnvironment as ProvisionEnvironment
import re,fileinput,os,glob
from string import join as sjoin
from os.path import join as pjoin
@@ -40,7 +39,8 @@
context = os.path.basename(env.File(target[0]).path)
context = re.sub('(.*?)\..*','\\1',context)
print "context=",context
- os.system('DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+
+ os.system('cd ' + pjoin(env['BuildDir'],'test') +
+ '; DEJAGNU="'+pjoin(env['AbsObjRoot'],'test','site.exp')+'" '+
env['RUNTEST'] + ' --tool ' + context)
return 0
Modified: hlvm/trunk/scons/environment.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/environment.py?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/scons/environment.py (original)
+++ hlvm/trunk/scons/environment.py Sat Jul 7 18:59:40 2007
@@ -2,96 +2,3 @@
#
# Import stuff we need from SCons package
-from os.path import join as pjoin
-from SCons.Options import Options as Options
-from SCons.Options import BoolOption as BoolOption
-from SCons.Options import PathOption as PathOption
-from SCons.Environment import Environment as Environment
-from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment
-
-def ProvisionEnvironment(env,targets,arguments):
- env.EnsurePythonVersion(2,3)
- env.EnsureSConsVersion(0,96)
- env.SetOption('implicit_cache',1)
- env.TargetSignatures('build')
- VariantName=''
- opts = Options('custom.py',arguments)
- opts.AddOptions(
- BoolOption('assrt','Include assertions in the code',1),
- BoolOption('debug','Build with debug options turned on',1),
- BoolOption('inline','Cause inline code to be inline',0),
- BoolOption('optimize','Build object files with optimization',0),
- BoolOption('profile','Generate profiling aware code',0),
- BoolOption('small','Generate smaller code rather than faster',0),
- BoolOption('config','Generation the configuration data',0),
- PathOption('prefix','Specify where to install HLVM','/usr/local')
- )
- opts.Update(env)
- env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith'
- env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated'
- env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope'
- env['CXXFLAGS']+= ' -fno-operator-names'
- env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None }
- if env['small'] == 1:
- VariantName='S'
- env.Append(CCFLAGS=' -Os')
- env.Append(CXXFLAGS=' -Os')
- else :
- VariantName='s'
-
- if env['profile'] == 1:
- VariantName+='P'
- env.Append(CCFLAGS=' -pg')
- env.Append(CXXFLAGS=' -pg')
- else :
- VariantName+='p'
-
- if env['assrt'] == 1:
- VariantName+='A'
- env.Append(CPPDEFINES={'HLVM_ASSERT':None})
- else :
- VariantName+='a'
-
- if env['debug'] == 1 :
- VariantName += 'D'
- env.Append(CCFLAGS=' -g')
- env.Append(CXXFLAGS=' -g')
- env.Append(CPPDEFINES={'HLVM_DEBUG':None})
- else :
- VariantName+='d'
-
- if env['inline'] == 1:
- VariantName+='I'
- else :
- VariantName+='i'
- env.Append(CXXFLAGS=' -fno-inline')
-
- if env['optimize'] == 1 :
- VariantName+='O'
- env.Append(CCFLAGS=' -O3')
- env.Append(CXXFLAGS=' -O3')
- else :
- VariantName+='o'
- env.Append(CCFLAGS=' -O1')
- env.Append(CXXFLAGS=' -O1')
-
- BuildDir = 'build.' + VariantName
- env['Variant'] = VariantName
- env['BuildDir'] = BuildDir
- env['AbsObjRoot'] = env.Dir(BuildDir).abspath
- env['AbsSrcRoot'] = env.Dir('#').abspath
- env['LIBPATH'] = [
- pjoin('#',BuildDir,'hlvm/Base'),
- pjoin('#',BuildDir,'hlvm/AST'),
- pjoin('#',BuildDir,'hlvm/Reader/XML'),
- pjoin('#',BuildDir,'hlvm/Writer/XML')
- ];
- env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0)
- env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0)
- env.Prepend(CPPPATH=[pjoin('#',BuildDir)])
- env.Prepend(CPPPATH=['#'])
- env.SConsignFile(pjoin(BuildDir,'sconsign'))
-
- opts.Save('options.cache', env)
- env.Help(opts.GenerateHelpText(env,sort=cmp))
- return env;
Modified: hlvm/trunk/scons/filterbuilders.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/filterbuilders.py?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/scons/filterbuilders.py (original)
+++ hlvm/trunk/scons/filterbuilders.py Sat Jul 7 18:59:40 2007
@@ -1,5 +1,4 @@
from SCons.Environment import Environment as Environment
-from environment import ProvisionEnvironment as ProvisionEnvironment
import re,fileinput,os
from string import join as sjoin
from os.path import join as pjoin
@@ -85,7 +84,7 @@
tknFile.write('%%\n')
tknFile.close()
gperfAction = env.Action(
- "$GPERF -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass +
+ env['GPERF'] + " -tcDCIoGl --fast 0 -L C++ -Z " + TokenHashClass +
" -s 2 -S 1 -k '*' " + tknFilename + " >" + TokenHashFile)
env.Execute(gperfAction)
tokenList = ""
Copied: hlvm/trunk/scons/hlvm.py (from r38081, hlvm/trunk/scons/main.py)
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/hlvm.py?p2=hlvm/trunk/scons/hlvm.py&p1=hlvm/trunk/scons/main.py&r1=38081&r2=38083&rev=38083&view=diff
==============================================================================
--- hlvm/trunk/scons/main.py (original)
+++ hlvm/trunk/scons/hlvm.py Sat Jul 7 18:59:40 2007
@@ -1,29 +1,20 @@
+from SCons.Options import Options as Options
+from SCons.Options import BoolOption as BoolOption
+from SCons.Options import PathOption as PathOption
+from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment
from SCons.Environment import Environment as Environment
-from environment import ProvisionEnvironment as ProvisionEnvironment
from configure import ConfigureHLVM as ConfigureHLVM
-from os import path as path
+from os.path import join as pjoin
from string import join as sjoin
from string import replace as strrepl
import glob
-def GetBuildEnvironment(targets,arguments):
- env = Environment();
- env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
- env['HLVM_Maintainer'] = 'Reid Spencer <rspencer at reidspencer>'
- env['HLVM_Version'] = '0.1svn'
- env['HLVM_SO_CURRENT'] = '0'
- env['HLVM_SO_REVISION'] = '1'
- env['HLVM_SO_AGE'] = '0'
- env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION']
- env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE']
- ProvisionEnvironment(env,targets,arguments)
- return ConfigureHLVM(env)
def GetAllCXXFiles(env):
dir = env.Dir('.').abspath
- dir = strrepl(dir,path.join(env['BuildDir'],''),'',1)
- p1 = glob.glob(path.join(dir,'*.cpp'))
- p2 = glob.glob(path.join(dir,'*.cxx'))
- p3 = glob.glob(path.join(dir,'*.C'))
+ dir = strrepl(dir,pjoin(env['BuildDir'],''),'',1)
+ p1 = glob.glob(pjoin(dir,'*.cpp'))
+ p2 = glob.glob(pjoin(dir,'*.cxx'))
+ p3 = glob.glob(pjoin(dir,'*.C'))
return env.Flatten([p1,p2,p3])
def GetRNGQuoteSource(env):
@@ -34,13 +25,154 @@
from scons import filterbuilders
return filterbuilders.RNGTokenizer(env)
-def GetCheck(env):
- from scons import check
- return check.Check(env)
-
def Dirs(env,dirlist=[]):
+ dir = env.Dir('.').path
+ top = env.Dir('#').path
+ if top == dir:
+ path = pjoin('#',env['BuildDir'])
+ else:
+ path = ''
+ print "Entering Directory",dir
+ result = []
for d in dirlist:
- env.SConscript(path.join(env['BuildDir'],d,'SConscript'))
+ result.append(pjoin(path,d,'SConscript'))
+ env.SConscript(result)
+
+def InstallProgram(env,prog):
+ dir = pjoin(env['prefix'],'bin')
+ env.Install(dir,prog)
+ env.Alias('install',dir)
+ return 1
+
+def InstallLibrary(env,lib):
+ dir = pjoin(env['prefix'],'lib')
+ env.Install(dir,lib)
+ env.Alias('install',dir)
+ return 1
+
+def InstallHeader(env,hdrname):
+ dir = pjoin(env['prefix'],'include')
+ env.Install(dir,hdrname)
+ env.Alias('install',dir)
+ return 1
def join(one,two):
- return path.join([one,two])
+ return pjoin([one,two])
+
+def GetBuildEnvironment(targets,arguments):
+ env = Environment();
+ env.EnsurePythonVersion(2,3)
+ env.EnsureSConsVersion(0,96)
+ env.SetOption('implicit_cache',1)
+ env.TargetSignatures('build')
+ opts = Options('.options_cache',arguments)
+ opts.AddOptions(
+ BoolOption('assertions','Include assertions in the code',1),
+ BoolOption('debug','Build with debug options turned on',1),
+ BoolOption('inline','Cause inline code to be inline',0),
+ BoolOption('optimize','Build object files with optimization',0),
+ BoolOption('profile','Generate profiling aware code',0),
+ BoolOption('small','Generate smaller code rather than faster',0),
+ PathOption('prefix','Specify where to install HLVM','/usr/local')
+ )
+ opts.Update(env)
+ opts.Save('.options_cache',env)
+ env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
+ env['HLVM_Maintainer'] = 'Reid Spencer <rspencer at reidspencer>'
+ env['HLVM_Version'] = '0.1svn'
+ env['HLVM_SO_CURRENT'] = '0'
+ env['HLVM_SO_REVISION'] = '1'
+ env['HLVM_SO_AGE'] = '0'
+ env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION']
+ env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE']
+ env['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith'
+ env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated'
+ env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope'
+ env['CXXFLAGS']+= ' -fno-operator-names'
+ env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None }
+ VariantName=''
+ if env['small'] == 1:
+ VariantName='S'
+ env.Append(CCFLAGS=' -Os')
+ env.Append(CXXFLAGS=' -Os')
+ else :
+ VariantName='s'
+
+ if env['profile'] == 1:
+ VariantName+='P'
+ env.Append(CCFLAGS=' -pg')
+ env.Append(CXXFLAGS=' -pg')
+ else :
+ VariantName+='p'
+
+ if env['assertions'] == 1:
+ VariantName+='A'
+ env.Append(CPPDEFINES={'HLVM_ASSERT':None})
+ else :
+ VariantName+='a'
+
+ if env['debug'] == 1 :
+ VariantName += 'D'
+ env.Append(CCFLAGS=' -g')
+ env.Append(CXXFLAGS=' -g')
+ env.Append(CPPDEFINES={'HLVM_DEBUG':None})
+ else :
+ VariantName+='d'
+
+ if env['inline'] == 1:
+ VariantName+='I'
+ else :
+ VariantName+='i'
+ env.Append(CXXFLAGS=' -fno-inline')
+
+ if env['optimize'] == 1 :
+ VariantName+='O'
+ env.Append(CCFLAGS=' -O3')
+ env.Append(CXXFLAGS=' -O3')
+ else :
+ VariantName+='o'
+ env.Append(CCFLAGS=' -O1')
+ env.Append(CXXFLAGS=' -O1')
+
+ BuildDir = 'build.' + VariantName
+ env['Variant'] = VariantName
+ env['BuildDir'] = BuildDir
+ env['AbsObjRoot'] = env.Dir(BuildDir).abspath
+ env['AbsSrcRoot'] = env.Dir('#').abspath
+ env['LIBPATH'] = [
+ pjoin('#',BuildDir,'hlvm/Base'),
+ pjoin('#',BuildDir,'hlvm/AST'),
+ pjoin('#',BuildDir,'hlvm/Reader/XML'),
+ pjoin('#',BuildDir,'hlvm/Writer/XML')
+ ];
+ env.BuildDir(pjoin(BuildDir,'hlvm'),'hlvm',duplicate=0)
+ env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0)
+ env.BuildDir(pjoin(BuildDir,'test'),'test',duplicate=0)
+ env.Prepend(CPPPATH=[pjoin('#',BuildDir)])
+ env.Prepend(CPPPATH=['#'])
+ env.SConsignFile(pjoin(BuildDir,'sconsign'))
+ env.Help("""
+HLVM Build Environment
+
+Usage Examples::
+ scons - to do a normal build
+ scons --clean - to remove all derived (built) objects
+ scons check - to run the DejaGnu test suite
+ scons install - to install HLVM to a target directory
+
+Options: (Default)
+ debug=on/off - include debug symbols and code? (on)
+ assrt=on/off - include code assertions? (on)
+ optimize=on/off - optimize generated code? (off)
+ inline=on/off - make inline calls inline? (off)
+ small=on/off - make smaller rather than faster code? (off)
+ profile=on/off - generate code for gprof profiling? (off)
+ prefix=<path> - specify where HLVM should be installed (/usr/local)
+""")
+ print "HLVM BUILD MODE:", VariantName
+ env = ConfigureHLVM(env)
+ if 'check' in targets:
+ from scons import check
+ check.Check(env)
+ return env
+
Removed: hlvm/trunk/scons/main.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/main.py?rev=38082&view=auto
==============================================================================
--- hlvm/trunk/scons/main.py (original)
+++ hlvm/trunk/scons/main.py (removed)
@@ -1,46 +0,0 @@
-from SCons.Environment import Environment as Environment
-from environment import ProvisionEnvironment as ProvisionEnvironment
-from configure import ConfigureHLVM as ConfigureHLVM
-from os import path as path
-from string import join as sjoin
-from string import replace as strrepl
-import glob
-def GetBuildEnvironment(targets,arguments):
- env = Environment();
- env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
- env['HLVM_Maintainer'] = 'Reid Spencer <rspencer at reidspencer>'
- env['HLVM_Version'] = '0.1svn'
- env['HLVM_SO_CURRENT'] = '0'
- env['HLVM_SO_REVISION'] = '1'
- env['HLVM_SO_AGE'] = '0'
- env['HLVM_SO_VERSION'] = env['HLVM_SO_CURRENT']+':'+env['HLVM_SO_REVISION']
- env['HLVM_SO_VERSION'] += ':' + env['HLVM_SO_AGE']
- ProvisionEnvironment(env,targets,arguments)
- return ConfigureHLVM(env)
-
-def GetAllCXXFiles(env):
- dir = env.Dir('.').abspath
- dir = strrepl(dir,path.join(env['BuildDir'],''),'',1)
- p1 = glob.glob(path.join(dir,'*.cpp'))
- p2 = glob.glob(path.join(dir,'*.cxx'))
- p3 = glob.glob(path.join(dir,'*.C'))
- return env.Flatten([p1,p2,p3])
-
-def GetRNGQuoteSource(env):
- from scons import filterbuilders
- return filterbuilders.RNGQuoteSource(env)
-
-def GetRNGTokenizer(env):
- from scons import filterbuilders
- return filterbuilders.RNGTokenizer(env)
-
-def GetCheck(env):
- from scons import check
- return check.Check(env)
-
-def Dirs(env,dirlist=[]):
- for d in dirlist:
- env.SConscript(path.join(env['BuildDir'],d,'SConscript'))
-
-def join(one,two):
- return path.join([one,two])
Modified: hlvm/trunk/test/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/test/SConscript (original)
+++ hlvm/trunk/test/SConscript Sat Jul 7 18:59:40 2007
@@ -1,3 +1,24 @@
+#===-- Build Script For test ----------------------------------*- Python -*-===#
#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from scons import hlvm
Import('env')
-from scons import main
Modified: hlvm/trunk/tools/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/tools/SConscript (original)
+++ hlvm/trunk/tools/SConscript Sat Jul 7 18:59:40 2007
@@ -1,4 +1,26 @@
+#===-- Build Script For tools ---------------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
+from scons import hlvm
Import('env')
-env.SConscript([
- 'hlvm-xml2xml/SConscript'
-])
+hlvm.Dirs(env,['hlvm-xml2xml','hlvm'])
Modified: hlvm/trunk/tools/hlvm-xml2xml/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm-xml2xml/SConscript?rev=38083&r1=38082&r2=38083&view=diff
==============================================================================
--- hlvm/trunk/tools/hlvm-xml2xml/SConscript (original)
+++ hlvm/trunk/tools/hlvm-xml2xml/SConscript Sat Jul 7 18:59:40 2007
@@ -1,6 +1,29 @@
-from scons import main
+#===-- Build Script For tools/hlvm-xml2xml --------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
+from scons import hlvm
Import('env')
-env.Program('hlvm-xml2xml', main.GetAllCXXFiles(env),
+prog = env.Program('hlvm-xml2xml', hlvm.GetAllCXXFiles(env),
LIBS=[
'HLVMXMLReader',
'HLVMXMLWriter',
@@ -13,3 +36,5 @@
'stdc++'
]
)
+hlvm.InstallProgram(env,prog)
+
Added: hlvm/trunk/tools/hlvm/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm/SConscript?rev=38083&view=auto
==============================================================================
--- hlvm/trunk/tools/hlvm/SConscript (added)
+++ hlvm/trunk/tools/hlvm/SConscript Sat Jul 7 18:59:40 2007
@@ -0,0 +1,38 @@
+#===-- Build Script For test ----------------------------------*- Python -*-===#
+#
+# High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library in the file named LICENSE.txt; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+#
+from scons import hlvm
+Import('env')
+env.Program('hlvm', hlvm.GetAllCXXFiles(env),
+ LIBS=[
+ 'HLVMXMLReader',
+ 'HLVMXMLWriter',
+ 'HLVMAST',
+ 'HLVMBase',
+ 'xml2',
+ 'LLVMSupport',
+ 'LLVMSystem',
+ 'apr-1',
+ 'stdc++'
+ ],
+)
Added: hlvm/trunk/tools/hlvm/hlvm.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm/hlvm.cpp?rev=38083&view=auto
==============================================================================
--- hlvm/trunk/tools/hlvm/hlvm.cpp (added)
+++ hlvm/trunk/tools/hlvm/hlvm.cpp Sat Jul 7 18:59:40 2007
@@ -0,0 +1,112 @@
+//===-- HLVM Main Program ---------------------------------------*- C++ -*-===//
+//
+// High Level Virtual Machine (HLVM)
+//
+// Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+//
+// This software is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This software is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+// more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library in the file named LICENSE.txt; if not, write to the
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+// MA 02110-1301 USA
+//
+//===----------------------------------------------------------------------===//
+/// @file tools/hlvm/hlvm.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/23
+/// @since 0.1.0
+/// @brief Implements the main program for the HLVM Virtual Machine
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/Base/Memory.h>
+#include <hlvm/Reader/XML/XMLReader.h>
+#include <hlvm/Writer/XML/XMLWriter.h>
+#include <llvm/Support/CommandLine.h>
+#include <llvm/System/Signals.h>
+#include <fstream>
+#include <iostream>
+
+using namespace llvm;
+using namespace hlvm;
+static cl::opt<std::string>
+InputFilename(cl::Positional, cl::desc("<input XML>"), cl::init("-"));
+
+static cl::opt<std::string>
+OutputFilename("o", cl::desc("Override output filename"),
+ cl::value_desc("filename"));
+
+int main(int argc, char**argv)
+{
+ try {
+ Base::initialize(argc,argv);
+ cl::ParseCommandLineOptions(argc, argv,
+ "hlvm-xml2xml XML->AST->XML translator\n");
+
+ std::ostream *Out = &std::cout; // Default to printing to stdout.
+
+ if (OutputFilename != "") { // Specified an output filename?
+ if (OutputFilename != "-") { // Not stdout?
+ Out = new std::ofstream(OutputFilename.c_str());
+ sys::RemoveFileOnSignal(sys::Path(OutputFilename));
+ }
+ } else {
+ if (InputFilename == "-") {
+ OutputFilename = "-";
+ } else {
+ std::string IFN = InputFilename;
+ OutputFilename = InputFilename + ".out";
+
+ Out = new std::ofstream(OutputFilename.c_str());
+ sys::RemoveFileOnSignal(sys::Path(OutputFilename));
+ }
+ }
+
+ if (!Out->good()) {
+ std::cerr << argv[0] << ": error opening " << OutputFilename
+ << ": sending to stdout instead!\n";
+ Out = &std::cout;
+ }
+
+ if (InputFilename == "-" ) {
+ std::cerr << "Not supported yet: input from stdin\n";
+ exit(2);
+ } else {
+ llvm::sys::Path path(InputFilename);
+ if (!path.canRead()) {
+ std::cerr << argv[0] << ": can't read input file: " << InputFilename
+ << "\n";
+ exit(2);
+ }
+ }
+
+ XMLReader* rdr = XMLReader::create(InputFilename);
+ XMLWriter* wrtr = XMLWriter::create(OutputFilename.c_str());
+ rdr->read();
+ AST* node = rdr->get();
+ if (node) {
+ wrtr->write(node);
+ }
+ delete rdr;
+ delete wrtr;
+
+ if (Out != &std::cout) {
+ static_cast<std::ofstream*>(Out)->close();
+ delete Out;
+ }
+ return 0;
+ } catch (const std::string& msg) {
+ std::cerr << argv[0] << ": " << msg << "\n";
+ } catch (...) {
+ std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n";
+ }
+ return 1;
+}
More information about the llvm-commits
mailing list