[llvm-commits] [hlvm] r38123 - in /hlvm/trunk/build: codegen.py configure.py hlvm.py
Reid Spencer
reid at x10sys.com
Sat Jul 7 17:00:05 PDT 2007
Author: reid
Date: Sat Jul 7 19:00:04 2007
New Revision: 38123
URL: http://llvm.org/viewvc/llvm-project?rev=38123&view=rev
Log:
More improvements.
Added:
hlvm/trunk/build/codegen.py
Modified:
hlvm/trunk/build/configure.py
hlvm/trunk/build/hlvm.py
Added: hlvm/trunk/build/codegen.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/codegen.py?rev=38123&view=auto
==============================================================================
--- hlvm/trunk/build/codegen.py (added)
+++ hlvm/trunk/build/codegen.py Sat Jul 7 19:00:04 2007
@@ -0,0 +1,27 @@
+from SCons.Environment import Environment as Environment
+import re,fileinput,os
+from string import join as sjoin
+from os.path import join as pjoin
+
+def CPP2LLVMCPPAction(target,source,env):
+ funcName = os.path.splitext(os.path.basename(source[0].path))[0]
+ src = source[0].path
+ tgt = target[0].path
+ theAction = env.Action(
+ "PATH='" + env['LLVM_bin'] + "' " + env['with_llvmgxx'] +
+ " -c -x c++ " + src + " -o - | " +
+ env['with_llvmdis'] + " -o - | " +
+ env['with_llvm2cpp'] + " " + env['LLVM2CPPFLAGS'] + " -o " + tgt
+ )
+ env.Execute(theAction);
+ return 0
+
+def CPP2LLVMCPPMessage(target,source,env):
+ return "Generating LLVM IR C++ From C++ Input: " + source[0].path
+
+def Cpp2LLVMCpp(env):
+ a = env.Action(CPP2LLVMCPPAction,CPP2LLVMCPPMessage)
+ b = env.Builder(action=a,suffix='inc',src_suffix='h',single_source=1)
+ env.Append(BUILDERS = {'Cpp2LLVMCpp':b})
+ env['LLVM2CPPFLAGS'] = "";
+ return 1
Modified: hlvm/trunk/build/configure.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/configure.py?rev=38123&r1=38122&r2=38123&view=diff
==============================================================================
--- hlvm/trunk/build/configure.py (original)
+++ hlvm/trunk/build/configure.py Sat Jul 7 19:00:04 2007
@@ -5,6 +5,7 @@
from os.path import isfile as isfile
from os.path import exists as exists
from os import environ as environ
+from string import join as sjoin
def _getline(env,msg):
@@ -40,7 +41,7 @@
return AskForDirs(context,pkgname,hdr,libs)
def FindPackage(context,pkgname,hdr,libs,code='main(argc,argv);',paths=[],
- objs=[], hdrpfx=''):
+ objs=[],hdrpfx='',progs=[]):
msg = 'Checking for ' + pkgname + '...'
context.Message(msg)
lastLIBS = context.env['LIBS']
@@ -103,6 +104,16 @@
continue
else:
context.env.Replace(LIBS=lastLIBS, LINKFLAGS=lastLINKFLAGS)
+ ret = 1
+ bindir = pjoin(p,'bin')
+ for pr in progs:
+ if not exists(pjoin(bindir,pr)):
+ ret = 0
+ break;
+ if not ret:
+ continue
+ if len(progs) > 0:
+ context.env[pkgname + '_bin'] = bindir
context.env[pkgname + '_lib'] = libdir
context.env[pkgname + '_inc'] = hdrdir
context.Result('Found: (' + hdrdir + ',' + libdir + ')')
@@ -112,8 +123,10 @@
def FindLLVM(conf,env):
code = 'new llvm::Module("Name");'
- return conf.FindPackage('LLVM','llvm/Module.h',['LLVMSupport','LLVMSystem'],
- code,[env['with_llvm'],'/proj/install/llvm'],['LLVMCore','LLVMbzip2'])
+ conf.FindPackage('LLVM','llvm/Module.h',['LLVMSupport','LLVMSystem'],
+ code,[env['with_llvm'],'/proj/install/llvm'],['LLVMCore','LLVMbzip2'],
+ '', ['llvm-as','llc'] )
+
def FindAPR(conf,env):
code = 'apr_initialize();'
@@ -132,11 +145,14 @@
def CheckProgram(context,progname,varname,moredirs=[]):
context.Message("Checking for " + progname + "...")
- paths = environ['PATH']
- fname = context.env.WhereIs(progname,paths)
- ret = fname != None
- if ret:
- context.env[varname] = fname
+ if exists(context.env[varname]):
+ ret = 1
+ else:
+ paths = sjoin(moredirs,':') + environ['PATH']
+ fname = context.env.WhereIs(progname,paths)
+ ret = fname != None
+ if ret:
+ context.env[varname] = fname
context.Result(ret)
return ret
@@ -180,18 +196,28 @@
return 1
def CheckForPrograms(conf,env):
- if not conf.CheckProgram('gperf','GPERF'):
+ if not conf.CheckProgram('gperf','with_gperf'):
+ env.Exit(1)
+ if not conf.CheckProgram('llc','with_llc'):
+ env.Exit(1)
+ if not conf.CheckProgram('llvm-dis','with_llvmdis',[env['LLVM_bin']]):
+ env.Exit(1)
+ if not conf.CheckProgram('llvm-as','with_llvmas',[env['LLVM_bin']]):
+ env.Exit(1)
+ if not conf.CheckProgram('llvm-gcc','with_llvmgcc',[env['LLVM_bin']]):
+ env.Exit(1)
+ if not conf.CheckProgram('llvm-g++','with_llvmgxx',[env['LLVM_bin']]):
env.Exit(1)
- if not conf.CheckProgram('llc','LLC'):
+ if not conf.CheckProgram('llvm2cpp','with_llvm2cpp',[env['LLVM_bin']]):
env.Exit(1)
- if not conf.CheckProgram('runtest','RUNTEST'):
- env['RUNTEST'] = None
+ if not conf.CheckProgram('runtest','with_runtest'):
+ env['with_runtest'] = None
print "*** TESTING DISABLED ***"
- if not conf.CheckProgram('doxygen','DOXYGEN'):
- env['DOXYGEN'] = None
+ if not conf.CheckProgram('doxygen','with_doxygen'):
+ env['with_runtest'] = None
print "*** DOXYGEN DISABLED ***"
- if not conf.CheckProgram('xsltproc','XSLTPROC'):
- env['XSLTPROC'] = None
+ if not conf.CheckProgram('xsltproc','with_xsltproc'):
+ env['with_runtest'] = None
print "*** XSLTPROC DISABLED ***"
return 1
Modified: hlvm/trunk/build/hlvm.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/hlvm.py?rev=38123&r1=38122&r2=38123&view=diff
==============================================================================
--- hlvm/trunk/build/hlvm.py (original)
+++ hlvm/trunk/build/hlvm.py Sat Jul 7 19:00:04 2007
@@ -17,12 +17,16 @@
return glob.glob(spec)
def GetAllCXXFiles(env):
- return env.Flatten([GetFiles(env,'*.cpp'),GetFiles(env,'*.cxx')])
+ return env.Flatten([GetFiles(env,'*.cpp')])
def GetRNGQuoteSource(env):
from build import filterbuilders
return filterbuilders.RNGQuoteSource(env)
+def GetCpp2LLVMCpp(env):
+ from build import codegen
+ return codegen.Cpp2LLVMCpp(env)
+
def GetRNGTokenizer(env):
from build import filterbuilders
return filterbuilders.RNGTokenizer(env)
@@ -77,6 +81,26 @@
opts.Add('with_apr','Specify where apr is located','/usr/local/apr'),
opts.Add('with_apru','Specify where apr-utils is located','/usr/local/apr'),
opts.Add('with_xml2','Specify where LibXml2 is located','/usr/local'),
+ opts.Add('with_gperf','Specify where the gperf program is located',
+ '/usr/local/bin/gperf')
+ opts.Add('with_llc','Specify where the LLVM compiler is located',
+ '/usr/local/bin/llc')
+ opts.Add('with_llvmdis','Specify where the LLVM disassembler is located',
+ '/usr/local/bin/llvm-dis')
+ opts.Add('with_llvmas','Specify where the LLVM assembler is located',
+ '/usr/local/bin/llvm-as')
+ opts.Add('with_llvmgcc','Specify where the LLVM C compiler is located',
+ '/usr/local/bin/llvm-gcc')
+ opts.Add('with_llvmgxx','Specify where the LLVM C++ compiler is located',
+ '/usr/local/bin/llvm-g++')
+ opts.Add('with_llvm2cpp','Specify where the LLVM llvm2cpp program is located',
+ '/usr/local/bin/llvm2cpp')
+ opts.Add('with_runtest','Specify where DejaGnu runtest program is located',
+ '/usr/local/bin/runtest')
+ opts.Add('with_doxygen','Specify where the doxygen program is located',
+ '/usr/local/bin/doxygen')
+ opts.Add('with_xsltproc','Specify where the XSLT processor is located',
+ '/usr/local/bin/xsltproc')
opts.Update(env)
opts.Save('.options_cache',env)
env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
@@ -87,10 +111,10 @@
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['CCFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -pedantic'
env['CXXFLAGS'] = ' -pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated'
- env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -ffor-scope'
- env['CXXFLAGS']+= ' -fno-operator-names -Wno-unused'
+ env['CXXFLAGS']+= ' -Wold-style-cast -Woverloaded-virtual -Wno-unused'
+ env['CXXFLAGS']+= ' -pedantic -fno-operator-names -ffor-scope -fconst-strings'
env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None, '_GNU_SOURCE':None }
VariantName=''
if env['small'] == 1:
More information about the llvm-commits
mailing list