fix automatic makefile regeneration

This commit is contained in:
Aleksey 2023-10-09 21:04:55 +04:00
parent 41e930c5c5
commit e631373f40

15
make.py Normal file → Executable file
View File

@ -34,7 +34,8 @@ out_formats = {
with open(path_makefile_gen, 'w') as makefile: with open(path_makefile_gen, 'w') as makefile:
targets_list = list() targets_list = list()
# makefile: skeleton rules # makefile: skeleton rules
makefile.write(".PHONY: all clean stickers/\n") makefile.write(".PHONY: all default clean stickers/\n")
makefile.write("default: all\n")
makefile.write('stickers:\n\tmkdir stickers\n') makefile.write('stickers:\n\tmkdir stickers\n')
makefile.write('clean:\n\trm -vrf stickers\n') makefile.write('clean:\n\trm -vrf stickers\n')
for sticker_description_file in path_stickers_data_dir.glob('*.yaml'): for sticker_description_file in path_stickers_data_dir.glob('*.yaml'):
@ -46,16 +47,16 @@ with open(path_makefile_gen, 'w') as makefile:
/ ( sticker_description['name'] \ / ( sticker_description['name'] \
+ '.' \ + '.' \
+ out_formats[output_ext]['extension'] ) + out_formats[output_ext]['extension'] )
prerequisite_filename=f"{sticker_description_file} "
if sticker_description['input']['base'].get('format','') \ if sticker_description['input']['base'].get('format','') \
not in ('lavfi', 'image2'): not in ('lavfi', 'image2'):
prerequisite_filename = str(path_stickers_source_dir \ prerequisite_filename += str(
/ sticker_description['input']['base']['input']) path_stickers_source_dir \
else: / sticker_description['input']['base']['input']
prerequisite_filename = '' ).replace(' ', '\\ ')
targets_list.append(f"{target_filename}") targets_list.append(f"{target_filename}")
# makefile: rule declaration # makefile: rule declaration
escaped_prereq = prerequisite_filename.replace(' ', '\\ ') makefile.write(f"{target_filename}: {prerequisite_filename} | stickers\n")
makefile.write(f"{target_filename}: {escaped_prereq} | stickers\n")
# makefile: recipe ffmpeg base # makefile: recipe ffmpeg base
makefile.write('\tffmpeg ') makefile.write('\tffmpeg ')
# makefile: specify format if present # makefile: specify format if present