Skip to content

Commit 2897d07

Browse files
committed
Update prepare_ssl.py script to generate the .asm files.
1 parent 869778e commit 2897d07

1 file changed

Lines changed: 31 additions & 8 deletions

File tree

PCbuild/prepare_ssl.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,35 @@ def create_makefile64(makefile, m32):
8181
fout.write(line)
8282
os.unlink(m32)
8383

84+
def create_asms(makefile):
85+
#create a custom makefile out of the provided one
86+
asm_makefile = os.path.splitext(makefile)[0] + '.asm.mak'
87+
with open(makefile) as fin:
88+
with open(asm_makefile, 'w') as fout:
89+
for line in fin:
90+
# Keep everything up to the install target (it's convenient)
91+
if line.startswith('install: all'):
92+
break
93+
else:
94+
fout.write(line)
95+
asms = []
96+
for line in fin:
97+
if '.asm' in line and line.strip().endswith('.pl'):
98+
asms.append(line.split(':')[0])
99+
while line.strip():
100+
fout.write(line)
101+
line = next(fin)
102+
fout.write('\n')
103+
104+
fout.write('asms: $(TMP_D) ')
105+
fout.write(' '.join(asms))
106+
fout.write('\n')
107+
108+
os.system('nmake /f {} PERL=perl asms'.format(asm_makefile))
109+
os.unlink(asm_makefile)
110+
111+
112+
84113
def fix_makefile(makefile):
85114
"""Fix some stuff in all makefiles
86115
"""
@@ -164,14 +193,8 @@ def prep(arch):
164193
else:
165194
print(makefile, 'already exists!')
166195

167-
# If the assembler files don't exist in tmpXX, copy them there
168-
if os.path.exists("asm"+dirsuffix):
169-
if not os.path.exists("tmp"+dirsuffix):
170-
os.mkdir("tmp"+dirsuffix)
171-
for f in os.listdir("asm"+dirsuffix):
172-
if not f.endswith(".asm"): continue
173-
if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
174-
shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
196+
print('creating asms...')
197+
create_asms(makefile)
175198

176199
def main():
177200
if len(sys.argv) == 1:

0 commit comments

Comments
 (0)