fix automatic makefile regeneration

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

23
make.py Normal file → Executable file
View File

@ -34,7 +34,8 @@ out_formats = {
with open(path_makefile_gen, 'w') as makefile:
targets_list = list()
# 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('clean:\n\trm -vrf stickers\n')
for sticker_description_file in path_stickers_data_dir.glob('*.yaml'):
@ -43,19 +44,19 @@ with open(path_makefile_gen, 'w') as makefile:
sticker_description = safe_load(yaml_file)
log.debug("stuff %s", sticker_description)
target_filename = path_stickers_output_dir \
/ ( sticker_description['name'] \
+ '.' \
+ out_formats[output_ext]['extension'] )
/ ( sticker_description['name'] \
+ '.' \
+ out_formats[output_ext]['extension'] )
prerequisite_filename=f"{sticker_description_file} "
if sticker_description['input']['base'].get('format','') \
not in ('lavfi', 'image2'):
prerequisite_filename = str(path_stickers_source_dir \
/ sticker_description['input']['base']['input'])
else:
prerequisite_filename = ''
not in ('lavfi', 'image2'):
prerequisite_filename += str(
path_stickers_source_dir \
/ sticker_description['input']['base']['input']
).replace(' ', '\\ ')
targets_list.append(f"{target_filename}")
# makefile: rule declaration
escaped_prereq = prerequisite_filename.replace(' ', '\\ ')
makefile.write(f"{target_filename}: {escaped_prereq} | stickers\n")
makefile.write(f"{target_filename}: {prerequisite_filename} | stickers\n")
# makefile: recipe ffmpeg base
makefile.write('\tffmpeg ')
# makefile: specify format if present