1 import os.path, string, posix, pyvms
5 IDIR = ['swig_root:[source.swig]', 'swig_root:[source.doh.include]',
6 'swig_root:[source.include]', 'swig_root:[source.preprocessor]']
8 def new_file(fg, dirname):
10 fn = 'swig_root:[vms.scripts]compil_' + os.path.basename(dirname) + '.com'
11 print >> fg, '$ @' + fn
14 print >> f, '$! Generated by genbuild.py'
16 print >> f, '$ libname = "swig_root:[vms.o_alpha]swig.olb"'
18 print >> f, '$ set default', pyvms.crtl_to_vms(dirname)[0][0]
20 print >> f, "$ idir := ", IDIR[0]
21 for i in range(1, len(IDIR)):
22 print >> f, '$ idir = idir + ",' + IDIR[i] + '"'
24 print >> f, "$ iflags = \"/include=(''idir', sys$disk:[])\""
25 print >> f, '$ oflags = \"/object=swig_root:[vms.o_alpha]'
26 print >> f, "$ cflags = \"''oflags'''iflags'''dflags'\""
27 print >> f, "$ cxxflags = \"''oflags'''iflags'''dflags'\""
36 $MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
38 $! P1 = What we are trying to make
39 $! P2 = Command to make it
41 $! P4 - P8 What it depends on
43 $ modname = f$parse(p3,,,"name")
45 $ set message/nofacility/noident/noseverity/notext
46 $ libr/lis=swig_root:[vms]swiglib.tmp/full/width=132/only='modname' 'libname'
47 $ set message/facility/ident/severity/text
49 $ open/read swigtmp swig_root:[vms]swiglib.tmp
62 $ read/end=module_not_found swigtmp r
64 $ Time = f$cvtime(f$extract(49, 20, r))
65 $ goto end_search_module
71 $ delete swig_root:[vms]swiglib.tmp;*
73 $ if modfound .eq. 0 then $ goto Makeit
75 $! Time = F$CvTime(F$File(P1,"RDT"))
79 $ If Argument .Eqs. "" Then Goto Exit
82 $ File = F$Element(El," ",Argument)
83 $ If File .Eqs. " " Then Goto Endl
87 $ AFile = F$Search(File)
88 $ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
89 $ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
96 $ If arg .Le. 8 Then Goto Loop
104 $ If V Then Set Verify
108 def listRep(args, dirname, filenames):
115 fc = new_file(fg, dirname)
117 cstr = "\"cc ''cflags'\" "
118 line = "$ call make swig_root:[vms.o_alpha]"
119 line += fn[:-1] + 'obj -'
121 line = "\t" + cstr + fn
123 elif fn[-4:] == '.cxx':
126 fc = new_file(fg, dirname)
128 cstr = "\"cxx ''cxxflags'\" "
129 line = "$ call make swig_root:[vms.o_alpha]"
130 line += fn[:-3] + 'obj -'
132 line = "\t" + cstr + fn
138 def genbuild(f, dir):
139 os.path.walk(dir, listRep, (f,))
140 cmd = 'set default swig_root:[vms]'
142 f = open('swig_root:[vms.scripts]build_all.com','w')
144 print >> f, '$! Generated by genbuild.py'
146 print >> f, '$ set default swig_root:[vms]'
148 print >> f, '$ @swig_root:[vms]build_init'
150 genbuild(f, '/swig_root/source')
152 print >> f, '$ set default swig_root:[vms]'
154 print >> f, '$ @swig_root:[vms]build_end'