1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
import os.path, string, posix, pyvms
#
#
IDIR = ['swig_root:[source.swig]', 'swig_root:[source.doh.include]',
'swig_root:[source.include]', 'swig_root:[source.preprocessor]']
def new_file(fg, dirname):
global IDIR
fn = 'swig_root:[vms.scripts]compil_' + os.path.basename(dirname) + '.com'
print >> fg, '$ @' + fn
f = open(fn, 'w')
print >> f, '$!'
print >> f, '$! Generated by genbuild.py'
print >> f, '$!'
print >> f, '$ libname = "swig_root:[vms.o_alpha]swig.olb"'
print >> f, '$'
print >> f, '$ set default', pyvms.crtl_to_vms(dirname)[0][0]
print >> f, '$'
print >> f, "$ idir := ", IDIR[0]
for i in range(1, len(IDIR)):
print >> f, '$ idir = idir + ",' + IDIR[i] + '"'
print >> f, '$'
print >> f, "$ iflags = \"/include=(''idir', sys$disk:[])\""
print >> f, '$ oflags = \"/object=swig_root:[vms.o_alpha]'
print >> f, "$ cflags = \"''oflags'''iflags'''dflags'\""
print >> f, "$ cxxflags = \"''oflags'''iflags'''dflags'\""
print >> f, '$'
return f
def end_file(f):
print >>f,"""$ exit
$!
$!
$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
$ V = 'F$Verify(0)
$! P1 = What we are trying to make
$! P2 = Command to make it
$! P3 = Source file
$! P4 - P8 What it depends on
$
$ modname = f$parse(p3,,,"name")
$ set noon
$ set message/nofacility/noident/noseverity/notext
$ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
$ set message/facility/ident/severity/text
$ on error then exit
$ open/read swigtmp swig_root:[vms]swiglib.tmp
$! skip header
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$ read swigtmp r
$!
$
$ read/end=module_not_found swigtmp r
$ modfound = 1
$ Time = f$cvtime(f$extract(49, 20, r))
$ goto end_search_module
$ module_not_found:
$ modfound = 0
$
$ end_search_module:
$ close swigtmp
$ delete swig_root:[vms]swiglib.tmp;*
$
$ if modfound .eq. 0 then $ goto Makeit
$
$! Time = F$CvTime(F$File(P1,"RDT"))
$arg=3
$Loop:
$ Argument = P'arg
$ If Argument .Eqs. "" Then Goto Exit
$ El=0
$Loop2:
$ File = F$Element(El," ",Argument)
$ If File .Eqs. " " Then Goto Endl
$ AFile = ""
$Loop3:
$ OFile = AFile
$ AFile = F$Search(File)
$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
$ Goto Loop3
$NextEL:
$ El = El + 1
$ Goto Loop2
$EndL:
$ arg=arg+1
$ If arg .Le. 8 Then Goto Loop
$ Goto Exit
$
$Makeit:
$ VV=F$VERIFY(1)
$ 'P2' 'P3'
$ VV='F$Verify(VV)
$Exit:
$ If V Then Set Verify
$ENDSUBROUTINE"""
def listRep(args, dirname, filenames):
fg = args[0]
first = 1
for fn in filenames:
if fn[-2:] == '.c':
if first:
first = 0
fc = new_file(fg, dirname)
cstr = "\"cc ''cflags'\" "
line = "$ call make swig_root:[vms.o_alpha]"
line += fn[:-1] + 'obj -'
print >> fc, line
line = "\t" + cstr + fn
print >> fc, line
elif fn[-4:] == '.cxx':
if first:
first = 0
fc = new_file(fg, dirname)
cstr = "\"cxx ''cxxflags'\" "
line = "$ call make swig_root:[vms.o_alpha]"
line += fn[:-3] + 'obj -'
print >> fc, line
line = "\t" + cstr + fn
print >> fc, line
if first == 0:
end_file(fc)
fc.close()
#
def genbuild(f, dir):
os.path.walk(dir, listRep, (f,))
cmd = 'set default swig_root:[vms]'
#
f = open('swig_root:[vms.scripts]build_all.com','w')
print >> f, '$!'
print >> f, '$! Generated by genbuild.py'
print >> f, '$!'
print >> f, '$ set default swig_root:[vms]'
print >> f, '$'
print >> f, '$ @swig_root:[vms]build_init'
#
genbuild(f, '/swig_root/source')
print >> f, '$'
print >> f, '$ set default swig_root:[vms]'
print >> f, '$'
print >> f, '$ @swig_root:[vms]build_end'
f.close
|