annotate lib/swig/swigwin-2.0.11/vms/genbuild.py @ 2222:66bd74aa9f5e

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