[llvm-commits] [hlvm] r38094 - in /hlvm/trunk: build/hlvm.py hlvm/AST/SConscript hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript

Reid Spencer reid at x10sys.com
Sat Jul 7 16:59:46 PDT 2007


Author: reid
Date: Sat Jul  7 18:59:46 2007
New Revision: 38094

URL: http://llvm.org/viewvc/llvm-project?rev=38094&view=rev
Log:
Support installation of header files.

Modified:
    hlvm/trunk/build/hlvm.py
    hlvm/trunk/hlvm/AST/SConscript
    hlvm/trunk/hlvm/Reader/SConscript
    hlvm/trunk/hlvm/Reader/XML/SConscript
    hlvm/trunk/hlvm/Writer/SConscript
    hlvm/trunk/hlvm/Writer/XML/SConscript

Modified: hlvm/trunk/build/hlvm.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/hlvm.py?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/build/hlvm.py (original)
+++ hlvm/trunk/build/hlvm.py Sat Jul  7 18:59:46 2007
@@ -1,7 +1,9 @@
 from SCons.Options import Options as Options
 from SCons.Options import BoolOption as BoolOption
 from SCons.Options import PathOption as PathOption
+from SCons.Options import PackageOption as PackageOption
 from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment
+from SCons.Script import COMMAND_LINE_TARGETS as COMMAND_LINE_TARGETS
 from SCons.Environment import Environment as Environment
 from configure import ConfigureHLVM as ConfigureHLVM
 from os.path import join as pjoin
@@ -9,13 +11,13 @@
 from string import replace as strrepl
 import glob
 
+def GetFiles(env,pat,dir=''):
+  spec = pjoin(env.Dir('.').abspath,dir,pat)
+  spec = strrepl(spec,pjoin(env['BuildDir'],''),'',1)
+  return glob.glob(spec)
+
 def GetAllCXXFiles(env):
-  dir = env.Dir('.').abspath
-  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])
+  return env.Flatten([GetFiles(env,'*.cpp'),GetFiles(env,'*.cxx')])
 
 def GetRNGQuoteSource(env):
   from build import filterbuilders
@@ -36,21 +38,22 @@
     env.SConscript(sconsfile)
 
 def InstallProgram(env,prog):
-  dir = pjoin(env['prefix'],'bin')
-  env.Install(dir,prog)
-  env.Alias('install',dir)
+  if 'install' in COMMAND_LINE_TARGETS:
+    dir = pjoin(env['prefix'],'bin')
+    env.Install(dir,prog)
   return 1
 
 def InstallLibrary(env,lib):
-  dir = pjoin(env['prefix'],'lib')
-  env.Install(dir,lib)
-  env.Alias('install',dir)
+  if 'install' in COMMAND_LINE_TARGETS:
+    libdir = pjoin(env['prefix'],'lib')
+    env.Install(dir,lib)
   return 1
 
-def InstallHeader(env,hdrname):
-  dir = pjoin(env['prefix'],'include')
-  env.Install(dir,hdrname)
-  env.Alias('install',dir)
+def InstallHeader(env,hdrs):
+  if 'install' in COMMAND_LINE_TARGETS:
+    moddir = strrepl(env.Dir('.').path,pjoin(env['BuildDir'],''),'',1)
+    dir = pjoin(env['prefix'],'include',moddir)
+    env.Install(dir,hdrs)
   return 1
 
 def GetBuildEnvironment(targets,arguments):
@@ -67,8 +70,12 @@
     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')
+    PackageOption('llvm','Specify where LLVM is located','search'),
+    PackageOption('apr','Specify where apr is located','search'),
+    PackageOption('apru','Specify where apr-utils is located','search'),
+    PackageOption('xml2','Specify where LibXml2 is located','search'),
   )
+  opts.Add('prefix','Specify where to install HLVM','/usr/local')
   opts.Update(env)
   opts.Save('.options_cache',env)
   env['HLVM_Copyright'] = 'Copyright (c) 2006 Reid Spencer'
@@ -145,6 +152,10 @@
   env.BuildDir(pjoin(BuildDir,'tools'),'tools',duplicate=0)
   env.BuildDir(pjoin(BuildDir,'test'),'test',duplicate=0)
   env.SConsignFile(pjoin(BuildDir,'sconsign'))
+  if 'install' in COMMAND_LINE_TARGETS:
+    env.Alias('install',pjoin(env['prefix'],'bin'))
+    env.Alias('install',pjoin(env['prefix'],'lib'))
+    env.Alias('install',pjoin(env['prefix'],'include'))
   env.Help("""
 HLVM Build Environment
 
@@ -153,16 +164,10 @@
   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
+  scons doxygen     - to generate the doxygen documentation
 
-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)
-""")
+Options:
+""" + opts.GenerateHelpText(env,sort=cmp))
   print "HLVM BUILD MODE:", VariantName
   ConfigureHLVM(env)
   return env

Modified: hlvm/trunk/hlvm/AST/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/SConscript?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/SConscript (original)
+++ hlvm/trunk/hlvm/AST/SConscript Sat Jul  7 18:59:46 2007
@@ -22,5 +22,6 @@
 #===----------------------------------------------------------------------===#
 from build import hlvm
 Import('env')
-lib = env.Library('HLVMAST',hlvm.GetAllCXXFiles(env))
+lib = env.StaticLibrary('HLVMAST',hlvm.GetAllCXXFiles(env))
 hlvm.InstallLibrary(env,lib)
+hlvm.InstallHeader(env,hlvm.GetFiles(env,'*.h'))

Modified: hlvm/trunk/hlvm/Reader/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/SConscript?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/SConscript (original)
+++ hlvm/trunk/hlvm/Reader/SConscript Sat Jul  7 18:59:46 2007
@@ -23,3 +23,4 @@
 from build import hlvm
 Import('env')
 hlvm.Dirs(env,['XML'])
+hlvm.InstallHeader(env,['Reader.h'])

Modified: hlvm/trunk/hlvm/Reader/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/SConscript?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/SConscript (original)
+++ hlvm/trunk/hlvm/Reader/XML/SConscript Sat Jul  7 18:59:46 2007
@@ -29,3 +29,4 @@
 lib = env.Library('HLVMXMLReader',
         hlvm.GetAllCXXFiles(env)+['HLVMTokenizer.cpp'])
 hlvm.InstallLibrary(env,lib)
+hlvm.InstallHeader(env,['XMLReader.h'])

Modified: hlvm/trunk/hlvm/Writer/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/SConscript?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Writer/SConscript (original)
+++ hlvm/trunk/hlvm/Writer/SConscript Sat Jul  7 18:59:46 2007
@@ -23,3 +23,4 @@
 from build import hlvm
 Import('env')
 hlvm.Dirs(env,['XML'])
+hlvm.InstallHeader(env,['Writer.h'])

Modified: hlvm/trunk/hlvm/Writer/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/XML/SConscript?rev=38094&r1=38093&r2=38094&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Writer/XML/SConscript (original)
+++ hlvm/trunk/hlvm/Writer/XML/SConscript Sat Jul  7 18:59:46 2007
@@ -24,3 +24,4 @@
 Import('env')
 lib = env.Library('HLVMXMLWriter',hlvm.GetAllCXXFiles(env))
 hlvm.InstallLibrary(env,lib)
+hlvm.InstallHeader(env,['XMLWriter.h'])





More information about the llvm-commits mailing list